ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection
summary
The gist
Static analyzers have widely adopted for vulnerability detection in C/C++ programs.<ref:2608.20637#pg1, However existing queries still suffer from false positives (FPs…
In short
ARQ is an agentic framework that automatically improves static analysis queries for C/C++ code using execution-grounded evidence. It refines queries by synthesizing programs and using LLMs to correct query weaknesses, effectively reducing false positives and false negatives.
Key concepts
- Execution-driven Reasoning
- Instead of relying solely on text reasoning, ARQ executes synthesized programs to test a query's verdict. If the program's actual behavior contradicts the query's prediction, it reveals a weakness that can then be used to fix the query.
- Witness Generation
- The agent iteratively generates pairs of similar programs designed to expose flaws in the current query. These generated programs serve as 'witnesses'; when their execution results differ from what the query expects, they provide ground truth for refinement.
- Oracle Function
- The Oracle is a critical function that provides the definitive, correct result for a program's execution. This ground truth is essential because it allows the agent to detect and correct hallucinations—instances where an LLM incorrectly suggests a weakness that doesn't actually exist.
Terminology used across episodes
This episode discusses
- ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection · Paper Radio
- Vulnerability Detection with Code Language Models: How Far Are We?
- Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAG
- CASTLE: Benchmarking Dataset for Static Code Analyzers and LLMs towards CWE Detection
- Repair Is Nearly Generation: Multilingual Program Repair with LLMs
- Neuro-symbolic Static Analysis with LLM-generated Vulnerability Patterns
- IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilities
- Finetuning Large Language Models for Vulnerability Detection
- QLCoder: A Query Synthesizer For Static Analysis of Security Vulnerabilities · Paper Radio
- SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering
- Prompt-Enhanced Software Vulnerability Detection Using ChatGPT
- Large Language Model for Vulnerability Detection and Repair: Literature Review and the Road Ahead
The paper
ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection · Read on arXiv
Columbia University
Transcript
Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.
Nadia: I'm Nadia.
Elias: And I'm Elias, here with Priya.
Nadia: We're looking at the paper: "ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection".
Paper summary: Nadia: So we're talking about this paper called ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection. Essentially, static analysis tools like CodeQL use queries to find bugs in C and C plus plus programs. But these existing queries have problems with false positives and false negatives, meaning they either flag safe code as bad or miss actual vulnerabilities. ARQ is this agentic framework that automatically improves those CodeQL queries using evidence from synthesized programs.
Elias: That's the core thesis, Nadia. The main idea is that a synthesized program exposes a weakness in a query whenever its execution doesn't match what the query predicts it should find. If the program is actually vulnerable but the query stays silent, that's a false negative weakness; if it’s safe and the query still flags it as bad, that’s a false positive weakness. ARQ then uses an LLM-based loop to fix those weaknesses based on what those programs show.
Priya: So what does this actually mean for us looking at the data? If the synthesized program's execution disagrees with the query's verdict, it gives us ground truth that helps guide the refinement process. It’s using actual runtime behavior to correct the static analysis rules.
Nadia: Exactly. The paper shows they refine twelve official CodeQL queries using three different commercial LLMs, GPT-five point four, Claude-Sonnet-four point six, and Gemini-three point five-flash to see how effective it is in practice across different models and queries on the Juliet v1 point 3 and FormAI v2 datasets.
Elias: And they found that ARQ actually improved query performance in those evaluations when compared against the original CodeQL queries, although those gains depend on which underlying model you use, as Table one shows <ref:2608.20637#pg1>.
Priya: But we have to look at what they did beyond just those benchmark datasets. The paper validates ARQ on real, currently unresolved problems in widely used software by fixing three open GitHub issues related to UseAfterFree and identifying two previously undiscovered bugs in seven popular C plus plus projects like libpng and zlib.
Nadia: That’s a pretty big deal because it shows the framework works on actual codebases, not just theoretical examples. It also fixed three unresolved GitHub issues in the official CodeQL query repository that had been open for as long as twenty-seven months.
Elias: And they also looked at why this works by doing an ablation study to see if grounding the LLMs through Analyze and Oracle is necessary to reduce hallucinations in the LLM process. They found that without execution-grounded evidence, the agent sometimes hallucinates a weakness that doesn't actually exist, so running those tests is not just helpful—it seems necessary.
Priya: So, putting it simply, ARQ uses execution-driven reasoning where programs are synthesized to expose query failures, and then the LLM uses that disagreement as ground truth to repair the original query through iterative refinement.
Nadia: Right. The title of this paper is ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection by Chunyi Wang, Yunfei Ke, Junfeng Yang, Yun-Yun Tsai, and Penghui Li from Columbia University. It really highlights how we can use agentic frameworks to keep static analysis tools relevant as software evolves.
Elias: It suggests that an automated way to keep those queries updated through program synthesis and iterative LLM-guided reasoning could meaningfully reduce the maintenance burden on tools like CodeQL and help them stay effective as codebases and vulnerability patterns evolve.
Priya: The limitation they point out is that most query failures are never filed as bug reports, which means the framework relies on finding those specific failure modes through synthetic programs, which might not cover every real-world scenario.
Nadia: That's fair. So while ARQ shows promise for improving query accuracy and finding new bugs, we have to consider that the quality of the refinement really depends on how good those synthesized witness pairs are generated in the first place.
Elias: True. The efficiency of ARQ involves running this refinement loop over multiple iterations, with each iteration taking an average of four hundred thirty-three to six hundred ninety seconds depending on the model, so a full five iteration refinement can complete within an hour.
Priya: It's interesting that they focused on how the process works rather than just presenting a final, perfect query. They show you how it alternates between false negative and false positive witnesses until the budget is exhausted.
Nadia: It’s about making the static analysis queries more robust by treating them like something that can be actively refined, not just static rules you write once and forget about. That's what ARQ is aiming for.
Elias: So if you think a tool needs to stay effective as codebases change, automating the refinement of its detection queries using execution-grounded evidence is a practical strategy they’ve demonstrated here with ARQ: Agentic CodeQL Query Refinement for C/C++ Vulnerability Detection.
Conclusion: Nadia: So we're wrapping up this look at ARQ, which stands for Agentic CodeQL Query Refinement for C plus plus vulnerability detection by Wang and colleagues at Columbia University.
Elias: Yeah, it’s an agentic framework that uses execution-grounded evidence from synthesized programs to automatically fix the weaknesses in static analysis queries.
Priya: What they did is take existing CodeQL queries, which often have false positives or false negatives, and use this loop of generating test programs and getting feedback from those programs to actually improve the query itself.
Nadia: Exactly. The core idea is that if a program you run doesn't match what the query predicts it should find, that execution disagreement becomes a piece of ground truth to guide the refinement process.
Elias: It’s about using actual runtime behavior instead of just pure logic to determine if a vulnerability exists in code. This moves beyond just reading the source code and actually testing its behavior.
Priya: I'm interested in how they built that feedback loop, because they spent a lot of time on defining what constitutes a query failure, which is either a false positive or false negative against a specific program.
Nadia: Right, and then they ask the AI to generate pairs of programs that are similar but expose this failure. That pair acts as the witness showing where the query is weak.
Elias: And then they use that witness, that confirmed disagreement, to prompt an LLM to propose a better version of the original query. It’s a cycle where execution drives refinement and the LLM guides it.
Priya: So what this means for folks working on security tools is that you can use these AI agents to continuously keep your analysis queries current without having to manually write and test every single new edge case.
Nadia: It does suggest that automated, iterative refinement of static analysis queries could significantly lower the maintenance burden on tools like CodeQL as codebases change constantly.
Elias: It’s about keeping those detection rules effective as the vulnerability patterns in software evolve over time. But we still have to watch how well those synthesized programs actually capture all possible tricky scenarios.
Priya: That’s right, so while it tackles false positives and negatives effectively on test sets, we need to see if this level of automation holds up when applied to the really messy, real-world codebases.
More episodes
- The day in conversation for 2026-12-05
- Daily Summary for 2026-12-05
- 2607.15118-Automated Template-free Synthesis of Instruction-Centric Leakage Contracts for Black-Box CPUs
- 2610.37722-FVH-Bench: Evaluating Image Generator Safety Beyond Overtly Harmful Imagery
- 2512.23849-Security Without Detection: Economic Denial as a Primitive for Edge and IoT Defense
- 2605.05807-LCC-LLM: Leveraging Code-Centric Large Language Models for Malware Attribution
- 2607.02932-PromptPET: Prompt Obfuscation Against Profiling by AI Agents
- 2309.05646-A Novel Supervised Deep Learning Solution to Detect Distributed Denial of Service (DDoS) attacks on Edge Systems using Convolutional Neural Networks (CNN)
- The day in conversation for 2026-12-04
- Daily Summary for 2026-12-04