WO2017156962A1 - Elf 共享库保护方法及其系统 - Google Patents

Elf 共享库保护方法及其系统 Download PDF

Info

Publication number
WO2017156962A1
WO2017156962A1 PCT/CN2016/093441 CN2016093441W WO2017156962A1 WO 2017156962 A1 WO2017156962 A1 WO 2017156962A1 CN 2016093441 W CN2016093441 W CN 2016093441W WO 2017156962 A1 WO2017156962 A1 WO 2017156962A1
Authority
WO
WIPO (PCT)
Prior art keywords
shared library
elf
target
library file
elf shared
Prior art date
Application number
PCT/CN2016/093441
Other languages
English (en)
French (fr)
Inventor
刘礼建
吴卫东
柯婷
Original Assignee
福建联迪商用设备有限公司
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 福建联迪商用设备有限公司 filed Critical 福建联迪商用设备有限公司
Publication of WO2017156962A1 publication Critical patent/WO2017156962A1/zh

Links

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
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Definitions

  • the present invention relates to the field of computer security, and in particular, to an ELF shared library protection method and system thereof.
  • a method for protecting the source code of the executable file including the following steps: obtaining an object executable link format ELF file that needs to be packed; extracting the target ELF file The core part; the core part includes data segment, code segment, stack segment and dynamic link table; create a new ELF file frame; integrate the core part and the shell part of the target file, and fill in the integration result according to the ELF structure Go to the new ELF file framework; complete refactoring the new ELF file and set its properties to executable.
  • This method mainly improves the anti-dynamic tracking ability by packing the core code, but the method has only one protection and low security.
  • the technical problem to be solved by the present invention is to provide an ELF shared library protection method and a system thereof, which effectively prevent the dynamic shared library from being decompiled and reversely analyzed, and improve the protection of the software.
  • An ELF shared library protection method including:
  • the present invention also relates to an ELF shared library protection system, including:
  • a building module configured to construct a packed ELF shared library file according to a target function list of the target ELF shared library file
  • a first reading module configured to read the target ELF shared library file to the memory
  • an encryption module configured to perform encryption processing on the legal target ELF shared library file to obtain ciphertext ELF data
  • a filling module configured to fill the ciphertext ELF data into a data segment of the packed ELF shared library file.
  • the beneficial effects of the present invention are: encrypting the target ELF shared library file and populating the ciphertext ELF data into the shelled ELF shared library file, realizing double protection; externally released shelled ELF shared library file
  • the ciphertext ELF data containing only the target ELF shared library file, the user-oriented objects are all shelled ELF shared libraries, and the target ELF shared library is invisible and hidden, and the target ELF shared library cannot be seen after decompilation.
  • the actual code flow of the file can prevent the dynamic shared library from being decompiled and reversely analyzed to obtain the designer's programming ideas or code execution details, improve the protection of the software, avoid the economic loss of the software, and protect the interests of consumers.
  • FIG. 1 is a flowchart of a method for protecting an ELF shared library according to the present invention
  • FIG. 3 is a schematic structural diagram of an ELF shared library protection system according to the present invention.
  • FIG. 4 is a schematic structural diagram of a system according to Embodiment 2 of the present invention. [0021] Description of the label:
  • the most important idea of the present invention is: encrypting and processing the target ELF shared library file, performing a heavy protection, and then releasing the file by using the shelled ELF shared library file to realize the double protection of the shared library file.
  • an ELF shared library protection method including:
  • the beneficial effects of the present invention are: the code can be effectively hidden, and the target ELF shared library is invisible and hidden, which can prevent the dynamic shared library from being decompiled and reversely analyzed to obtain the designer's programming idea or Code execution details, improve the protection of software, avoid software loss and economic losses, and protect the interests of consumers.
  • the method further includes:
  • the packed ELF shared library file includes a proxy function that associates an object function in the target ELF shared library file.
  • target function of acquiring the target ELF shared library file according to the format of the target ELF shared library file is specifically:
  • the proxy function of the packed ELF shared library file invokes the target function according to the running address.
  • the proxy function in the shell ELF shared library file can call the target function according to the running address, which can effectively prevent the target ELF shared library from being decompiled and reversely analyze the code logic of the programmer to improve the security of the software;
  • the process is performed in memory, and the memory is released after the target function is called, so that the target ELF shared library file does not leave any trace in the actual memory, further improving the security of the software.
  • the method further includes:
  • the method further includes:
  • the present invention further provides an ELF shared library protection system, including:
  • a building module configured to construct a packed ELF shared library file according to a target function list of the target ELF shared library file
  • a first reading module configured to read the target ELF shared library file to the memory
  • an encryption module configured to encrypt a legal target ELF shared library file to obtain ciphertext ELF data
  • a filling module configured to fill the ciphertext ELF data into a data segment of the packed ELF shared library file.
  • the method further includes:
  • the second reading module is configured to read the ciphertext ELF data in the packed ELF shared library file to the memory;
  • a decryption module configured to perform decryption processing on the ciphertext ELF data, to obtain the target ELF shared library file;
  • an obtaining module configured to acquire an objective function of the target ELF shared library file according to a format of the target ELF shared library file.
  • the packed ELF shared library file includes a proxy function that associates an object function in the target ELF shared library file.
  • the acquiring module includes:
  • an obtaining unit configured to acquire, according to the segment header table and the function mapping table of the target ELF shared library file, a running address of the target function of the target ELF shared library file;
  • a calling unit the proxy function for the packed ELF shared library file, according to the running address, calling the target function.
  • a first embodiment of the present invention is an ELF shared library protection method, including the following steps: [0061] S1: constructing a packed ELF shared library file according to a target function list of a target ELF shared library file,
  • the packed ELF shared library file includes a proxy function associated with the target function in the target ELF shared library file; specifically, a list of functions that can be called according to the target ELF shared library file, that is, a list of target functions, in the packed ELF
  • the proxy function is implemented in the shared library file, and the caller, that is, the third-party caller, calls the proxy function to complete the call of the target function.
  • the proxy function proxy_funcl() is implemented in the packed ELF shared library file, and the target function target_funcl() is completed inside the proxy function proxy_funcl().
  • the packed ELF shared library file further includes an initialization function, and the following encryption operation, decryption operation, and operation of locating the target function running address may be completed in the initialization function.
  • S2 reading the target ELF shared library file to the memory; copying a certain size of the data space in the data segment of the packed ELF shared library file, and reading all the data of the target ELF shared library file into the Linyi data space.
  • S3 determining whether the target ELF shared library file is legal, if yes, executing step S4, if not, ending the process; preferably, determining the legality according to the format of the target ELF shared library file, because the target E LF
  • the header of the shared library file indicates the type of the target ELF shared library file, and the machine on which the file runs is flat. The station, architecture, size, etc. can be judged whether it is legal by parsing its header.
  • S4 performing encryption processing on the legal target ELF shared library file to obtain ciphertext ELF data; the encryption algorithm may select a symmetric encryption algorithm or an asymmetric encryption algorithm according to actual requirements; the symmetric encryption algorithm uses a single key password.
  • the system's encryption method uses the same key for encryption and decryption. The encryption and decryption speed is fast. Commonly used are DES, 3DES, etc. Compared with asymmetric encryption algorithms, symmetric encryption algorithms are easier to crack.
  • Asymmetric encryption and decryption algorithms require 2
  • the encryption operation is performed in an initialization function.
  • S5 filling the ciphertext ELF data into the data segment of the packed ELF shared library file; and forming a data space of a certain size in the data segment of the packed E LF shared library file, the ciphertext The ELF data is populated into the data space.
  • the copy data space in the step S2 is released, that is, the target ELF shared library file is deleted in the data segment of the packed ELF shared library file. Only ciphertext ELF data is left.
  • S6 the caller obtains the packed ELF shared library file; the caller invokes the packed ELF shared library file to implement a call to the target ELF shared library file, where the packed ELF shared library file includes an initialization function and a proxy function. And ciphertext ELF data.
  • the following steps illustrate the caller's call to the target function in the target ELF shared library file by calling the packed ELF shared library file.
  • S8 decrypting the ciphertext ELF data, and obtaining the target ELF shared library file in the memory; and performing the decryption operation of the step corresponding to the encryption operation in step S4.
  • the decryption operation is performed in the initialization function.
  • step S9 determining whether the target ELF shared library file is legal, if yes, executing step S10, and if not, ending the process. The judgment of this step is based on the step S3.
  • S10 acquiring, according to a format of the target ELF shared library file, a running address of an target function of the target ELF shared library file; a running address of the target function may be according to a segment header table and a function mapping of the target ELF shared library file. Table gets. Preferably, this step is also done in the initialization function.
  • S11 The proxy function of the packed ELF shared library file invokes the target function according to the running address.
  • S12 After the call is completed, release all the memory space requested by the above step.
  • the object that the user is facing is a shelled ELF shared library
  • the target ELF shared library is invisible and hidden, and the whole process is Running in memory
  • the memory space is released after the program finishes running, so that the target shared library does not leave any traces in the actual memory.
  • this embodiment is an ELF shared library protection system corresponding to the foregoing method, including: [0076] a building module 1 configured to build a shelled ELF share according to a target function list of a target ELF shared library file Library file;
  • the first reading module 2 is configured to read the target ELF shared library file to the memory
  • the first determining module 3 is configured to determine whether the target ELF shared library file is legal, and obtain a first determination result
  • the encryption module 4 is configured to: if the first determination result is yes, perform encryption processing on the target ELF shared library file to obtain ciphertext ELF data;
  • a filling module 5 configured to fill the ciphertext ELF data into a data segment of the packed ELF shared library file
  • the second reading module 6 is configured to read the ciphertext ELF data in the packed ELF shared library file to the memory;
  • the decrypting module 7 is configured to decrypt the ciphertext ELF data Obtaining the target ELF shared library file;
  • the second determining module 8 is configured to determine whether the target ELF shared library file is legal, and obtain a second determination result
  • the obtaining module 9 is configured to: if the second determination result is yes, acquire an objective function of the target ELF shared library file according to the format of the target ELF shared library file.
  • the obtaining module 9 includes:
  • the obtaining unit 91 is configured to obtain, according to the segment header table and the function mapping table of the target ELF shared library file, a running address of the target function of the target ELF shared library file;
  • a calling unit 92 the proxy function for the packed ELF shared library file is adjusted according to the running address Use the objective function.
  • the ELF shared library protection method and system thereof provide an encryption operation on a target ELF shared library file, and fill the ciphertext ELF data into a shelled ELF shared library file to implement The double-protection; the externally-packed ELF shared library file contains only the ciphertext ELF data of the target ELF shared library file, and the object oriented by the user is the packed ELF shared library, and the target ELF shared library is encrypted and hidden.
  • the actual code flow of the target ELF shared library file cannot be seen, which can prevent the dynamic shared library from being decompiled and reversely analyzed to obtain the designer's programming idea or code execution details, improve the protection of the software, and avoid the software.
  • the economic loss of the enterprise is realized, and the interests of the consumer are protected; meanwhile, the whole process is carried out in the memory, and the memory is released after the target function is called, so that the target ELF shared library file does not leave any trace in the actual memory. Further improve the security of the software; the target ELF shared library file is both before and after decryption. The judgment of legality guarantees the security of the system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Technology Law (AREA)
  • Multimedia (AREA)
  • Storage Device Security (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)

