作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2025, Vol. 51 ›› Issue (7): 275-283. doi: 10.19678/j.issn.1000-3428.0068314

• 体系结构与软件技术 • 上一篇    下一篇

基于LLVM的多样化编译方法

陈迎超, 王俊超*(), 庞建民, 岳峰   

  1. 信息工程大学网络空间安全学院,河南 郑州 450001
  • 收稿日期:2023-08-30 出版日期:2025-07-15 发布日期:2024-06-20
  • 通讯作者: 王俊超

Diversified Compilation Method Based on LLVM

CHEN Yingchao, WANG Junchao*(), PANG Jianmin, YUE Feng   

  1. School of Cyberspace Security, Information Engineering University, Zhengzhou 450001, Henan, China
  • Received:2023-08-30 Online:2025-07-15 Published:2024-06-20
  • Contact: WANG Junchao

摘要:

现有的软件多样化工具对多个C/C++源文件组成的项目多样化时,大多数都是对单个C/C++源文件中的所有函数采用相同的多样化方法,使得每个函数或每个源文件存在多样化方式单一、多样化方式缺乏针对性的问题。为此,基于LLVM中间表示,提出一种分组混淆和代码感知相结合的多样化编译方法。设计基于不同角度形成的混淆技术预选库,包含了多种混淆技术分组方案;编译时通过对遍历的每个函数进行代码分析和处理,感知到函数的混淆特征,针对性地选择相应的多样化分组策略,进而随机选择组内的多样化技术进行混淆,从而实现对每个函数所采用的多样化方案都大不相同,生成多样化的异构执行体集合,为拟态防御技术和移动目标防御技术提供了基础软件支撑。选择标准测试集和典型案例,从安全性和性能这2个方面验证所提方法的有效性。实验结果表明,该方法在保证安全性的同时,对性能也几乎没有影响,从而验证了所提的多样化编译方法在实际应用中的有效性和可行性。

关键词: 多样化编译, 代码混淆, 软件保护, 软件多样化, 主动防御

Abstract:

When diversifying projects composed of multiple C/C++ source files, most of the existing software diversification tools adopt the same diversification method for all functions in a single C/C++ source file, which leads to a single diversification method for each function or source file and a lack of targeted diversification methods. To address this issue, a diversified compilation method combining grouping obfuscation and code awareness based on a Low-Level Virtual Machine (LLVM) intermediate representation is proposed. First, this study designs a preselection library of confusion techniques based on different perspectives, which includes various grouping schemes for confusion techniques. During compilation, code analysis and processing are performed on each traversed function to determine its confusion characteristics. Targeted diversification grouping strategies are selected, and diversification techniques within the group are randomly selected to avoid confusion. This achieves a significantly different diversification scheme for each function, making the generated heterogeneous execution set more diverse and providing basic software support for mimetic and mobile target defense technologies. To verify the method′s effectiveness, a standard test set and typical cases are selected to verify both security and performance. The results indicate that the proposed method can ensure security while having almost no impact on the performance, thus verifying the proposed method′s effectiveness and feasibility in practical applications.

Key words: diversified compilation, code obfuscation, software protection, software diversification, active defense