Detecting API Post-Handling Bugs Using Code and Description in Patches
Miaoqian Lin, Kai Chen, Yang Xiao
摘要
Program APIs must be used in accordance with their specifications. API post-handling (APH) is a common type of specification that deals with APIs' return checks, resource releases, etc. Violation of APH specifications (aka, APH bug) could cause serious security problems, including memory corruption, resource leaks, etc. API documents, as a good source of APH specifications, are often analyzed to extract specifications for APH bug detection. However, documents are not always complete, which makes many bugs fail to be detected. In this paper, we find that patches could be another good source of APH specifications. In addition to the code differences introduced by patches, patches also contain descriptions, which help to accurately extract APH specifications. In order to make bug detection accurate and efficient, we design API specification-based graph for reducing the number of paths to be analyzed and perform partial path-sensitive analysis. We implement a prototype named APHP (API Post-Handling bugs detector using Patches) for static detection of APH bugs. We evaluate APHP on four popular open-source programs, including the Linux kernel, QEMU, Git and Redis, and detect 410 new bugs, outperforming existing state-of-the-art work. 216 of the bugs have been confirmed by the maintainers, and 2 CVEs have been assigned. Some bugs have existed for more than 12 years. Till now, many submitted patches have been backported to long-term stable versions of the Linux kernel.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- KNighter: Transforming Static Analysis with LLM-Synthesized Checkers 引用了 Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
- One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery 引用了 APISan: Sanitizing API Usages through Semantic Cross-Checking
- One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery 引用了 Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation Analysis
- One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery 引用了 Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code Auditing 引用了 One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code Auditing 引用了 APISan: Sanitizing API Usages through Semantic Cross-Checking
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code Auditing 引用了 Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation Analysis
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code Auditing 引用了 VUDDY: A Scalable Approach for Vulnerable Code Clone Discovery
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code Auditing 引用了 Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
- Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation Analysis 引用了 APISan: Sanitizing API Usages through Semantic Cross-Checking
- Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation Analysis 引用了 Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
- Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation Analysis 引用了 Automatically Detecting Error Handling Bugs Using Error Specifications
- Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences 引用了 SemFuzz: Semantics-based Automatic Generation of Proof-of-Concept Exploits
- Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences 引用了 Automatically Detecting Error Handling Bugs Using Error Specifications
引用它的顶会 Paper7
- One Bug, Hundreds Behind: LLMs for Large-Scale Bug DiscoveryQiushi Wu, Yue Xiao, Dhilung Kirat, Kevin Eykholt 等ICML 2026 · 5 次引用
- KNighter: Transforming Static Analysis with LLM-Synthesized CheckersChenyuan Yang, Zijie Zhao, Zichen Xie, Haoyu Li 等SOSP 2025 · 1 次引用
- VulInstruct: Teaching LLMs Root-Cause Reasoning for Vulnerability Detection via Security SpecificationsHao Zhu, Jia Li, Cuiyun Gao, Jiaru Qian 等FSE 2026
- BugAuditor: Detecting Bugs via Inconsistent Defensive Code AuditingMiaoqian Lin, Kai Chen, Hao ChenUSENIX Security 2026
- Uncovering the iceberg from the tip: Generating API Specifications for Bug Detection via Specification Propagation AnalysisMiaoqian Lin, Kai Chen, Yi Yang, Jinghua LiuNDSS 2025
它引用的 Paper18
- VUDDY: A Scalable Approach for Vulnerable Code Clone DiscoverySeulbae Kim, Seunghoon Woo, Heejo Lee, Hakjoo OhS&P 2017 · 388 次引用
- SemFuzz: Semantics-based Automatic Generation of Proof-of-Concept ExploitsWei You, Peiyuan Zong, Kai Chen, XiaoFeng Wang 等CCS 2017 · 148 次引用
- APISan: Sanitizing API Usages through Semantic Cross-CheckingInsu Yun, Changwoo Min, Xujie Si, Yeongjin Jang 等USENIX Security 2016 · 107 次引用
- Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints InferencesKangjie Lu, Aditya Pakki, Qiushi WuUSENIX Security 2019 · 97 次引用
- Automatically Detecting Error Handling Bugs Using Error SpecificationsSuman Jana, Yuan Jochen Kang, Samuel Roth, Baishakhi RayUSENIX Security 2016 · 79 次引用
相关 Paper
- APICAD: Augmenting API Misuse Detection through Specifications from Code and DocumentsXiaoke Wang, Lei ZhaoICSE 2023 · 7 次引用
- Detecting Missed Security Operations Through Differential Checking of Object-based Similar PathsDinghao Liu, Qiushi Wu, Shouling Ji, Kangjie Lu 等CCS 2021 · 11 次引用
- AURC: Detecting Errors in Program Code and DocumentationPeiwei Hu, Ruigang Liang, Ying Cao, Kai Chen 等USENIX Security 2023
- Non-Distinguishable Inconsistencies as a Deterministic Oracle for Detecting Security BugsQingyang Zhou, Qiushi Wu, Dinghao Liu, Shouling Ji 等CCS 2022 · 2 次引用
- Inference of Error Specifications and Bug Detection Using Structural SimilaritiesNora Dossche, Bart CoppensUSENIX Security 2024 · 2 次引用