Abstract

一种ELF共享库保护方法及其系统,方法包括:依据目标ELF共享库文件的目标函数列表构建加壳ELF共享库文件;读取目标ELF共享库文件至内存;对合法的目标ELF共享库文件进行加密处理,得到密文ELF数据;将所述密文ELF数据填充至所述加壳ELF共享库文件的数据段内。本方法可防止动态共享库被反编译逆向分析后得到设计者的程序设计思路或代码执行细节,提高对软件的保护,避免软件开发企业的经济损失,保护消费者的利益。

Description

ELF共享库保护方法及其系统
技术领域
[0001] 本发明涉及计算机安全领域, 尤其涉及一种 ELF共享库保护方法及其系统。
背景技术
[0002] 软件的防盗版、 防修改一直是计算机安全领域的一个重要课题。 非法破译者可 以通过反编译和逆向工程来分析软件, 进而发现软件的设计思路和技术细节, 这直接给软件幵发企业带来了直接的经济损失, 也间接损害了消费者的利益。 因此设计一套专有、 独特的软件保护方法尤为重要。
[0003] 目前对 Linux中 ELF保护的方法通常是通过嵌入式的方法来进行保护。 先在可执 行文件或动态共享库里注入一段跳转代码, 系统运行该可执行文件或动态库吋 先执行此部分跳转代码, 然后再根据跳转代码指定的地址跳转到真正的有效代 码段部分执行。 此方法虽然可以隐藏有效代码段, 但并不能很好的防止动态逆 向分析。
[0004] 在公幵号为 102136053A的专利授权文件中, 提出了一种对可执行文件源代码保 护的方法,包括以下步骤: 获取需要加壳的目标可执行链接格式 ELF文件; 提取 目标 ELF文件中的核心部分; 所述核心部分包括数据段、 代码段、 堆栈段及动态 链接表; 创建新的 ELF文件框架;将目标文件的核心部分和加壳部分整合,将整合 结果按 ELF结构填入到新的 ELF文件框架中; 完成重构新的 ELF文件并设置其属 性为可执行。 该方法主要通过对核心代码进行加壳来提高反动态跟踪能力, 但 该方法只有一重保护, 安全性较低。
技术问题
[0005] 本发明所要解决的技术问题是: 提供一种 ELF共享库保护方法及其系统, 有效 防止动态共享库被反编译逆向分析, 提高对软件的保护。
问题的解决方案
技术解决方案
[0006] 为了解决上述技术问题, 本发明采用的技术方案为: 一种 ELF共享库保护方法 , 包括:
[0007] 依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库文件;
[0008] 读取目标 ELF共享库文件至内存;
[0009] 对合法的目标 ELF共享库文件进行加密处理, 得到密文 ELF数据;
[0010] 将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段内。
[0011] 本发明还涉及一种 ELF共享库保护系统, 包括:
[0012] 构建模块, 用于依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库 文件;
[0013] 第一读取模块, 用于读取目标 ELF共享库文件至内存;
[0014] 加密模块, 用于对合法的目标 ELF共享库文件进行加密处理, 得到密文 ELF数 据;
[0015] 填充模块, 用于将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段 内。
发明的有益效果
有益效果
[0016] 本发明的有益效果在于: 对目标 ELF共享库文件进行了加密操作并将密文 ELF 数据填充至加壳 ELF共享库文件中, 实现了双重保护; 对外发布的加壳 ELF共享 库文件中只包含目标 ELF共享库文件的密文 ELF数据, 用户面向的对象都是加壳 ELF共享库, 其目标 ELF共享库是加密隐藏不可见的, 反编译逆向后也无法看到 目标 ELF共享库文件的实际代码流程, 可防止动态共享库被反编译逆向分析后得 到设计者的程序设计思路或代码执行细节, 提高对软件的保护, 避免软件幵发 企业的经济损失, 保护消费者的利益。
对附图的简要说明
附图说明
[0017] 图 1为本发明一种 ELF共享库保护方法的流程图;
[0018] 图 2为本发明实施例一的方法流程图;
[0019] 图 3为本发明一种 ELF共享库保护系统的结构示意图;
[0020] 图 4为本发明实施例二的系统结构示意图。 [0021] 标号说明:
[0022] 1、 构建模块; 2、 第一读取模块; 3、 第一判断模块; 4、 加密模块; 5、 填充 模块; 6、 第二读取模块; 7、 解密模块; 8、 第二判断模块; 9、 获取模块; [0023] 91、 获取单元; 92、 调用单元。
具体实施方式
[0024] 本发明最关键的构思在于: 对目标 ELF共享库文件进行加密处理, 进行一重保 护, 再以加壳 ELF共享库文件的方式对外发布, 实现对共享库文件的二重保护。
[0025] 请参阅图 1, 一种 ELF共享库保护方法, 包括:
[0026] 依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库文件;
[0027] 读取目标 ELF共享库文件至内存;
[0028] 对合法的目标 ELF共享库文件进行加密处理, 得到密文 ELF数据;
[0029] 将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段内。
[0030] 从上述描述可知, 本发明的有益效果在于: 可有效隐藏代码, 目标 ELF共享库 是加密隐藏不可见的, 可防止动态共享库被反编译逆向分析后得到设计者的程 序设计思路或代码执行细节, 提高对软件的保护, 避免软件幵发企业的经济损 失, 保护消费者的利益。
[0031] 进一步地, 所述"将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段 内"之后, 进一步包括:
[0032] 读取所述加壳 ELF共享库文件内的密文 ELF数据至内存;
[0033] 对所述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库文件;
[0034] 根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享库文件的目标函 数。
[0035] 进一步地, 所述加壳 ELF共享库文件包括关联目标 ELF共享库文件中的目标函 数的代理函数。
[0036] 进一步地, 所述"根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享 库文件的目标函数"具体为:
[0037] 根据所述目标 ELF共享库文件的段头表和函数映射表, 获取所述目标 ELF共享 库文件的目标函数的运行地址;
[0038] 所述加壳 ELF共享库文件的代理函数根据所述运行地址, 调用所述目标函数。
[0039] 由上述描述可知, 当调用方需调用目标函数吋, 需要先将加壳 ELF共享库文件 中的密文 ELF数据解密为目标 ELF共享库文件, 获取目标函数的运行地址, 然后 由加壳 ELF共享库文件中的代理函数根据运行地址, 才能调用目标函数, 可有效 地防止了目标 ELF共享库被反编译逆向分析出程序设计者的代码逻辑, 提高软件 的安全性; 同吋, 整个过程都在内存中进行, 目标函数调用完毕后即释放内存 , 使得目标 ELF共享库文件不会在实际存储器中留有任何痕迹, 进一步提高了软 件的安全性。
[0040] 进一步地, 所述"读取目标 ELF共享库文件至内存"之后, 进一步包括:
[0041] 判断所述目标 ELF共享库文件是否合法。
[0042] 由上述描述可知, 通过对合法性进行判断, 保证目标 ELF共享库文件是安全的
, 防止感染病毒, 提高了系统的安全性。
[0043] 进一步地, 所述"对所述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库 文件"之后, 进一步包括:
[0044] 判断所述目标 ELF共享库文件是否合法。
[0045] 由上述描述可知, 在解密完再进行一次合法性的判断, 可防止在获取加壳 ELF 共享库文件前密文 ELF共享库数据被修改, 进一步提高了系统的安全性。
[0046] 请参照图 3, 本发明还提出一种 ELF共享库保护系统, 包括:
[0047] 构建模块, 用于依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库 文件;
[0048] 第一读取模块, 用于读取目标 ELF共享库文件至内存;
[0049] 加密模块, 用于对合法的目标 ELF共享库文件进行加密处理, 得到密文 ELF数 据;
[0050] 填充模块, 用于将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段 内。
[0051] 进一步地, 还包括:
[0052] 第二读取模块, 用于读取所述加壳 ELF共享库文件内的密文 ELF数据至内存; [0053] 解密模块, 用于对所述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库 文件;
[0054] 获取模块, 用于根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享 库文件的目标函数。
[0055] 进一步地, 所述加壳 ELF共享库文件包括关联目标 ELF共享库文件中的目标函 数的代理函数。
[0056] 进一步地, 所述获取模块包括:
[0057] 获取单元, 用于根据所述目标 ELF共享库文件的段头表和函数映射表, 获取所 述目标 ELF共享库文件的目标函数的运行地址;
[0058] 调用单元, 用于所述加壳 ELF共享库文件的代理函数根据所述运行地址, 调用 所述目标函数。
[0059] 实施例一
[0060] 请参照图 2, 本发明的实施例一为一种 ELF共享库保护方法, 包括如下步骤: [0061] S1 : 依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库文件, 所述 加壳 ELF共享库文件包括关联目标 ELF共享库文件中的目标函数的代理函数; 具 体是根据目标 ELF共享库文件抛出的可供调用的函数列表, 即目标函数列表, 在 加壳 ELF共享库文件中实现代理函数, 调用方, 即第三方调用者通过调用代理函 数来完成目标函数的调用。 例如, 在目标 ELF共享库文件内有目标函数 target_fun cl(), 则在加壳 ELF共享库文件内实现代理函数 proxy_funcl(), 在代理函数 proxy _funcl()内部完成对目标函数 target_funcl()的调用。 优选地, 所述加壳 ELF共享库 文件还包括初始化函数, 可在初始化函数中完成下述的加密运算、 解密运算和 定位目标函数运行地址的操作。
[0062] S2: 读取目标 ELF共享库文件至内存; 在加壳 ELF共享库文件的数据段内幵辟 一定大小的临吋数据空间, 将目标 ELF共享库文件的全部数据读取到所述临吋数 据空间中。
[0063] S3: 判断所述目标 ELF共享库文件是否合法, 若是, 则执行步骤 S4, 若否, 则 结束流程; 优选地, 可根据目标 ELF共享库文件的格式判断合法性, 因为目标 E LF共享库文件的文件头指明了该目标 ELF共享库文件的类型、 文件运行的机器平 台、 体系结构、 大小等, 可通过解析其文件头来判断是否合法。
[0064] S4: 对合法的所述目标 ELF共享库文件进行加密处理, 得到密文 ELF数据; 加 密算法可根据实际需求, 选择对称加密算法或非对称加密算法; 对称加密算法 是使用单钥密码系统的加密方法, 加密和解密使用同一个秘钥, 加解密速度快 , 常用的有 DES、 3DES等, 和非对称加密算法相比对称加密算法更容易被破解 ; 非对称加解密算法需要 2个秘钥, 使用公钥加密, 私钥解密, 公私钥分幵保存 , 与对称加密算法相比非对称加密算法的安全性更好, 但加解密速度更慢, 常 用的有 RSA、 Elgamal等。 优选地, 在初始化函数中进行加密运算。
[0065] S5: 将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段内; 在加壳 E LF共享库文件的数据段内幵辟一定大小的数据空间, 将密文 ELF数据填充到该数 据空间里。 可选地, 得到密文 ELF数据后或密文 ELF数据填充完后, 即可释放步 骤 S2中的临吋数据空间, 即在加壳 ELF共享库文件的数据段中刪除目标 ELF共享 库文件, 只留有密文 ELF数据。
[0066] S6: 调用方获取所述加壳 ELF共享库文件; 调用方调用加壳 ELF共享库文件实 现对目标 ELF共享库文件的调用, 所述加壳 ELF共享库文件包括初始化函数、 代 理函数和密文 ELF数据。 下述步骤阐述调用方通过调用加壳 ELF共享库文件实现 对目标 ELF共享库文件中的目标函数的调用。
[0067] S7: 读取所述加壳 ELF共享库文件内的密文 ELF数据至内存。
[0068] S8: 对所述密文 ELF数据进行解密处理, 在内存中得到所述目标 ELF共享库文 件; 进行该步骤的解密运算与步骤 S4中的加密运算相对应。 优选地, 在初始化 函数中进行解密运算。
[0069] S9: 判断所述目标 ELF共享库文件是否合法, 若是, 则执行步骤 S10, 若否, 则结束流程。 该步骤的判断依据与步骤 S3—致。
[0070] S10: 根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享库文件的目 标函数的运行地址; 目标函数的运行地址可根据目标 ELF共享库文件的段头表和 函数映射表获取。 优选地, 该步骤也在初始化函数中完成。
[0071] S11 : 所述加壳 ELF共享库文件的代理函数根据所述运行地址, 调用所述目标 函数。 [0072] S12: 调用完毕后, 释放上述步骤申请的所有内存空间。
[0073] 在本实施例中, 无论是共享库的发布、 存储或加载运行过程, 用户面向的对象 都是加壳 ELF共享库, 其目标 ELF共享库是加密隐藏不可见的, 且整个过程是在 内存中运行, 程序运行完毕后内存空间即释放, 使得目标共享库不会在实际存 储器中留有任何的痕迹, 该方法有效地防止了目标 ELF共享库被反编译逆向分析 出程序设计者的代码逻辑。
[0074] 实施例二
[0075] 请参照图 4, 本实施例为对应上述方法的一种 ELF共享库保护系统, 包括: [0076] 构建模块 1, 用于依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库 文件;
[0077] 第一读取模块 2, 用于读取目标 ELF共享库文件至内存;
[0078] 第一判断模块 3, 用于判断所述目标 ELF共享库文件是否合法, 得到第一判断 结果;
[0079] 加密模块 4, 用于若第一判断结果为是, 则对所述目标 ELF共享库文件进行加 密处理, 得到密文 ELF数据;
[0080] 填充模块 5, 用于将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段 内;
[0081] 第二读取模块 6, 用于读取所述加壳 ELF共享库文件内的密文 ELF数据至内存; [0082] 解密模块 7, 用于对所述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库 文件;
[0083] 第二判断模块 8, 用于判断所述目标 ELF共享库文件是否合法, 得到第二判断 结果;
[0084] 获取模块 9, 用于若所述第二判断结果为是, 则根据所述目标 ELF共享库文件 的格式, 获取所述目标 ELF共享库文件的目标函数。
[0085] 所述获取模块 9包括:
[0086] 获取单元 91, 用于根据所述目标 ELF共享库文件的段头表和函数映射表, 获取 所述目标 ELF共享库文件的目标函数的运行地址;
[0087] 调用单元 92, 用于所述加壳 ELF共享库文件的代理函数根据所述运行地址, 调 用所述目标函数。
[0088] 综上所述, 本发明提供的一种 ELF共享库保护方法及其系统, 对目标 ELF共享 库文件进行了加密操作并将密文 ELF数据填充至加壳 ELF共享库文件中, 实现了 双重保护; 对外发布的加壳 ELF共享库文件中只包含目标 ELF共享库文件的密文 ELF数据, 用户面向的对象都是加壳 ELF共享库, 其目标 ELF共享库是加密隐藏 不可见的, 反编译逆向后也无法看到目标 ELF共享库文件的实际代码流程, 可防 止动态共享库被反编译逆向分析后得到设计者的程序设计思路或代码执行细节 , 提高对软件的保护, 避免软件幵发企业的经济损失, 保护消费者的利益; 同 吋, 整个过程都在内存中进行, 目标函数调用完毕后即释放内存, 使得目标 ELF 共享库文件不会在实际存储器中留有任何痕迹, 进一步提高了软件的安全性; 在加密前和解密后均对目标 ELF共享库文件进行合法性的判断, 保证了系统的安 全性。
[0089]

Claims

权利要求书
[权利要求 1] 一种 ELF共享库保护方法, 其特征在于, 包括:
依据目标 ELF共享库文件的目标函数列表构建加壳 ELF共享库文件; 读取目标 ELF共享库文件至内存;
对合法的目标 ELF共享库文件进行加密处理, 得到密文 ELF数据; 将所述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段内。
[权利要求 2] 根据权利要求 1所述的 ELF共享库保护方法, 其特征在于, 所述"将所 述密文 ELF数据填充至所述加壳 ELF共享库文件的数据段内"之后, 进 一步包括:
读取所述加壳 ELF共享库文件内的密文 ELF数据至内存;
对所述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库文件; 根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享库文件 的目标函数。
[权利要求 3] 根据权利要求 2所述的 ELF共享库保护方法, 其特征在于, 所述加壳 E
LF共享库文件包括关联目标 ELF共享库文件中的目标函数的代理函数 根据权利要求 3所述的 ELF共享库保护方法, 其特征在于, 所述"根据 所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享库文件的目 标函数 "具体为:
根据所述目标 ELF共享库文件的段头表和函数映射表, 获取所述目标 ELF共享库文件的目标函数的运行地址;
所述加壳 ELF共享库文件的代理函数根据所述运行地址, 调用所述目 标函数。
根据权利要求 1所述的 ELF共享库保护方法, 其特征在于, 所述"读取 目标 ELF共享库文件至内存"之后, 进一步包括: 判断所述目标 ELF共享库文件是否合法。
根据权利要求 2所述的 ELF共享库保护方法, 其特征在于, 所述"对所 述密文 ELF数据进行解密处理, 得到所述目标 ELF共享库文件"之后, 进一步包括:
判断所述目标 ELF共享库文件是否合法。
[权利要求 7] —种 ELF共享库保护系统, 其特征在于, 包括:
构建模块, 用于依据目标 ELF共享库文件的目标函数列表构建加壳 EL F共享库文件;
第一读取模块, 用于读取目标 ELF共享库文件至内存;
加密模块, 用于对合法的目标 ELF共享库文件进行加密处理, 得到密 文 ELF数据;
填充模块, 用于将所述密文 ELF数据填充至所述加壳 ELF共享库文件 的数据段内。
[权利要求 8] 根据权利要求 7所述的 ELF共享库保护系统, 其特征在于, 还包括: 第二读取模块, 用于读取所述加壳 ELF共享库文件内的密文 ELF数据 至内存;
解密模块, 用于对所述密文 ELF数据进行解密处理, 得到所述目标 EL F共享库文件;
获取模块, 用于根据所述目标 ELF共享库文件的格式, 获取所述目标 ELF共享库文件的目标函数。
[权利要求 9] 根据权利要求 8所述的 ELF共享库保护系统, 其特征在于, 所述加壳 E
LF共享库文件包括关联目标 ELF共享库文件中的目标函数的代理函数
[权利要求 10] 根据权利要求 9所述的 ELF共享库保护系统, 其特征在于, 所述获取 模块包括:
获取单元, 用于根据所述目标 ELF共享库文件的段头表和函数映射表 , 获取所述目标 ELF共享库文件的目标函数的运行地址;
调用单元, 用于所述加壳 ELF共享库文件的代理函数根据所述运行地 址, 调用所述目标函数。
PCT/CN2016/093441 2016-03-16 2016-08-05 Elf 共享库保护方法及其系统 WO2017156962A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610150057.9A CN105825087B (zh) 2016-03-16 2016-03-16 Elf共享库保护方法及其系统
CN201610150057.9 2016-03-16

