Skip to main content
QUICK REVIEW

[论文解读] How a simple bug in ML compiler could be exploited for backdoors?

Baptiste David|arXiv (Cornell University)|Nov 27, 2018
Security and Verification in Computing参考文献 1被引用 4
一句话总结

本文揭示了微软 MASM 编译器中一个零日漏洞,该漏洞会无声地错误编译涉及 NOT 操作符的条件逻辑,使攻击者能够在不修改源代码的情况下,在编译后的二进制文件中插入隐蔽后门。该缺陷允许恶意代码在特定条件下执行,同时在正常情况下仍保持正确行为,展示了编译器漏洞如何绕过传统代码审计,并在关键软件中实现难以察觉的长期后门。

ABSTRACT

Whenever a bug occurs in a program, software developers assume that the code is flawed, not the compiler. In fact, if compilers should be correct, they are just normal software with their own bugs. Hard to find, errors in them have significant impact, since it could result to vulnerabilities, especially when they silently miscompile a critical application. Using assembly language to write such software is quite common, especially when time constraint is involved in such program. This paper exposes a bug found in Microsoft Macro Assembler (ml for short) compiler, developed by Microsoft since 1981. This assembly has the characteristics to get high level-like constructs and high level-like records which help the developer to write assembly code. It is in the management of one of this level-like construct the bug has been found. This study aims to show how a compiler-bug can be audited and possibly corrected. For application developers, it shows that even old and mature compilers can present bugs. For security researcher, it shows possibilities to hide some unexpected behavior in software with a clear and officially non-bogus code. It highlights opportunities for including stealth backdoors even in open-source software.

研究动机与目标

  • 揭示微软 MASM(ml)编译器中一个此前未知的、无声的编译器错误,该错误会错误编译条件逻辑。
  • 展示攻击者如何利用此类错误在不修改源代码的情况下,向编译后的软件中插入隐蔽后门。
  • 强调仅依赖源代码审计进行安全评估的风险,尤其是在使用成熟但存在缺陷的编译器编译关键系统时。
  • 呼吁安全社区将编译器视为潜在攻击面,并同时审计源代码与编译器行为。
  • 说明通过编译器级漏洞创建难以察觉的长期后门在技术上是可行的,类似于肯·汤普森著名的编译器后门攻击。

提出的方法

  • 在 MASM 的宏汇编处理条件表达式中 NOT 操作符的语法级别上识别出一个错误。
  • 使用 MASM 语法构造测试用例,这些用例本应实现逻辑非运算,但被编译为错误的 x86 机器码。
  • 使用 WinDbg 等工具反汇编编译输出,验证生成的汇编代码与预期逻辑不符。
  • 证明错误编译的代码可能导致意外的控制流,例如跳过预期的跳转或执行非预期的分支。
  • 向微软报告该问题,促使他们修复该漏洞,现通过引入语法错误(A2154)阻止此类结构的无声错误编译,同时保持向后兼容性。
  • 通过逆向工程和二进制分析,确认该逻辑错误在真实编译二进制文件中存在且可被利用。

实验结果

研究问题

  • RQ1在广泛使用且长期存在的汇编器 MASM 中,编译器错误如何导致条件逻辑的无声错误编译?
  • RQ2此类错误编译在何种方式下可被利用,以在编译后的软件中插入隐蔽且难以察觉的后门?
  • RQ3为何当源代码看似正确且为开源时,开发者和审计人员难以检测此类后门?
  • RQ4在评估关键软件安全性时,依赖编译器正确性有何影响,尤其是在固件和系统级代码中?
  • RQ5如何利用编译器错误在不修改源代码的情况下,实现跨软件更新的持久化?

主要发现

  • 当在复杂条件构造中使用 NOT 操作符时,微软 MASM 编译器中会发生无声错误编译,导致生成的二进制文件中控制流错误。
  • 该错误导致编译器生成与源代码预期逻辑行为不符的 x86 指令,尽管语法有效。
  • 该错误无法通过静态源代码分析检测,因为代码看似正确并符合标准 MASM 规范。
  • 该漏洞允许攻击者插入仅在特定、受控条件下执行的后门,使其极为隐蔽且难以察觉。
  • 微软通过为此类结构引入语法错误(A2154)修复了该问题,防止进一步发生无声错误编译,同时不破坏向后兼容性。
  • 在固件、内核和安全工具等关键系统中,该攻击面尤为危险,因为这些系统常进行源代码审计,但编译器行为却未被审查。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。