Lune

USENIX Security2021Top-tier venue

Finding Bugs Using Your Own Code: Detecting Functionally-similar yet Inconsistent Code

Mansour Ahmadi, Reza Mirzazade Farkhani, Ryan Williams, Long Lu

Abstract

Probabilistic classification has shown success in detecting known types of software bugs. However, the works following this approach tend to require a large amount of specimens to train their models. We present a new machine learning-based bug detection technique that does not require any external code or samples for training. Instead, our technique learns from the very codebase on which the bug detection is performed, and therefore, obviates the need for the cumbersome task of gathering and cleansing training samples (e.g., buggy code of certain kinds). The key idea behind our technique is a novel two-step clustering process applied on a given codebase. This clustering process identifies code snippets in a project that are functionally-similar yet appear in inconsistent forms. Such inconsistencies are found to cause a wide range of bugs, anything from missing checks to unsafe type conversions. Unlike previous works, our technique is generic and not specific to one type of inconsistency or bug. We prototyped our technique and evaluated it using 5 popular open source software, including QEMU and OpenSSL. With a minimal amount of manual analysis on the inconsistencies detected by our tool, we discovered 22 new unique bugs, despite the fact that many of these programs are constantly undergoing bug scans and new bugs in them are believed to be rare.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

15 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery cites A Large-Scale Empirical Study of Security Patches
  • One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery cites APISan: Sanitizing API Usages through Semantic Cross-Checking
  • One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery cites Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
  • One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery cites Detecting Missed Security Operations Through Differential Checking of Object-based Similar Paths
  • "Get in Researchers; We're Measuring Reproducibility": A Reproducibility Study of Machine Learning Papers in Tier 1 Security Conferences cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • "Get in Researchers; We're Measuring Reproducibility": A Reproducibility Study of Machine Learning Papers in Tier 1 Security Conferences cites Scalable Graph-based Bug Search for Firmware Images
  • Learning Graph-based Code Representations for Source-level Functional Similarity Detection cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • Learning Graph-based Code Representations for Source-level Functional Similarity Detection cites Scalable Graph-based Bug Search for Firmware Images
  • Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection cites Scalable Graph-based Bug Search for Firmware Images
  • Detecting Missed Security Operations Through Differential Checking of Object-based Similar Paths cites APISan: Sanitizing API Usages through Semantic Cross-Checking
  • Detecting Missed Security Operations Through Differential Checking of Object-based Similar Paths cites Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints Inferences
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers15

  1. Learning Graph-based Code Representations for Source-level Functional Similarity DetectionJiahao Liu, Jun Zeng, Xiang Wang, Zhenkai LiangICSE 2023 · 27 citations
  2. "Get in Researchers; We're Measuring Reproducibility": A Reproducibility Study of Machine Learning Papers in Tier 1 Security ConferencesDaniel Olszewski, Allison Lu, Carson Stillman, Kevin Warren et al.CCS 2023 · 19 citations
  3. Detecting Missed Security Operations Through Differential Checking of Object-based Similar PathsDinghao Liu, Qiushi Wu, Shouling Ji, Kangjie Lu et al.CCS 2021 · 11 citations
  4. One Bug, Hundreds Behind: LLMs for Large-Scale Bug DiscoveryQiushi Wu, Yue Xiao, Dhilung Kirat, Kevin Eykholt et al.ICML 2026 · 5 citations
  5. LineBreaker: Finding Token-Inconsistency Bugs with Large Language ModelsHongbo Chen, Yifan Zhang, Xing Han, Tianhao Mao et al.ASE 2025 · 3 citations

Builds on7

  1. Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity DetectionXiaojun Xu, Chang Liu, Qian Feng, Heng Yin et al.CCS 2017 · 682 citations
  2. Scalable Graph-based Bug Search for Firmware ImagesQian Feng, Rundong Zhou, Chengcheng Xu, Yao Cheng et al.CCS 2016 · 456 citations
  3. A Large-Scale Empirical Study of Security PatchesFrank Li, Vern PaxsonCCS 2017 · 273 citations
  4. APISan: Sanitizing API Usages through Semantic Cross-CheckingInsu Yun, Changwoo Min, Xujie Si, Yeongjin Jang et al.USENIX Security 2016 · 107 citations
  5. Detecting Missing-Check Bugs via Semantic- and Context-Aware Criticalness and Constraints InferencesKangjie Lu, Aditya Pakki, Qiushi WuUSENIX Security 2019 · 97 citations

Related papers

  1. Self-Supervised Bug Detection and RepairMiltiadis Allamanis, Henry Jackson-Flux, Marc BrockschmidtNeurIPS 2021 · 145 citations
  2. Non-Distinguishable Inconsistencies as a Deterministic Oracle for Detecting Security BugsQingyang Zhou, Qiushi Wu, Dinghao Liu, Shouling Ji et al.CCS 2022 · 2 citations
  3. On Distribution Shift in Learning-based Bug DetectorsJingxuan He, Luca Beurer-Kellner, Martin T. VechevICML 2022 · 20 citations
  4. How to Train Your Neural Bug Detector: Artificial vs Real BugsCedric Richter, Heike WehrheimASE 2023 · 5 citations
  5. When to Say What: Learning to Find Condition-Message InconsistenciesIslem Bouzenia, Michael PradelICSE 2023 · 5 citations
Dusk over the sea between two cliffs drawn in fine vertical lines