一句话:通过识别稀有分支并动态生成变异掩码,引导 AFL 更高效地覆盖难达代码。
本文针对 AFL 等灰盒模糊测试工具因难以覆盖大范围代码而漏检缺陷的问题,提出 FairFuzz。该方法首先自动识别仅由少量输入触发的稀有分支,这些分支往往对应难以通过朴素变异覆盖的代码;随后设计了一种新的变异掩码生成算法,在模糊测试过程中动态计算掩码,使变异偏向于生成能够命中指定稀有分支的输入,并可适配不同测试目标。作者在 AFL 之上实现 FairFuzz,并在真实程序上与先进 AFL 版本对比。实验表明,FairFuzz 能更快达到高分支覆盖率;在具有嵌套条件结构的程序上,运行 24 小时后分支覆盖率持续提升,平均增加 10.6%;定性分析还发现其自动发现关键词的能力更强。
In recent years, fuzz testing has proven itself to be one of the most effective techniques for finding correctness bugs and security vulnerabilities in practice. One particular fuzz testing tool, American Fuzzy Lop (AFL), has become popular thanks to its ease-of-use and bug-finding power. However, AFL remains limited in the bugs it can find since it simply does not cover large regions of code. If it does not cover parts of the code, it will not find bugs there. We propose a two-pronged approach to increase the coverage achieved by AFL. First, the approach automatically identifies branches exercised by few AFL-produced inputs (rare branches), which often guard code that is empirically hard to cover by naively mutating inputs. The second part of the approach is a novel mutation mask creation algorithm, which allows mutations to be biased towards producing inputs hitting a given rare branch. This mask is dynamically computed during fuzz testing and can be adapted to other testing targets. We implement this approach on top of AFL in a tool named FairFuzz. We conduct evaluation on real-world programs against state-of-the-art versions of AFL. We find that on these programs FairFuzz achieves high branch coverage at a faster rate that state-of-the-art versions of AFL. In addition, on programs with nested conditional structure, it achieves sustained increases in branch coverage after 24 hours (average 10.6% increase). In qualitative analysis, we find that FairFuzz has an increased capacity to automatically discover keywords.