Publications (1)

Publication Number Publication Date
WO2017156962A1 true WO2017156962A1 (zh) 2017-09-21

Family

ID=56523453

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/093441 WO2017156962A1 (zh) 2016-03-16 2016-08-05 Elf 共享库保护方法及其系统

Country Status (2)

Country Link
CN (1) CN105825087B (zh)
WO (1) WO2017156962A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105825087B (zh) * 2016-03-16 2019-07-26 福建联迪商用设备有限公司 Elf共享库保护方法及其系统
CN106681828A (zh) * 2016-12-09 2017-05-17 北京奇虎科技有限公司 一种加固安卓安装包的动态链接库so文件的方法和装置
CN107085514B (zh) * 2017-03-06 2021-02-19 北京安博通科技股份有限公司 共享库升级方法及装置
KR102039380B1 (ko) * 2017-11-24 2019-11-01 (주)잉카엔트웍스 공유 오브젝트의 코드 보호를 위한 보안 제공 장치와 방법, 및 보안 실행 장치와 방법
CN110113151B (zh) * 2019-04-09 2022-09-02 天津大学 一种对elf格式程序的非侵入式实时加解密方法
CN111966972B (zh) * 2020-08-21 2023-07-04 北京元心科技有限公司 程序加密方法、装置、电子设备及计算机可读存储介质
CN113094666B (zh) * 2021-04-09 2022-06-24 每日互动股份有限公司 一种防止java程序被反编译的系统
CN113343285B (zh) * 2021-08-04 2021-10-29 华控清交信息科技(北京)有限公司 一种执行密文计算指令的方法、装置和密文计算系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102136053A (zh) * 2011-03-14 2011-07-27 中兴通讯股份有限公司 对可执行文件源代码保护的方法及装置
CN102609666A (zh) * 2012-01-20 2012-07-25 飞天诚信科技股份有限公司 一种可执行程序加壳保护方法
CN104102860A (zh) * 2014-08-11 2014-10-15 北京奇虎科技有限公司 安卓平台应用程序的保护方法、运行方法、装置及系统
CN105825087A (zh) * 2016-03-16 2016-08-03 福建联迪商用设备有限公司 Elf共享库保护方法及其系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8225290B2 (en) * 2003-02-11 2012-07-17 V. i. Laboratories, Inc. Systems and methods for regulating execution of computer software
CN102118512A (zh) * 2011-03-28 2011-07-06 阮晓迅 一种手机应用程序防破解方法及系统
CN104992112B (zh) * 2015-05-19 2017-10-13 上海理工大学 检测安卓系统敏感信息泄露的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102136053A (zh) * 2011-03-14 2011-07-27 中兴通讯股份有限公司 对可执行文件源代码保护的方法及装置
CN102609666A (zh) * 2012-01-20 2012-07-25 飞天诚信科技股份有限公司 一种可执行程序加壳保护方法
CN104102860A (zh) * 2014-08-11 2014-10-15 北京奇虎科技有限公司 安卓平台应用程序的保护方法、运行方法、装置及系统
CN105825087A (zh) * 2016-03-16 2016-08-03 福建联迪商用设备有限公司 Elf共享库保护方法及其系统

Also Published As

Publication number Publication date
CN105825087A (zh) 2016-08-03
CN105825087B (zh) 2019-07-26

Similar Documents

Publication Publication Date Title
WO2017156962A1 (zh) Elf 共享库保护方法及其系统
CN103069428B (zh) 不可信云基础设施中的安全虚拟机引导
JP5670578B2 (ja) 機密コードおよびデータを保護するためのアーキテクチャを含む方法および装置
CN106063185B (zh) 用于安全地共享数据的方法和装置
US20190005229A1 (en) Mobile device having trusted execution environment
US8281115B2 (en) Security method using self-generated encryption key, and security apparatus using the same
WO2016058487A1 (zh) 一种信息处理方法及装置
CN104298932B (zh) 一种so文件的调用方法及装置
US9054865B2 (en) Cryptographic system and methodology for securing software cryptography
KR102433011B1 (ko) Apk 파일 보호 방법, 이를 수행하는 apk 파일 보호 시스템, 및 이를 저장하는 기록매체
CN108429719B (zh) 密钥保护方法及装置
CN109756492B (zh) 基于sgx的云平台可信执行方法、装置、设备及介质
CN102087605A (zh) 一种基于android平台应用安装控制方法及系统
EP4195583A1 (en) Data encryption method and apparatus, data decryption method and apparatus, terminal, and storage medium
JP2019517080A (ja) ハードウェアーベースのセキュアーな分離された領域を使用して電子デバイス上での著作権侵害および不正行為を防止すること
US20100241855A1 (en) Systems and Methods for Secure Execution of Code Using a Hardware Protection Module
US20200356642A1 (en) Enabling an encrypted software module in a container file
CN109558739B (zh) 程序运行方法、装置、终端及可读介质
CN101957903A (zh) 一种保护类文件的方法和装置
CN103701829A (zh) 一种离线解析dpapi加密数据的方法
US9524394B2 (en) Method and apparatus for providing provably secure user input/output
WO2016169395A1 (zh) Android平台下的PIN码保护方法
CN103971034A (zh) 一种保护Java软件的方法及装置
WO2016206393A1 (zh) 管理应用的方法和装置、实现读写操作的方法和装置
CN111181898A (zh) 基于后台服务器、app客户端的数据安全防护方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16894123

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16894123

Country of ref document: EP

Kind code of ref document: A1