CN109960510B - Method for reinforcing Android application dynamic link library and related equipment - Google Patents

Method for reinforcing Android application dynamic link library and related equipment Download PDF

Info

Publication number
CN109960510B
CN109960510B CN201910214661.7A CN201910214661A CN109960510B CN 109960510 B CN109960510 B CN 109960510B CN 201910214661 A CN201910214661 A CN 201910214661A CN 109960510 B CN109960510 B CN 109960510B
Authority
CN
China
Prior art keywords
dynamic link
link library
information
compiling
library file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910214661.7A
Other languages
Chinese (zh)
Other versions
CN109960510A (en
Inventor
肖巍
廖兴龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zhiyou Wang'an Technology Co ltd
Original Assignee
Beijing Zhiyou Wang'an Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zhiyou Wang'an Technology Co ltd filed Critical Beijing Zhiyou Wang'an Technology Co ltd
Priority to CN201910214661.7A priority Critical patent/CN109960510B/en
Publication of CN109960510A publication Critical patent/CN109960510A/en
Application granted granted Critical
Publication of CN109960510B publication Critical patent/CN109960510B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/14Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention provides a method for reinforcing an Android application dynamic link library and related equipment, wherein a compiler is used for compiling to generate a dynamic link library file with bytecode information; extracting the bytecode information and the compiling information contained in the dynamic link library file; and performing obfuscation processing on the extracted bitcode information by using a compiler, combining the obfuscated bitcode information with the compiling information, and compiling to generate a new dynamic link library file. The invention adds the intermediate code information in the dynamic link library file, performs obfuscation processing on the intermediate code information to generate a new dynamic link library file, and improves the difficulty of cracking the dynamic link library by using the intermediate code and the code obfuscation processing, thereby improving the safety of the dynamic link library.

Description

Method for reinforcing Android application dynamic link library and related equipment
Technical Field
The invention relates to the technical field of information security, in particular to a method for reinforcing an Android application dynamic link library and related equipment.
Background
With the popularization of Android applications, and due to the openness of Android system source code, more and more companies and individuals successively develop their own Android applications and upload them to the application market. But at the same time, due to the openness of the Android, an application source code which is not protected can be easily acquired. Therefore, the developer firstly thinks that the core logic and the code in the application are put into the So library for protecting the source code and preventing the source code from being easily stolen. However, the code of the So library can be statically analyzed and dynamically debugged through tools such as IDA, and the logic and source codes in the code can be analyzed, So that the code of the So library can be decomposed, and therefore, a method for protecting the So library needs to be developed.
The traditional So library protection technology mainly comprises shell adding of the So library or code obfuscation through a compiler in the compiling process. The shell adding mode is limited, the technology is fixed, the shell adding mode is easy to crack, confusion is carried out in the compiling process through a compiler, a client source code is needed, or the compiler is given to a client, the client uses the shell adding mode, the use threshold is high, and the problem finding is inconvenient.
Therefore, the prior art is awaiting further improvement.
Disclosure of Invention
In view of the defects in the prior art, the invention aims to provide a method for reinforcing an Android application dynamic link library and related equipment for a user, and overcome the defects that the technology for shell protection is fixed and easy to crack, and the adoption of code confusion requires the cooperation of a client side, so that the operation is inconvenient.
The first embodiment of the invention provides a method for reinforcing an Android application dynamic link library, which comprises the following steps:
compiling by a compiler to generate a dynamic link library file with the bitcode information;
extracting the bytecode information and the compiling information contained in the dynamic link library file;
and performing obfuscation processing on the extracted bytecode information by using a compiler, and combining the obfuscated bytecode information with the compiling information to compile and generate a new dynamic link library file.
Optionally, the step of generating the dynamic link library file with the bytecode information by using the compiler includes:
and synchronously starting the embedded bitcode parameter option of the compiler while compiling the dynamic link library file by using the compiler.
Optionally, the step of combining the obfuscated bytecode information and the compilation information, and compiling to generate a new dynamic link library file includes:
compiling the obfuscated bitcode information and compiling parameters in the compiling information to obtain a plurality of target files after code obfuscation;
combining a plurality of target files with link parameters contained in the compiling information, and recompiling by using a compiler to generate a new dynamic link library file.
Optionally, the obfuscation processing method corresponding to the obfuscation processing includes:
false control flow, instruction equivalent replacement, control flow flattening, string encryption, control flow indirection, splitting basic blocks.
Optionally, the compiler is a clone compiler.
Optionally, after the step of generating the dynamic link library file with the bytecode information by using the compiler, the method further includes:
and signing and packaging the dynamic link library file, and uploading the packaged file to a cloud platform.
Optionally, the method further comprises the steps of:
and the cloud platform receives the packed file and decompresses the packed file to obtain the dynamic link library file.
Optionally, the method includes:
and the cloud platform extracts the bitcode information and the compiling information contained in the dynamic link library file by using a tool.
A third embodiment of the present invention is a computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method when executing the computer program.
A fourth embodiment of the invention is a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method.
The invention has the beneficial effects that the invention provides a method for reinforcing a dynamic link library and related equipment, wherein a compiler is used for compiling to generate a dynamic link library file with the bytecode information; extracting the bytecode information and the compiling information contained in the dynamic link library file; and generating a new dynamic link library according to the extracted bitcode information and the compiling information. According to the method, the intermediate code information is added into the dynamic link library file, then the intermediate code information is subjected to obfuscation processing to generate a new dynamic link library file, the difficulty of cracking the dynamic link library is improved by using the intermediate code and the code obfuscation processing, and therefore the safety of the dynamic link library is improved.
Drawings
FIG. 1 is a flowchart illustrating steps of the method for reinforcing the dynamic link library provided by the present invention;
fig. 2 is a flow chart of steps of an embodiment of the method provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The first embodiment of the present invention provides a method for reinforcing an Android application dynamic link library, as shown in fig. 1, the method includes:
and step S1, generating a dynamic link library file with the bytecode information by compiling with a compiler.
In order to increase the difficulty of cracking the dynamic link library and provide the safety of the dynamic link library file, the compiler is used for compiling the dynamic link library file, and the bitcode information is added in the compiled dynamic link library file through the bitcode embedded option while compiling is carried out. The specific implementation method comprises the following steps: and when the compiler is utilized to compile the dynamic link library file, synchronously starting an embedded bitcode parameter option of the compiler, and generating the dynamic link library file containing the bitcode information.
The compiler used in this step is a clone compiler, which is a front-end of the LLVM compiler toolset for compiling C, C + +, Objective-C. When an Android developer compiles a C/C + + code into a dynamic link library file by using a clone compiler (more than 4.0 version), a-femumbed-bitcode parameter of the Android developer is started, and the compiled dynamic link library file has bitcode information.
And step S2, extracting the bitcode information and the compiling information contained in the dynamic link library file.
And extracting the bitcode information and the compiling information contained in the dynamic link library file by using an extraction tool. The compiling information includes: a compilation parameter and a linking parameter. The compiling parameters comprise parameters used for compiling files, priority levels and the like; the link parameter is a header file path, a library file path, or the like.
Preferably, in this step, a tool is used to extract the bytecode information and the compilation information contained in the dynamic link library file. The tool is a command line tool for extracting embedded bytecode information.
And step S3, performing obfuscation processing on the extracted bytecode information by using a compiler, combining the obfuscated bytecode information with the compiling information, and compiling to generate a new dynamic link library file.
And combining the extracted bytecode information and the compiling information by using a compiler again, and compiling to obtain a dynamic link library file.
And compiling the bitcode information and the compiling information extracted in the step to obtain a new dynamic link library file, wherein the new dynamic link library file contains the bitcode information.
The step of combining the obfuscated bitcode information with the compilation information and compiling to generate a new dynamic link library file comprises the following steps:
compiling the obfuscated bitcode information and the compiling parameters in the compiling information to obtain a plurality of target files after code obfuscation;
combining a plurality of target files with link parameters contained in the compiling information, and recompiling by using a compiler to generate a new dynamic link library file.
It is conceivable that the obfuscation processing method includes:
false control flow, instruction equivalent substitution, control flow flattening, string encryption, control flow indirection, splitting basic blocks.
According to the method, a newest clone compiler is used for opening a fed-byte-bytecode compiling option, so that a dynamic link library file containing the bytecode can be generated, then the bytecode information and corresponding compiling parameters in the compiled dynamic link library file are extracted, the bytecode file is generated by code confusion of the bytecode, the extracted compiling parameters are matched, a clone compiler is used for recompiling to generate a final dynamic link library file, and the generated dynamic link library file is the dynamic link library file with the safety protection technology.
Specifically, the method disclosed by the present invention can also be implemented by a cloud platform, and when implemented by using the cloud platform, the method further includes the following steps:
and signing and packaging the dynamic link library file, and uploading the packaged file to a cloud platform.
And the cloud platform receives the packed file and decompresses the packed file to obtain the dynamic link library file.
And the cloud platform extracts the bitcode information and the compiling information contained in the dynamic link library file by using a tool.
The method of the present invention will be further explained below by taking a specific embodiment of the present invention as an example.
The steps of the embodiment of the method of the present invention, as shown in fig. 2, include the following:
and H1, starting a-femumbed-bytecode parameter option of the Clang compiler by the Android developer, compiling the C/C + + code into a dynamic link library file, and uploading the dynamic link library file to the cloud platform after signing and packaging the dynamic link library file. The dynamic link library file is provided with bitcode information;
step H2, the cloud platform decompresses the received packed file, and uses the tool to extract the bytecode file and the related compiling information contained in the dynamic link library file;
step H3, performing obfuscation processing on each bitcode file by using a code obfuscator on the cloud platform, wherein the obfuscation processing comprises one or more of false control flow, instruction equivalent replacement, control flow flattening, character string encryption, control flow indirection and split basic blocks;
step H4, compiling each obfuscated bitcode file and the compiling parameters obtained in the step H2 to obtain a plurality of target files after code obfuscation; and adding the link parameters obtained in the step H2 to the plurality of target files to generate a new dynamic link library file.
In specific application, when a developer compiles the dynamic link library file, the developer can add the bitcode information into the generated dynamic resource library file as long as the-femtod-bitcode option of the compiler is synchronously started. And the developer signs and packs the dynamic link library file containing the bytecode information and uploads the dynamic link library file to the cloud platform.
And after receiving the dynamic link library file, the cloud platform decompresses the dynamic link library file in sequence, extracts the bitcode information, performs corresponding confusion processing on the extracted information, and compiles the extracted information to generate a new dynamic link library file.
The method overcomes the defects that the compiler needs to be distributed to the developer before, the developer needs to record a large number of parameters, so that the use is inconvenient, and if the compilation is wrong, the problem that the compiler goes out or the developer does not operate is not easy to analyze in the problem troubleshooting process, so the problem is not easy to troubleshoot, but the method provided by the invention is used: and only when the developer compiles the data, the data is normally packaged and uploaded to a cloud platform, so that the dynamic link library can be reinforced, and the use is convenient.
The method generates a so file with the bitcode through the bitcode parameter opened during compiling, then performs bitcode extraction on the generated so base file containing the bitcode, performs code confusion on the extracted bitcode, and finally generates a reinforced dynamic link base file. By using the technology, a user develops and packs the dynamic link library files according to a normal development flow, and only the dynamic link library files needing to be obfuscated and reinforced are submitted to the reinforcing platform, so that the reinforcing platform can output obfuscated and reinforced dynamic link library files in real time.
The method provided by the invention has the characteristics that the method does not need to depend on the source code of a developer, can perform safety protection under the condition of a passive code, can finish the protection work by uploading by one key, simplifies the code confusion flow, and makes it possible to provide code confusion safety protection for all developers on a large scale.
A third embodiment of the present invention is a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method when executing the computer program.
A fourth embodiment of the invention is a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The invention provides a method for reinforcing a dynamic link library and related equipment, wherein a compiler is used for compiling to generate a dynamic link library file with bytecode information; extracting the bitcode information and the compiling information contained in the dynamic link library file; generating a new dynamic link library according to the extracted bitcode information and the compiling information; deleting the bytecode information contained in the new dynamic link library to obtain the final dynamic link library. According to the method, the intermediate code information is added into the dynamic link library file, then the intermediate code information is subjected to obfuscation processing to generate a new dynamic link library file, the difficulty of cracking the dynamic link library is improved by using the intermediate code and the code obfuscation processing, and therefore the safety of the dynamic link library is improved.
It should be understood that equivalents and modifications of the technical solution and inventive concept thereof may occur to those skilled in the art, and all such modifications and alterations should fall within the scope of the appended claims.

Claims (6)

1. A method for reinforcing an Android application dynamic link library is characterized by comprising the following steps:
compiling by a compiler to generate a dynamic link library file with the bitcode information;
extracting the bytecode information and the compiling information contained in the dynamic link library file;
performing obfuscation processing on the extracted bytecode information by using a compiler, combining the obfuscated bytecode information with compiling information, and compiling to generate a new dynamic link library file;
the step of generating the dynamic link library file with the bitcode information by compiling by the compiler comprises the following steps:
synchronously starting an embedded bitcode parameter option of the compiler while compiling the dynamic link library file by using the compiler; adding bitcode information in the dynamic link library while compiling and generating the dynamic link library;
signing and packaging the dynamic link library file containing the bitcode information, and uploading the dynamic link library file to a cloud platform; after receiving the dynamic link library file, the cloud platform decompresses the dynamic link library file in sequence, extracts the bytecode information, and compiles the extracted bytecode information to generate a new dynamic link library file after performing corresponding obfuscation processing on the extracted bytecode information;
the compiling information includes: compiling parameters and linking parameters; the compiling parameters comprise parameters used for compiling the file and priority levels; the link parameters are a header file path and a library file path;
the step of combining the obfuscated bitcode information with the compilation information and compiling to generate a new dynamic link library file comprises the following steps:
compiling the obfuscated bitcode information and the compiling parameters in the compiling information to obtain a plurality of target files after obfuscation;
combining a plurality of target files with link parameters contained in the compiling information, and recompiling by using a compiler to generate a new dynamic link library file.
2. The method for reinforcing the Android application dynamic link library according to claim 1, wherein the obfuscation processing method corresponding to the obfuscation processing comprises:
false control flow, instruction equivalent substitution, control flow flattening, string encryption, control flow indirection, splitting basic blocks.
3. The method for reinforcing the Android application dynamic link library according to claim 1, wherein the compiler is a clone compiler.
4. The method for reinforcing the Android application dynamic link library according to claim 1, wherein the method further comprises:
and the cloud platform extracts the bitcode information and the compiling information contained in the dynamic link library file by using a tool.
5. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201910214661.7A 2019-03-20 2019-03-20 Method for reinforcing Android application dynamic link library and related equipment Active CN109960510B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910214661.7A CN109960510B (en) 2019-03-20 2019-03-20 Method for reinforcing Android application dynamic link library and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910214661.7A CN109960510B (en) 2019-03-20 2019-03-20 Method for reinforcing Android application dynamic link library and related equipment

Publications (2)

Publication Number Publication Date
CN109960510A CN109960510A (en) 2019-07-02
CN109960510B true CN109960510B (en) 2022-09-06

Family

ID=67024541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910214661.7A Active CN109960510B (en) 2019-03-20 2019-03-20 Method for reinforcing Android application dynamic link library and related equipment

Country Status (1)

Country Link
CN (1) CN109960510B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110333872B (en) * 2019-07-09 2023-06-16 广州虎牙科技有限公司 Application processing method, device, equipment and medium
CN110717150A (en) * 2019-10-08 2020-01-21 北京顶象技术有限公司 Code protection method, device, protection equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902859A (en) * 2013-12-25 2014-07-02 武汉安天信息技术有限责任公司 Code protecting method and system based on hook technology in JAVA
CN106326694A (en) * 2016-08-30 2017-01-11 北京鼎源科技有限公司 Android application reinforcing method baed on C source code mixing
CN108932406A (en) * 2017-05-18 2018-12-04 北京梆梆安全科技有限公司 Virtualization software guard method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11366744B2 (en) * 2017-04-07 2022-06-21 Microsoft Technology Licensing, Llc Partitioning and orchestrating infrastructure software deployments for safety and agility across diverse configurations and hardware types

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902859A (en) * 2013-12-25 2014-07-02 武汉安天信息技术有限责任公司 Code protecting method and system based on hook technology in JAVA
CN106326694A (en) * 2016-08-30 2017-01-11 北京鼎源科技有限公司 Android application reinforcing method baed on C source code mixing
CN108932406A (en) * 2017-05-18 2018-12-04 北京梆梆安全科技有限公司 Virtualization software guard method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Xcode7 Bitcode的工作流程及安全性评估;360NirvanTeam;《https://www.freebuf.com/articles/others-articles/89806.html》;20151216;第1-11页 *

Also Published As

Publication number Publication date
CN109960510A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
CN107943469B (en) Intelligent contract issuing method and device
CN109598107B (en) Code conversion method and device based on application installation package file
CN111090433B (en) Data processing method, device and storage medium
CN108491235B (en) DEX protection method combining dynamic loading and function Native
KR101861341B1 (en) Deobfuscation apparatus of application code and method of deobfuscating application code using the same
US20160203087A1 (en) Method for providing security for common intermediate language-based program
CN105095771B (en) A kind of guard method of shared file destination and device
CN104680039B (en) A kind of data guard method and device of application program installation kit
CN109960510B (en) Method for reinforcing Android application dynamic link library and related equipment
CN104091100A (en) Software protection method based on intermediate result compiling
CN104298534B (en) Programmed method and device based on Lua language
CN113704706B (en) Code reinforcement method and device
CN110929234A (en) Python program encryption protection system and method based on code virtualization
CN114327491B (en) Source code instrumentation method, apparatus, computer device and storage medium
CN110647329A (en) Code obfuscation method, apparatus, computer device and storage medium
CN109614772B (en) Code conversion method and device based on application installation package file
US8533826B2 (en) Method for protecting the source code of a computer program
CN111680271A (en) Contract code obfuscation platform and method based on intelligent contract byte code characteristics
CN110083367A (en) Optimized treatment method, device and the computer equipment of application installation package
CN111666078A (en) Source code reinforcing method and device, computer equipment and storage medium
US20120117550A1 (en) Method, computer program and device for providing security for intermediate programming code for its execution by a virtual machine
KR101536920B1 (en) Method of Obfuscating Files Based on Advanced RISC Machine Processor
CN110555291B (en) Webpage script code protection method and device
CN104866504B (en) A kind of method and device that Function Extension is carried out to Android software
CN111190584A (en) EHIS-DB system version release method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant