New to ShortSpan? We distil the AI-security research that matters into practitioner takeaways — edited by Ben Williams (NCC Group). Get the weekly email
// Analysis

Pre-deployment Hardening Blocks LLM Agent Data Leaks

Agents
Pre-deployment Hardening Blocks LLM Agent Data Leaks

New research shifts defence left for LLM agents. A pre-deployment pipeline scans prompts, tools and code, patches risky patterns with schema tightening, boundary sanitisation, allowlists and least-privilege, then validates with adversarial and benign tests. Across five apps and AgentDojo, it blocked basic jailbreaks, cut stress-induced leaks by 91%, and preserved utility.

Agentic applications stitch a Large Language Model (LLM) planner to tools, memory and APIs. That glue layer is where data leaks start. If an input or retrieved page sneaks in new instructions, the LLM can override policy, call an over-privileged tool, or echo secrets into logs and outbound requests. With multiple agents, the problem compounds: one compromised handoff poisons the rest. Runtime filters catch symptoms; they rarely fix the code paths that made the leak inevitable.

The work here shifts left with a pre-deployment pipeline you can drop into CI/CD. It scans source, prompt templates and tool wrappers, ranks likely leakage paths, and then proposes minimal patches. I like how concrete the edits are: tighten schemas, sanitise boundaries, gate tools by allowlist, and pare back privileges. It also rewrites prompts and enforces structured handoffs between agents. No model retraining, no planner surgery; changes land as source-level guardrails that existing frameworks can verify.

The validation step is the neat bit. The pipeline auto-generates adversarial inputs that look like jailbreaks, instruction overrides and tool-targeted manipulation. It adds stress or urgency framing to push for policy breaks, and it mixes in benign task variants to spot regressions. During runs it watches sinks that matter in practice, such as tool arguments and outbound network calls, and iterates until either attacks fail or a set budget is spent.

On five real CrewAI and LangGraph applications, pre-deployment hardening wiped out leakage from basic jailbreak and instruction-override attacks. Under stress-induced manipulation it still cut leaks by 91% overall. The toughest hold-out was a network monitoring assistant: aggregated attack success fell from 81.9% to 7.4%. On the AgentDojo benchmark, utility under attack rose from 37.0% to 72.2% while security nudged up by 7.4 points. In one suite, the authors accepted a dip from 100% to 80% security because they prioritised continued operation over blanket refusal.

Ablation matters. Remove the analyser and you get blunt edits that raise attack success and break benign behaviour. Skip validation and sophisticated attacks slip through, with regressions left unrepaired. The signal is clear: you need both a structural map of the agent and a red team loop that adapts to your code.

There are limits. Schema-preserving tampering of inter-agent artefacts can evade structural checks, and some stress-framed prompts still work. The approach does not replace runtime information-flow controls, and multi-user deployments will need stronger authorisation and context isolation. Evaluation ran on specific frameworks and an iterative budget, so the guarantees stop there.

Still, this feels like linting for agents, tuned to how real leaks happen. Attackers who keep structure intact while subverting content, or who lean on poorly scoped tools and provenance gaps, will give it the hardest time. That is exactly the kind of pressure a pre-deployment pipeline should prepare you for.

Additional analysis of the original ArXiv paper

📋 Original Paper Title and Abstract

Data Leakage Prevention in Agentic Applications via Preemptive Hardening

Authors: Akansha Shukla, Emily Bellov, Parth Atulbhai Gandhi, Yuval Elovici, and Asaf Shabtai
Agentic systems integrate LLM driven planning with interfaces to external tools, making data leakage and tool misuse feasible via instruction/data boundary failures and prompt injection attacks. Enforcing required controls consistently is particularly challenging in workflows spanning many codebases and heterogeneous agents. To address this challenge in multi agentic systems, we present a pre-deployment pipeline for scanning, hardening, and validation of agentic applications. The pipeline analyzes prompt templates, tool interfaces, and tool-invocation code to identify leakage-enabling patterns and generate actionable patches. The hardened application is then validated through adversarial prompt injection attacks and benign input variations ensuring that mitigations do not disrupt intended behavior. In the hardening stage, high-risk tools are prioritized, and minimally invasive mitigations are applied, including schema tightening, boundary sanitization, allowlist-based tool gating, and least-privilege checks. In the validation stage, the pipeline automatically generates attack inputs that mimic jailbreaks, instruction overrides, and tool-targeted manipulation, along with benign task variants, to confirm that the functionality of the hardened application is preserved after remediation. We evaluated the pipeline on five real-world agentic applications, as well as on the AgentDojo benchmark. Across all applications, the proposed pipeline identified recurring leakage-enabling patterns and generated patches that can be integrated without disrupting the intended application behavior. The resulting modifications of application code were shown to eliminate leaks when targeted by basic jailbreak and instruction-override attacks, achieving a 100% reduction in leakage, and reduce leaks by 91% under conditions of stress-induced manipulation, without the need of continuous runtime policy enforcement.

🔍 ShortSpan Analysis of the Paper

Problem

Agentic applications combine LLM planning with external tools and persistent state, creating complex instruction/data boundaries. Prompt injection, instruction overrides, over-privileged tools, weak input validation, logging of secrets, and insecure defaults enable data leakage and tool misuse that can propagate across multi-step and multi-agent workflows. Consistently enforcing controls across heterogeneous codebases and agent frameworks is difficult, and runtime-only defences are often reactive and fail to remove underlying code-level weaknesses.

Approach

The paper presents a pre-deployment, CI/CD-oriented pipeline that scans source code and prompt templates, ranks leakage paths, synthesises targeted code and prompt patches, and validates the hardened application with adaptive adversarial and benign tests. The pipeline has three modules: an analyzer that reconstructs agent topology, tool interfaces and memory access and produces a ranked audit; a modifier that applies minimally invasive mitigations such as schema tightening, boundary sanitisation, allowlist-based tool gating and least-privilege tool exposure, plus prompt rewrites and structured handoffs; and a validation module that generates adversarial inputs (direct injections, jailbreaks, instruction overrides and stress-induced attacks) and benign variants, runs adaptive attack attempts, monitors sinks including tool arguments and outbound requests, and iterates until attacks fail or a budget of iterations is exhausted. Analysis combines structural program analysis with LLM-augmented semantic reasoning to label sensitivity and prioritise fixes. The pipeline targets source-level changes and produces machine-verifiable guardrails compatible with existing agent frameworks without modifying model weights or planner architecture.

Key Findings

  • Pre-deployment hardening eliminated leakage from basic jailbreak and instruction-override attacks across five real-world CrewAI and LangGraph applications, a 100% reduction for those classes.
  • Under stress-induced manipulation the pipeline reduced leakage by 91% overall; one residual case was a network monitoring assistant where aggregated attack success fell from 81.9% to 7.4% ASR.
  • On the AgentDojo benchmark the pipeline improved utility under attack from 37.0% to 72.2% (+35.2 percentage points) while producing a net security gain of +7.4 points; one suite saw a security regress from 100% to 80% due to a design choice favouring continued operation over blanket refusal.
  • Module ablation showed the analyzer and validation stages are critical: removing the analyzer raised attack success and harmed benign utility through indiscriminate edits; removing validation left sophisticated attacks undetected and allowed benign regressions to go unrepaired.

Limitations

Some stress-framed prompts remain effective and schema-preserving tampering of inter-agent artefacts can evade structural checks. The pipeline does not replace runtime information-flow controls and multi-user deployments need stronger authorization and context isolation than currently enforced. Evaluation used a bounded iterative budget and specific frameworks, so absolute guarantees beyond those settings are not claimed.

Implications

For offensive actors the paper documents effective strategies: crafting multi-stage reconnaissance to discover agent boundaries, embedding malicious instructions in inputs or retrieved content, exploiting inter-agent handoffs and tool arguments, performing schema-preserving tampering of artefacts, and applying stress or urgency framing to override safeguards. Such vectors can exfiltrate system prompts, credentials, user data and intermediate reasoning through outbound requests or generated outputs. The pipeline’s defensive focus indicates that attackers will benefit most from attacks that preserve expected structure while subverting content semantics or that exploit insufficiently scoped tool permissions and inter-agent provenance.

// Similar research

Related Research

Get the weekly digest

The few AI-security papers that matter, with the practitioner takeaway. No spam.