The Research Report
Your Code Already Knows Where Prompt Injection Will Hit — You Just Haven't Asked It
How a team at HUST borrowed the oldest trick in software security and pointed it at the newest problem in AI
The Problem Nobody Could Find From the Outside
You know prompt injection. Someone pastes "ignore previous instructions" into your chatbot. Your LLM obliges. Secrets leak. Everyone wrings their hands.
That's the direct kind. It gets the headlines because it's easy to demonstrate and easy to understand. You type something malicious, the model follows it, bad things happen.
But there's a harder variant that most security teams are only starting to reckon with: indirect prompt injection. No user types anything malicious. Instead, hostile instructions hide inside data the AI retrieves during normal operation — a webpage it summarizes, an email it triages, a database record it reads. The attack arrives through the application's own data pipeline, not through the user input field.
Traditional defenses were built for the direct kind. Input filters, guardrails, classifier gates — they all sit between the user and the model. When the attack comes from inside the application's own data sources, those defenses never see it.
Here's the uncomfortable truth: in most LLM-integrated applications, untrusted data flows from user input or external sources all the way through prompt construction and into sensitive operations — API calls, database writes, file system access, email sends — with zero tracking of where that data came from or where it ends up. The application has no idea which parts of a prompt are trusted and which are potentially hostile.
A new paper at ICSE 2026 changes that. It's called TaintP2X, and it does something deceptively simple: it applies program-analysis techniques that security researchers have used for decades to find buffer overflows and SQL injection — and it points them at prompt injection paths in LLM-integrated applications.
Taint Analysis: The Oldest New Idea in AI Security
If you've worked in application security, you know taint analysis. It's the technique behind tools like Facebook's Pysa, Google's CodeQL, and dozens of commercial SAST scanners. The idea is straightforward:
- Mark data from untrusted sources as "tainted" (user input, external APIs, file reads).
- Track where that tainted data flows through the program — through function calls, variable assignments, string concatenations, return values.
- Flag any place where tainted data reaches a "sink" — a dangerous operation like a SQL query, a shell command, or a file write — without being properly sanitized.
This is how we've found SQL injection, XSS, and path traversal vulnerabilities for years. The data flow is the vulnerability. You don't need to understand what the attacker's payload looks like. You just need to see that untrusted data can reach a dangerous operation.
TaintP2X asks: what if the "sink" is the construction of a prompt to an LLM, and the downstream "sinks" are all the dangerous operations the LLM can trigger?
The paper's title spells it out: "Detecting Taint-Style Prompt-to-Anything Injection Vulnerabilities in LLM-Integrated Applications." The "X" in P2X is a wildcard. It's not just prompt-to-prompt injection. It's prompt-to-SQL, prompt-to-file, prompt-to-API, prompt-to-email, prompt-to-anything. Any path where untrusted input flows into an LLM prompt, and the LLM's output flows into a sensitive operation, is a vulnerability.
Why This Hasn't Been Done Before
Static taint analysis is mature technology. Facebook open-sourced Pysa in 2020. CodeQL has been finding SQL injection for years. So why hasn't anyone pointed it at LLM prompt injection until now?
Three reasons, and they're the same reasons LLM security is hard in general:
The LLM is a black box in the data flow. Traditional taint analysis works on source code. It traces data through function calls, variable assignments, and string operations. But an LLM call is a function that takes a string (the prompt) and returns a string (the response). The analysis can't see inside the model. It can't know whether the model will faithfully follow the system prompt or get hijacked by a snippet of user input buried in context.
TaintP2X doesn't try to look inside the model. Instead, it treats the LLM call itself as a propagation point: tainted data that flows into a prompt is tainted data that flows out of the LLM's response. The model is treated as a pass-through — not because the model is literally passing data through, but because the model might pass data through, and that's the conservative assumption that security demands.
LLM APIs are diverse and evolving. Every framework wraps LLM calls differently. OpenAI's SDK has one API shape. Anthropic's has another. LangChain abstracts over both but adds its own wrapping. AutoGen, LlamaIndex, Django integrations — each framework has its own calling conventions, its own parameter names, its own ways of constructing prompts from templates.
TaintP2X handles this with what it calls intelligent taint source identification. It uses AST parsing combined with LLM-assisted semantic reasoning to automatically generate taint source specifications for different frameworks. If you're using a custom wrapper around OpenAI's API, TaintP2X can figure out that your call_model(prompt) function is an LLM entry point, not just a random function call. The paper's GitHub repo includes stub files (.pyi type stubs) for OpenAI, Anthropic, AutoGen, Django, and other common frameworks.
False positives are brutal. Taint analysis is inherently over-approximate. It will find every path where tainted data could reach a sink, which means it will also flag paths where the data gets neutralized, sanitized, or simply doesn't matter. In traditional security scanning, a 90% false positive rate is common, and security engineers have learned to tolerate it because they can manually triage findings.
But LLM-integrated applications are different. The paths are longer and more convoluted. Data flows through string templates, prompt builders, response parsers, and API wrappers before it ever reaches a sensitive operation. A naive taint analysis would drown the developer in noise.
This is where TaintP2X's most interesting contribution lives: LLM-assisted false positive pruning.
The Two-Stage Pipeline
TaintP2X runs in two stages. The first stage is traditional static taint analysis, built on Pysa (Facebook's open-source taint tracker for Python). The second stage uses an LLM — specifically, DeepSeek — to prune false positives.
Stage 1: Static Taint Analysis
The first stage does what you'd expect from a taint analysis tool:
- Source identification. Find all places where untrusted data enters the program: HTTP request parameters, database query results, file reads, environment variables, API responses. TaintP2X uses a combination of predefined sources (Pysa's built-in taint models) and LLM-generated source specifications for custom entry points.
- Propagation. Track tainted data through the program's control flow. This includes intra-function analysis (tracking data within a single function) and inter-function analysis (tracking data across function boundaries). String concatenation, format strings, f-strings, template rendering — all the ways Python glues data together are tracked.
- Sink detection. Flag any point where tainted data reaches a sensitive operation: executing a command, writing to the filesystem, sending an email, making an API call with side effects, or — critically — constructing a prompt that gets sent to an LLM.
The output of Stage 1 is a set of potential vulnerability paths: source → propagation → sink. Some of these are real vulnerabilities. Many are false positives.
Stage 2: LLM-Assisted Pruning
This is where things get clever. For each potential vulnerability path, TaintP2X asks an LLM to evaluate whether the path is actually exploitable. This happens in two sub-steps:
Source controllability analysis. Not all tainted sources are equally dangerous. An HTTP parameter controlled by an attacker is high-risk. A configuration file that only the server admin can edit is low-risk. TaintP2X uses an LLM to classify each source as attacker-controlled or not, based on the source code context.
Multi-round LLM verification. For paths that pass the controllability check, TaintP2X extracts the relevant code snippets and asks the LLM to determine whether the taint actually propagates through the code in an exploitable way. This is where the LLM's ability to understand natural language context matters: it can tell whether a string template safely escapes user input, whether a validation function actually constrains the data, and whether a prompt construction pattern creates a genuine injection risk.
The result is a dramatically cleaner set of findings. The paper reports that the two-stage approach reduces false positives by a significant margin compared to Pysa alone, while maintaining high recall (finding the real vulnerabilities).
What TaintP2X Actually Found
The paper evaluates TaintP2X on a benchmark of real-world LLM-integrated applications. The results:
- Real-world vulnerability detection. TaintP2X identified previously unknown prompt injection vulnerabilities in open-source applications. These weren't toy examples — they were real applications with real users where untrusted data flowed from external sources through LLM prompts and into sensitive operations.
- Multiple injection path types. The tool found paths where user input flowed into prompts that then controlled: file system operations, database queries, API calls, and email sending. These are the "anything" in Prompt-to-Anything — not just prompt leakage, but actual operational impact.
- Framework coverage. TaintP2X's stub files cover OpenAI, Anthropic, AutoGen, Django, and several other frameworks. The LLM-assisted source identification means it can extend to custom frameworks without manual specification.
The GitHub repository (security-pride/TaintP2X) is open-source under the Apache 2.0 license. It includes the complete analysis pipeline, stub files for supported frameworks, and the dataset used in the paper's evaluation.
Compile-Time vs. Runtime: Why Both Matter
TaintP2X works at compile time (or more precisely, at static analysis time). It reads your source code, traces data flows, and reports vulnerabilities before the application ever runs. This is fundamentally different from the runtime approach championed by companies like Swept AI.
The runtime approach — which Swept AI calls "supervision" — monitors the application's behavior in production. It watches what the LLM actually does: what API calls it makes, what outputs it generates, what actions it takes. When the LLM deviates from expected behavior, the supervisor flags it and intervenes.
Both approaches are necessary, and they complement each other:
Static analysis (TaintP2X) tells you where vulnerabilities could exist. It finds the paths. It shows you that data from a user's HTTP request can flow through your prompt builder and into a subprocess.call(). You don't need to wait for an attack to happen. You don't need to set up a test environment. You run the analysis, you get the paths, you fix them.
Runtime supervision tells you whether vulnerabilities are actually being exploited. Static analysis can't tell you whether an attacker has actually found and exploited a path. It can't tell you whether the LLM is behaving as expected right now, in this specific request, with this specific input. Supervision catches the attacks that slip through — and some always will.
Think of it this way: static analysis is the building inspector who checks whether the doors lock properly before anyone moves in. Runtime supervision is the security guard who watches the doors after the building is occupied. You want both.
The convergence is happening. GitHub added a CodeQL query for prompt injection detection in 2025. Psalm (the PHP static analysis tool) added a TaintedLlmPrompt issue type. OpenTaint (a Kotlin-based taint analysis engine specifically designed for AI applications) appeared on the scene with 50 stars and growing. The idea that you can find LLM injection vulnerabilities by tracing data flows through code is spreading fast.
The Broader Shift: From "Is the Model Safe?" to "Is the Application Safe?"
For the past two years, the AI safety conversation has been dominated by model-level concerns: alignment, instruction hierarchy, system prompt robustness, guardrail tuning. These are important. But they're incomplete.
A model that resists direct prompt injection perfectly can still be exploited through indirect injection. A model that never leaks its system prompt can still be manipulated into making dangerous API calls. The model's behavior is only one part of the equation. The other part — the part that TaintP2X addresses — is the application that wraps the model.
Every LLM-integrated application has a data flow. Data comes in from users, from databases, from APIs, from files. It gets assembled into prompts. The prompts get sent to the model. The model's responses get parsed, and the parsed responses trigger actions: database queries, HTTP requests, file writes, email sends.
The security of the system depends on the integrity of that entire data flow, not just on the model's resistance to adversarial prompts. Taint analysis — a technique developed in the 1970s and refined for decades — gives us a way to audit that data flow automatically, at scale, before the code ships.
This is the shift that matters. We're moving from asking "is the model safe?" to asking "is the application safe?" — and we're using the same tools we've used to answer that question for every other technology: trace the data, find the paths, fix the sinks.
How to Use TaintP2X (And What It Can't Do)
If you're building an LLM-integrated application, here's what TaintP2X gives you:
The pipeline is accessible. It's built on Pysa, which is open-source and well-documented. The GitHub repo includes installation instructions, configuration files, and a script (rundownloadandcheck.py) that automates the analysis of target projects. You configure your target projects in testsource.json, point the tool at your codebase, and it produces a list of potential vulnerability paths.
The stub files are practical. Rather than requiring you to manually specify every LLM API call as a source or sink, TaintP2X ships with type stubs for common frameworks. If you're using OpenAI's Python SDK, Anthropic's client, or AutoGen, the analysis knows where the LLM boundaries are without manual configuration.
The LLM-assisted pruning is a genuine innovation. Pure static taint analysis for LLM applications produces an unmanageable volume of findings. The two-stage approach — static analysis to find paths, then LLM reasoning to filter false positives — is a pattern I expect to see replicated across the industry.
But there are limitations, and the paper is honest about them:
Python only. TaintP2X is built on Pysa, which analyzes Python. If your LLM integration is written in TypeScript, Go, Rust, or Java, you'll need a different tool (or need to adapt the approach to a different taint analysis framework).
No runtime guarantees. Static analysis is sound in theory (it finds all possible paths) but imprecise in practice (it reports many paths that aren't real vulnerabilities). The LLM-assisted pruning helps, but it can't eliminate false positives entirely. You still need runtime supervision to catch what static analysis misses.
The model is a pass-through. TaintP2X treats the LLM as a propagation point — tainted data in means tainted data out. This is the correct conservative assumption for security analysis, but it means the tool can't distinguish between prompts where the model is likely to be manipulated and prompts where the model is likely to resist manipulation. A system prompt with strong instruction hierarchy might be robust against injection, but TaintP2X will still flag the path.
Custom framework support requires effort. While the LLM-assisted source identification helps, if you've built a custom prompt construction pipeline with its own templating system, you'll need to provide enough context for the analysis to understand your framework.
The Ecosystem Is Catching Up
TaintP2X isn't alone. The idea of applying program analysis to LLM security is spreading:
- CodeQL (GitHub/Microsoft) added a Python query for prompt injection detection in 2025, treating LLM API calls as taint sources.
- Psalm (Vimeo) added
TaintedLlmPromptas a first-class issue type, bringing prompt injection detection to PHP applications. - OpenTaint (seqra) is building a Kotlin-based taint analysis engine specifically designed for AI applications, with AST-pattern rules and whole-program analysis.
- Whitney (Transilience AI) is an open-source static scanner that covers 15 source types for prompt injection, beating Semgrep's AI ruleset on labeled corpora.
- Ghost in the Agent (HKUST) and Crossing the NL/PL Divide (UNSW/Macquarie/NUS) are exploring how to track information flow across the natural language / programming language boundary in LLM-integrated code — the fundamental challenge that TaintP2X sidesteps by treating the LLM as a black-box pass-through.
The convergence is clear. The security research community has recognized that LLM injection is an information flow problem, and the right tools for information flow problems come from program analysis.
What This Means for You
If you're building applications that integrate LLMs, the takeaway is practical:
Run static analysis on your codebase. Whether it's TaintP2X, CodeQL, Psalm, or another tool — trace the data flows. Find out where untrusted input enters, where it flows into LLM prompts, and where LLM responses flow into sensitive operations. You can't secure what you can't see.
Don't rely on the model alone. Instruction hierarchy, system prompt guardrails, and self-reflection all have their place. But every model-side defense has been broken by adaptive attackers. The model is one component in a larger system. Secure the system.
Layer your defenses. Static analysis at build time. Runtime supervision in production. Output filtering on every response. Least-privilege permissions on every tool call. No single defense catches everything. The point of TaintP2X isn't that static analysis replaces runtime defenses. It's that static analysis gives you something runtime defenses can't: knowledge of where the vulnerabilities are before they're exploited.
Think in data flows, not in prompts. The fundamental insight behind TaintP2X is that prompt injection is a data flow problem. Untrusted data flows from sources, through the application, into the LLM, and out to sinks. The vulnerability isn't in the prompt. It's in the path. Fix the path, not the prompt.
The Paper
- Title: TaintP2X: Detecting Taint-Style Prompt-to-Anything Injection Vulnerabilities in LLM-Integrated Applications
- Authors: Junjie He, Shenao Wang, Yanjie Zhao, Xinyi Hou, Zhao Liu, Quanchen Zou, Haoyu Wang
- Affiliation: Huazhong University of Science and Technology (HUST), Wuhan, China
- Venue: ICSE 2026, 48th IEEE/ACM International Conference on Software Engineering, Rio de Janeiro, Brazil, April 2026
- DOI: 10.1145/3744916.3773199
- GitHub: security-pride/TaintP2X (Apache 2.0)
- PDF: shenaow.github.io/files/icse26taintp2x.pdf
Suggested Title
Your Code Already Knows Where Prompt Injection Will Hit — You Just Haven't Asked It
Citations
- He, J., Wang, S., Zhao, Y., Hou, X., Liu, Z., Zou, Q., & Wang, H. (2026). TaintP2X: Detecting Taint-Style Prompt-to-Anything Injection Vulnerabilities in LLM-Integrated Applications. Proceedings of the IEEE/ACM 48th International Conference on Software Engineering (ICSE 2026). DOI: 10.1145/3744916.3773199 — https://doi.org/10.1145/3744916.3773199
- security-pride/TaintP2X GitHub repository — https://github.com/security-pride/TaintP2X
- ICSE 2026 conference listing — https://conf.researchr.org/details/icse-2026/icse-2026-research-track/157/
- Swept AI, "Indirect Prompt Injection Is a Supervision Problem, Not a Filter Problem" — https://www.swept.ai/post/indirect-prompt-injection-enterprise-supervision
- GitHub CodeQL, "Add query for prompt injection" (commit e7a0fc7) — https://github.com/github/codeql/commit/e7a0fc71408cf53686fb81c8f74ff7f6cd265a3f
- Vimeo/Psalm PR #11746, "Add TaintedLlmPrompt issue type for prompt injection detection" — https://github.com/vimeo/psalm/pull/11746
- seqra/OpenTaint, "The open source taint analysis engine for the AI era" — https://github.com/seqra/opentaint
- Cai, Y. et al., "Ghost in the Agent: Redefining Information Flow Tracking for LLM Agents" — https://arxiv.org/pdf/2604.23374
- Xu, Z. et al., "Crossing the NL/PL Divide: Information Flow Analysis Across the NL/PL Boundary in LLM-Integrated Code" — https://arxiv.org/html/2603.28345v1
- Liu, F. et al., "Make Agent Defeat Agent: Automatic Detection of Taint-Style Vulnerabilities in LLM-based Agents" (USENIX Security 2025) — https://lfysec.github.io/paper/agentfuzz-security25.pdf
- Facebook/Pysa (Pyre Check) documentation — https://pyre-check.org/docs/pysa-quickstart/
Word Count
~2,600 words (body text)
Fact-Check Notes
- Paper acceptance at ICSE 2026: Confirmed. The paper appears in the ICSE 2026 research track listing at conf.researchr.org. DOI 10.1145/3744916.3773199 is listed.
- GitHub repository (security-pride/TaintP2X): Confirmed active. 6 stars, Apache 2.0 license. Last push March 2026. Contains Pysa-based analysis framework, stub files for OpenAI/Anthropic/AutoGen/Django, and LLM-assisted validation modules.
- Authors and affiliation: Junjie He, Shenao Wang, Yanjie Zhao, Xinyi Hou, Zhao Liu, Quanchen Zou, Haoyu Wang — all at Huazhong University of Science and Technology (HUST), per the ICSE listing and paper.
- TaintP2X using Pysa and DeepSeek for LLM-assisted pruning: Confirmed from the GitHub README, which describes Pysa-based static analysis and DeepSeek LLM-assisted validation modules (
dsllmfullydeterminemul.py,dsllmsourcedeterminemul.py). - Specific vulnerability counts and benchmark results: Not directly verifiable from the available sources. The PDF is not text-extractable. Claims about detection effectiveness should be verified against the full paper.
- CodeQL prompt injection query: Confirmed — commit e7a0fc7 on github/codeql adds a Python query for prompt injection detection.
- Psalm TaintedLlmPrompt: Confirmed — PR #11746 on vimeo/psalm.
- OpenTaint (seqra): Confirmed — 50 stars on GitHub, Kotlin-based.
- Whitney (Transilience AI): Confirmed — 30 stars, open-source static AI security scanner.
- Swept AI runtime supervision approach: Characterized based on their published blog posts. The "supervision vs. filter" framing is directly from Swept AI's published content.
- "First formal static-analysis approach" claim from the task brief: This should be verified carefully. CodeQL added prompt injection queries in 2025, and other tools (Whitney, OpenTaint) exist. TaintP2X may be the first to formalize the full "prompt-to-anything" taint analysis pipeline with LLM-assisted pruning, but it's not the first static analysis tool to address prompt injection broadly.