← Latest papers
💻 computer science

QLCoder: A Query Synthesizer For Static Analysis of Security Vulnerabilities

QLCoder is an agentic framework that leverages an LLM enhanced with execution feedback, Language Server Protocol integration, and RAG-based retrieval to automatically synthesize valid CodeQL queries from CVE metadata, achieving a 53.4% success rate in detecting security vulnerabilities across Java projects compared to 10% with a standard agent.

Original authors: Claire Wang, Ziyang Li, Saikat Dutta, Mayur Naik

Published 2026-03-20
📖 5 min read🧠 Deep dive

Original authors: Claire Wang, Ziyang Li, Saikat Dutta, Mayur Naik

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a security guard for a massive, ancient library (the internet). Every day, thousands of new books arrive, and some of them have hidden traps—pages that, if read, could cause the whole library to catch fire. These traps are called vulnerabilities.

For years, security guards have used a special set of checklists (called "queries") to scan these books and find the traps before anyone gets hurt. But here's the problem: writing these checklists is incredibly hard. It requires knowing the library's secret language, understanding complex architecture, and having a detective's mind. Most guards don't have this superpower, so they rely on a few pre-made checklists that miss many new traps.

Enter QLCoder, the new "Super-Intern" that can write these checklists for you.

The Problem: The "Human" Bottleneck

Think of the existing security tools (like CodeQL) as a powerful search engine. To find a specific trap, you have to write a very specific search query.

  • The Challenge: Writing these queries is like trying to write a legal contract in a language you've never spoken. If you get one word wrong, the search engine either crashes or gives you a list of 10,000 irrelevant books (false alarms), or worse, it misses the dangerous book entirely.
  • The Result: Libraries are full of undetected traps because writing the right "search query" is too hard for humans to do quickly for every new threat.

The Solution: QLCoder (The AI Detective)

QLCoder is an AI agent designed to act as a Query Synthesizer. Instead of a human struggling to write the checklist, you give QLCoder a simple description of the trap (a "CVE" report, which is like a police report saying, "There's a bomb in the basement of Building X").

QLCoder then goes to work to write the perfect search query. But it doesn't just guess; it uses a clever three-step loop:

  1. The Draft: The AI (an LLM) tries to write the checklist based on the police report.
  2. The Test Drive: It runs this checklist against the "Vulnerable" version of the library (where the bomb exists) and the "Fixed" version (where the bomb was removed).
    • Did it find the bomb in the bad version? Good.
    • Did it accidentally flag the safe version as dangerous? Bad.
  3. The Correction: If the test fails, the AI gets a report card. It doesn't just guess again; it uses special tools to look up the library's rules (syntax) and past successful checklists (memory) to fix its mistakes.

The Secret Sauce: The "MCP" Toolbox

What makes QLCoder special is that it doesn't just "hallucinate" answers like a confused student. It has a custom toolbox (called an MCP interface) that acts like a GPS and a librarian:

  • The GPS (Language Server): If the AI tries to use a word that doesn't exist in the checklist language, the GPS instantly says, "Hey, that word is wrong. Did you mean this one?" This prevents the AI from writing gibberish.
  • The Librarian (RAG Database): If the AI is stuck, the Librarian pulls out similar past cases and documentation. "Oh, you're looking for an XML trap? Here are three other checklists that worked for similar XML traps."

The Results: A Game Changer

The researchers tested QLCoder on 176 real-world security traps found in Java software.

  • The Old Way (Human or basic AI): Only managed to write correct checklists for about 10% of the traps.
  • QLCoder: Successfully wrote working checklists for 53.4% of the traps.
  • The Impact: The checklists QLCoder wrote were so precise that they caught the bad guys (vulnerabilities) while ignoring the innocent people (safe code). In comparison, the standard tools used by companies today missed almost everything (scoring very low on accuracy).

The Analogy: Finding a Needle in a Haystack

Imagine you need to find a specific needle in a haystack, but the needle is made of gold and looks exactly like a straw.

  • Standard Tools: They have a magnet that only picks up iron. They miss the gold needle entirely.
  • Basic AI: It tries to guess where the needle is but keeps picking up straws and throwing them away, getting frustrated.
  • QLCoder: It's like a detective who looks at the police report ("The needle was dropped near the red barn"), checks the library of past cases ("Last time, the needle was near the red barn too"), and then uses a special gold-detecting scanner (the syntax guide) to ensure it doesn't pick up a fake. It finds the needle, confirms it's real, and ignores the straws.

Why Should You Care?

In the real world, software vulnerabilities are like cracks in a dam. If we don't find them, the dam breaks, and data leaks out. QLCoder automates the process of finding these cracks. It turns a task that used to take a team of experts days to do into something an AI can do in minutes with high accuracy.

It's not just about finding bugs; it's about scaling security. Now, for every new vulnerability discovered in the world, we can instantly generate a tool to find it in millions of other software projects, keeping our digital world safer without needing a human expert to write the code for every single one.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →