Attention Distance: A Novel Metric for Directed Fuzzing with Large Language Models
Wang Bin, Ao Yang, Kedan Li, Aofan Liu, Hui Li, Guibo Luo, Weixiang Huang, Yan Zhuang
TL;DR
Attention Distance introduces a semantic augmentation to directed grey-box fuzzing by using a lightweight, vulnerability-tuned LLM to assign token- and line-level attention scores that reflect code semantics. These scores are aggregated and used to compute an attention distance $db_{att}$ that replaces AFLGo's traditional $db_{phys}$, yielding a significant acceleration in vulnerability reproduction across 38 CVEs and outperforming state-of-the-art fuzzers DAFL and WindRanger. The approach is implemented as a drop-in replacement within AFLGo and extended to DAFL and WindRanger, with a CodeBERT/LineVul-based model trained on the Code Vulnerability dataset and integrated via LLVM-Pass modifications. Empirical results show reduced distance clustering, improved vulnerability localization at function/block/line granularity, and robust performance across multiple targets, though challenges such as spurious attention peaks are discussed. The work demonstrates a practical path to combining LLM-derived semantic guidance with traditional fuzzing pipelines, offering real-world benefits and a foundation for further enhancements in seed guidance and path prioritization.
Abstract
In the domain of software security testing, Directed Grey-Box Fuzzing (DGF) has garnered widespread attention for its efficient target localization and excellent detection performance. However, existing approaches measure only the physical distance between seed execution paths and target locations, overlooking logical relationships among code segments. This omission can yield redundant or misleading guidance in complex binaries, weakening DGF's real-world effectiveness. To address this, we introduce \textbf{attention distance}, a novel metric that leverages a large language model's contextual analysis to compute attention scores between code elements and reveal their intrinsic connections. Under the same AFLGo configuration -- without altering any fuzzing components other than the distance metric -- replacing physical distances with attention distances across 38 real vulnerability reproduction experiments delivers a \textbf{3.43$\times$} average increase in testing efficiency over the traditional method. Compared to state-of-the-art directed fuzzers DAFL and WindRanger, our approach achieves \textbf{2.89$\times$} and \textbf{7.13$\times$} improvements, respectively. To further validate the generalizability of attention distance, we integrate it into DAFL and WindRanger, where it also consistently enhances their original performance. All related code and datasets are publicly available at https://github.com/TheBinKing/Attention\_Distance.git.
