一句话:引入堆不相交假设,使符号堆位置可强更新,提升缓冲区溢出静态分析的精度与可扩展性。
缓冲区溢出静态分析需同时推理堆可达性与数值关系,二者相互依赖;符号堆位置可能别名大量位置,导致堆状态析取难以精确处理,现有方法在精度与效率间取舍。本文提出堆不相交性假设:收缩程序状态空间,使内存访问涉及的符号位置互不相交。该性质允许在符号堆位置执行强更新,将数值信息融入堆推理,并支持生成紧凑精确的函数摘要以进行组合式分析。作者在静态检测器 Cod 中实现该思想,对 PHP、QEMU 等百万行级真实项目分析,发现 29 个缓冲区溢出缺陷,误报率 37%,且可在四小时内完成分析。
Static analysis techniques for buffer overflow detection still struggle with being scalable for millions of lines of code, while being precise enough to have an acceptable false positive rate. The checking of buffer overflow necessitates reasoning about the heap reachability and numerical relations, which are mutually dependent. Existing techniques to resolve the dependency cycle either sacrifice precision or efficiency due to their limitations in reasoning about symbolic heap location, i.e., heap location with possibly symbolic numerical offsets. A symbolic heap location potentially aliases a large number of other heap locations, leading to a disjunction of heap states that is particularly challenging to reason precisely. Acknowledging the inherent difficulties in heap and numerical reasoning, we introduce a disjointness assumption into the analysis by shrinking the program state space so that all the symbolic locations involved in memory accesses are disjoint from each other. The disjointness property permits strong updates to be performed at symbolic heap locations, significantly improving the precision by incorporating numerical information in heap reasoning. Also, it aids in the design of a compositional analysis to boost scalability, where compact and precise function summaries are efficiently generated and reused. We implement the idea in the static buffer overflow detector Cod. When applying it to large, real-world software such as PHP and QEMU, we have uncovered 29 buffer overflow bugs with a false positive rate of 37%, while projects of millions of lines of code can be successfully analyzed within four hours.
DOI 原文 ·
@inproceedings{paperbot8468,
title = {Precise Compositional Buffer Overflow Detection via Heap Disjointness},
author = {Yiyuan Guo and Peisen Yao and Charles Zhang},
booktitle = {ISSTA},
year = {2024},
doi = {10.1145/3650212.3652110}
}