Skip to content

When compression becomes an attack surface: black-box attacks on prompt-compression LLM agentsWhen Compression Becomes an Attack Surface: Black-Box Attacks on Prompt-Compressed LLM Agents

arXiv· arXiv:2510.22963· ASE 2026· Zesen Liu, Zhixiang Zhang, Yuchong Xie, Dongdong SheThe Hong Kong University of Science and TechnologyIndexed by this site · 25 days ago· Originally publishedSelected AttacksSelectedAttention40

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose COMA, a black-box attack against prompt compressors, achieving an average ASR of 0.71 across 6 compressors and 3 tasks, 0.21 higher than the strongest baseline.

Threat modeltransfer-based black-box: the attacker can only submit inputs and observe the agent's final output, and cannot access model internal parameters, the victim's actual compression prompt, or the trusted input x_sys; the attacker can only perturb the untrusted input (query suffix or external content), with the goal of making the compressor discard key content before compression.

Questions
LLM agents increasingly use prompt compression to reduce cost, but the compressor determines what the backend LLM can see. The authors argue that when trusted and untrusted inputs share the compression budget, an attacker can perturb only the untrusted input to make the compressor discard safety guardrails or key evidence, constituting a new attack surface.
Methods
The authors formalize this risk as adversarial information loss (AIL) and propose COMA: using an attacker-side surrogate compressor and surrogate backend LLM for two-stage optimization, first selecting in compression space a target that induces erroneous behavior, then searching for a perturbation that makes the surrogate compression result match that target, and finally validating end-to-end on the black-box victim pipeline.
Experiments and results
Across the three tasks ATS, Q&A, SPC and 6 compressors, COMA averages 0.71 ASR versus 0.21 for the strongest baseline; the no-attack and no-compression controls are close to 0. It generalizes across budgets and across backend LLMs; existing defenses average only 0.04–0.07 DSR, while the authors' proposed isolated compression averages 0.96 DSR on SPC.
Limitations and future work
The authors state that AIL is a conceptual quantity and was not precisely estimated in the experiments; due to resource constraints, the surrogate transfer experiments sampled only 100 examples per dataset; IC is only a preliminary mitigation, and the authors point out that reducing AIL involves a robustness–utility tension. The reviewers were LLMs, and the authors cross-checked with 300 manually annotated examples.
Experimental setupLLMLingua、LLMLingua2 et al. · ATS(自建,249 条)、SQuAD(过滤后 913 条) et al. · ASR、CTRR et al.
Evaluated models
LLMLinguaLLMLingua2Selective ContextLlama-3.2-3BQwen3-4BGemma-3-4BLlama-3.1-8B-instructLlama-2-7BLlama-3-8BLlama-3-70BMistral-2-7BQwen3-14BQwen3-32B
Benchmarks
ATS(自建,249 条)SQuAD(过滤后 913 条)SPC(自建,1563 条,来自 4 个 GitHub 仓库与 RealGuardrails)MeetingBank(代理压缩器弱监督训练)
Metrics
ASRCTRRDSRCohen's κ
AI summaryand selection rationaleResearchers proposed COMA, a black-box attack targeting the prompt compression stage, with an average attack success rate of 0.71 across six compressors and three types of tasks, while the strongest baseline not targeting compression was 0.21. The method perturbs only the untrusted input before compression, causing the compressor to discard safety guardrails or task-critical evidence from the system prompt; the attack target is the compressor rather than the backend LLM, and the authors formalize it as adversarial information loss (AIL). The experiments covered LLMLingua, LLMLingua2, Selective Context, and the summarization-based compressors Qwen3-4B, Llama-3.2-3B and Gemma-3-4B, with tasks including tool selection, question answering and system prompt corruption. The authors also reported that the method transfers across compression budgets and backend models, and is effective in the cases of VSCode Cline and LangChain + Ollama; isolating and compressing trusted and untrusted inputs separately raised the defense success rate on the system prompt corruption task to 0.96.

Researchers proposed COMA, a black-box attack targeting the prompt compression stage, with an average attack success rate of 0.71 across six compressors and three types of tasks, while the strongest baseline not targeting compression was 0.21. The method perturbs only the untrusted input before compression, causing the compressor to discard safety guardrails or task-critical evidence from the system prompt; the attack target is the compressor rather than the backend LLM, and the authors formalize it as adversarial information loss (AIL). The experiments covered LLMLingua, LLMLingua2, Selective Context, and the summarization-based compressors Qwen3-4B, Llama-3.2-3B and Gemma-3-4B, with tasks including tool selection, question answering and system prompt corruption. The authors also reported that the method transfers across compression budgets and backend models, and is effective in the cases of VSCode Cline and LangChain + Ollama; isolating and compressing trusted and untrusted inputs separately raised the defense success rate on the system prompt corruption task to 0.96.

Why it was selectedThe paper treats the prompt compressor as an independent attack surface, demonstrating a transferable black-box attack with an average success rate of 0.71 across six compressors and three types of tasks, and the mitigation effect of isolated compression.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors state that prompt compressors are a new attack surface for LLM agents: perturbing only the untrusted input is enough to make the compressor discard guardrails or key evidence.

    Core problem: prompt compression introduces an unstudied security boundary in LLM agents—whether an attacker can perturb only the untrusted input before compression to make the compressor discard safety guardrails or task-critical evidence under a shared budget, thereby changing the backend LLM's behavior.

    • Scenario and motivation: Prompt compression is integrated into agent frameworks such as LangChain, LlamaIndex, and PromptFlow to reduce latency and cost; the compressor determines which instructions, evidence, and context reach the backend LLM, and the authors argue that this shifts the security boundary from the backend LLM to the entire pipeline.
    • Shortcomings of existing threat models: The authors point out that prompt injection, jailbreak, and RAG poisoning all assume that the malicious payload must survive to the backend LLM and be interpreted as an instruction; under a compression pipeline, however, the perturbation need not contain a meaningful instruction, nor even survive compression—it only needs to change the compressor's retention decisions.
    • Core observation: When trusted input (e.g., the system prompt) and untrusted input (e.g., user queries, external content) are compressed together under the same budget, attacker-controlled content competes with safety-critical content for budget. In the example in Figure 2, appending an adversarial suffix to the query causes compression to drop the negation in the system prompt, and the backend LLM changes from refusing to executing.
    • What the paper proposes: Formalizes this vulnerability as adversarial information loss (AIL), i.e., the additional behavioral distortion caused by adversarial perturbation beyond benign compression distortion; and proposes a transfer-based black-box attack, COMA, as well as a preliminary mitigation, isolated compression (IC).
    • Threat model (Section 4, transfer-based black-box):
      • Goal: Maximize AIL, instantiated as two categories: guardrail attenuation and evidence distortion.
      • Knowledge: The attacker can submit inputs and observe the agent's final output; cannot access model internal parameters, the victim's actual compression prompt, or the actual trusted input x_sys; can know or infer that compression is deployed and choose a reasonable surrogate family.
      • Capability: Add perturbations to the untrusted input—query suffix (budget-limited) or external content (directly providing malicious documents or poisoning via a retrieval intermediary).
      • Victim system: An LLM agent pipeline that compresses first and then reasons, with prompt x = x_sys ⊕ x_ctx ⊕ x_que.
  2. What related research exists?

    Related work falls into two groups: prompt compression, and agent vulnerabilities and defenses; the authors state that existing attacks all assume the payload must survive to the backend and do not target compressors.

    Prompt Compression

    • Discrete compression: Selective Context [32] and the LLMLingua series [11, 25, 26, 41] filter low-importance tokens and are the most commonly used type in practice; small models such as Qwen3-4B [45] and Llama-3.2-3B [53] can also serve as compressors.
    • Other discrete methods: RL-based methods [28, 49] optimize token selection but are not very efficient; code-oriented compressors [51, 56, 63] have limited applicability (the above is the paper's assessment).
    • Continuous compression: [9, 10, 47, 54] compress prompts into continuous representations; the authors state that such methods depend on specific model architectures or training procedures and are not applicable to general agent systems. SecurityLingua [31] is positioned by the authors as a security defense rather than a standalone compressor and is outside the evaluation scope.

    Agent Vulnerabilities and Attacks

    • Injection and jailbreak: direct/indirect prompt injection [3, 5, 13, 36, 42], prompt leakage [21, 38, 62], jailbreak [6, 60, 64], retrieval or tool context poisoning [37, 57, 58, 67]. The authors point out that these works are all in non-compression settings and require the perturbation to survive to the backend and be interpreted as an instruction.

    Defenses

    • Detection-based: perplexity and windowed perplexity filtering [3, 15, 23].
    • Prevention-based: structured separation of instructions and data and alignment hardening, such as StruQ [7] and SecAlign [8].

    Baselines and Benchmarks in This Paper: the baselines are 5 non-compression attacks—Naive Attack, Direct Injection [36], Escape Characters [16], Context Ignore [5, 42], JudgeDeceiver [50] (transfer setting); the defense baselines are PPL [24], Window-PPL [3, 15, 23], StruQ, SecAlign. The evaluation tasks are ATS (self-built), Q&A (SQuAD [46]), SPC (self-built, from 4 GitHub leaked system prompt repositories [2, 4, 27, 55] and RealGuardrails [38]).

    Authors' positioning: to their knowledge, no prior attack targets prompt compressors; this paper shifts the attack target from the backend LLM to the compressor and provides defenses targeting the compression bottleneck.

  3. How does the paper address this problem?

    COMA uses a surrogate compressor and a surrogate backend for two-stage optimization: first select a target in compression space, then search for a perturbation that makes the surrogate compression result match it.

    Overall idea: the attack is formalized as a bilevel optimization with AIL as the objective, then solved approximately using a proxy objective and a two-stage approach, yielding the transfer-based black-box attack COMA.

    Formalization: BIL and AIL

    • Benign information loss: BIL(x; R) := dM(x, CR(x)), i.e., the downstream behavioral distortion caused by compression itself, where d_M is a measure of the difference in output distributions under uncompressed and compressed input.
    • Adversarial information loss: AIL(x; R) := WCD(x; R) − BIL(x; R), where WCD is the maximum downstream distortion reachable within the attacker's feasible neighborhood N(x); AIL isolates the attacker's additional contribution above benign compression distortion, and AIL ≥ 0.
    • The authors point out that AIL is a conceptual quantity; the experiments do not estimate it precisely, but use black-box proxy metrics to measure whether the target erroneous behavior can be reliably induced; if the compressor is locally invariant on N(x), then AIL = 0.

    Proxy Objective and Approximation Strategy

    • Proxy objective: a judge LLM J maps the victim pipeline's visible output y_atk to a task score, d̂(x_atk) := J(y_atk); in the experiments J is a binary success judge, and when the pipeline is stochastic, repeated queries are used to estimate the expectation.
    • Three-step approximation: (i) replace the victim's M and C_R with the attacker's proxy backend LLM M̂ and proxy compressor Ĉ_ρ; (ii) decouple the bilevel problem into two stages; (iii) verify candidate perturbations end-to-end on the real black-box victim pipeline.

    Two-Stage Optimization

    • Stage I (Dropout target selection): starting from a prompt that behaves normally after compression, a small LLM finds key words and greedily deletes them, re-evaluating on the proxy backend M̂ after each deletion until the behavior flips to erroneous (J=1); the deleted token set W is treated as decision-critical tokens, and the remaining compressed prompt serves as the Stage II target x̃_tgt.
    • Stage II (Adversarial perturbation search): a matching loss Lmatch is defined using the proxy compressor's logits, and GCG-like greedy token replacement minimizes it so that Ĉ_ρ(x_atk) matches x̃_tgt; for the hidden system prompt scenario, a universal suffix is optimized over a proxy prefix set P_cand and then transferred.
    • End-to-end verification: candidates are submitted to the real black-box pipeline, only visible outputs are taken, and the same binary judge J decides; among successful candidates, the one with the smallest modification (measured by edit distance etc.) is chosen; if there is no successful candidate, failure is reported.

    Proxy Compressor Construction and Key Parameters

    • Scoring-based extractive compressors (Selective Context, LLMLingua): an accessible language model computes token/span surprisal to approximate the ranking signal; this paper uses Llama-2-7B.
    • Learned extractive compressor (LLMLingua2): GPT-4o-mini generates length-controlled summaries on MeetingBank, which are aligned back to source tokens to obtain pseudo retention labels, and xlm-roberta-large is fine-tuned for token classification.
    • Abstractive compressors: a small LLM with the same length control serves as the proxy, by default Qwen3-4B.
    • Parameters: candidate budget R_cand = {0.5, 0.6, 0.7}; maximum optimization steps 500; perturbation budget cap 32 tokens (1.5625% of 2048 tokens); default proxy backend is Llama-3.1-8B-instruct; judge J is Qwen3-235B-A22B-Instruct-2507-FP8.
  4. What experiments did the paper conduct?

    Across 6 compressors × 3 tasks, COMA achieves an average ASR of 0.71 versus 0.21 for the baseline; it generalizes across budgets and backends; the existing defense DSR achieves only 0.04–0.07.

    Experimental Setup

    • Tasks and data: ATS is self-built with 249 entries (172 product categories, 77 tool categories, each entry with 5 candidate tool descriptions, some generated by GPT-4o-mini); Q&A uses 1000 entries sampled from SQuAD, 913 after filtering; SPC is self-built with 1563 entries (4 GitHub leaked system prompt repositories + RealGuardrails, after two filtering passes). All entries are ≤2048 tokens (LLMLingua2 ≤512), and entries that fail without an attack are removed.
    • Compressors under test (6): extractive Selective Context, LLMLingua, LLMLingua2; abstractive with Llama-3.2-3B, Qwen3-4B, Gemma-3-4B as backbones.
    • Backend LLM: default Llama-3.1-8B-instruct; generalization experiments additionally test Llama-2-7B, Llama-3-8B, Llama-3-70B, Mistral-2-7B, Qwen3-14B, Qwen3-32B.
    • Baselines: Naive Attack, Direct Injection, Escape Characters, Context Ignore, JudgeDeceiver (transfer setting); defense baselines PPL, Window-PPL (computed with GPT-2), StruQ, SecAlign.
    • Metrics and judge: task-level ASR (macro average), binary judge J = Qwen3-235B-A22B-Instruct-2507-FP8; also CTRR (critical token removal rate) and DSR (defense success rate).
    • Sample sizes: the main table uses the full filtered set for each task; the proxy transfer experiment randomly samples 100 entries per dataset due to resource constraints; judge reliability uses 300 stratified samples with human annotation.

    Main Results

    According to Table 1 (ASR, all cells in the No Attack column ≤0.04):

    Swipe horizontally to read the table

    CompressorTaskCOMAStrongest baseline (that cell)
    SCATS / Q&A / SPC0.98 / 0.80 / 0.620.41 / 0.24 / 0.34
    LLMLinguaATS / Q&A / SPC0.96 / 0.62 / 0.520.36 / 0.19 / 0.30
    LLMLingua2ATS / Q&A / SPC0.98 / 0.72 / 0.630.30 / 0.24 / 0.34
    Llama-3.2-3BATS / Q&A / SPC0.86 / 0.69 / 0.540.18 / 0.32 / 0.18
    Qwen3-4BATS / Q&A / SPC0.82 / 0.59 / 0.490.16 / 0.32 / 0.22
    Gemma-3-4BATS / Q&A / SPC0.89 / 0.71 / 0.440.18 / 0.36 / 0.21
    Overall average—0.710.21 (JudgeDeceiver)
    • The authors state that COMA has the highest ASR in all 18/18 settings; the no-attack overall is 0.01, and the no-compression + COMA control overall is 0.01, from which the authors conclude that the success comes from the vulnerability introduced at the compression stage.
    • The authors explain that the baselines are weaker because their malicious payloads need to survive compression and be interpreted by the backend, whereas COMA does not require the payload to survive.
    • Task differences: the authors state that ATS and Q&A are easier to attack (the perturbation is directly compressed), while SPC is harder (it relies on the suffix transferring to the hidden system prompt).

    Generalization (RQ2)

    • Across budgets (Table 2, Q&A): under R ∈ {0.2, 0.4, 0.6, 0.8}, COMA's average ASR is 0.74, 0.67, 0.69, 0.65 respectively; no-attack ASR is 0.60 at R=0.2, 0.29 at R=0.4, and close to 0 at R≥0.6. The attack-benign gap rises from 0.14 at R=0.2 to 0.68 at R=0.6 and 0.65 at R=0.8.
    • Across backends (Table 3): on 6 backend LLMs the overall average ASR ranges from 0.60 for Qwen3-32B to 0.77 for Llama-2-7B, with an overall mean of 0.69; ATS across backends is only 0.90–0.92, Q&A 0.45–0.75, SPC 0.46–0.64; the authors state that ATS is almost entirely driven by distortion at the compression stage, while Q&A/SPC depend more on the backend's own capabilities.

    Proxy Transfer and Mechanism (RQ3)

    • Proxy transfer (Table 4, 100 entries per dataset): the average ASR across 12 mismatched settings is 0.65, and the best proxy within a block is 0.73; e.g., under the SC target, the Llama-2-7B proxy is 0.80 and the GPT-2 proxy is 0.67; abstractive cross-proxy transfer degrades by Δ = −0.01 to −0.09. The authors state that an exact replica of the victim compressor is not needed.
    • CTRR (Table 5): the overall CTRR/ASR is 0.76/0.72; on SPC the two are exactly equal (0.54/0.54), while on Q&A the gap is larger (0.78/0.69), which the authors attribute to answer evidence being more dispersed and redundant.

    Judge Reliability, Cases and Defenses (RQ4–RQ6)

    • Judge reliability (Table 6): on 300 stratified samples, the agreement rate between the LLM judge and humans is 98.7%, Cohen's κ = 0.95, and the F1 for the Attack Fail class is 95.5%.
    • Case study (Figure 5): two instances transferred to real agents—in VSCode Cline (LLMLingua2 + Llama-3.1-8B), a request that was rejected when benign becomes a read_file call on a sensitive file; in LangChain + Ollama, tool selection is redirected. The paper does not give a quantitative success rate for the cases.
    • Defenses (Table 7, DSR): average DSR of existing defenses—PPL 0.04, Window-PPL 0.07, StruQ 0.04, SecAlign 0.04; the authors' isolated compression (IC) averages 0.37, including an average of 0.96 on the SPC task, with smaller improvements on ATS/Q&A. The authors state that IC avoids budget competition by isolating trusted and untrusted content.
  5. What are some points that can be further explored?

    The authors state that AIL is not precisely estimated, that IC is only a preliminary mitigation and has a robustness–utility tension, and that the surrogate transfer experiments use only 100 examples per dataset.

    Limitations and Future Directions Noted by the Authors

    • AIL cannot be estimated precisely (Section 3.2): the authors state that AIL is a conceptual quantity; the experiments do not estimate it precisely and only use black-box proxy metrics to measure the ability to actually induce erroneous behavior.
    • Robustness-utility tension in defense (Section 3.2): the authors point out that reducing AIL either requires making the compressor more locally invariant (which may increase BIL and suppress benign distinctions) or rejecting inputs whose compressed view is unstable (which may introduce false positives); even with the attack surface understood, mitigation remains non-trivial.
    • IC is a preliminary mitigation (Section 7.6): the authors position Isolated Compression as a preliminary structural mitigation for compression pipelines rather than a plug-and-play detector; its improvements on ATS and Q&A are small.
    • Scale limitation of the proxy transfer experiment (Section 7.3): the authors state that, due to resource constraints, this experiment randomly samples only 100 entries per dataset.
    • Extension directions beyond the conclusion: the paper does not list other explicit future work in the Conclusion.

    Experimental Coverage

    • There are 6 compressors under test: Selective Context, LLMLingua, LLMLingua2, and abstractive compressors with Llama-3.2-3B, Qwen3-4B, Gemma-3-4B as backbones (Section 6.2).
    • There are 7 backend LLMs: Llama-3.1-8B-instruct (default) and Llama-2-7B, Llama-3-8B, Llama-3-70B, Mistral-2-7B, Qwen3-14B, Qwen3-32B (Table 3).
    • Task and data sizes: ATS 249 entries, Q&A 913 entries, SPC 1563 entries; the budget sweep is done only on the Q&A task (Table 2).
    • Defense evaluation covers 5 in total: PPL, Window-PPL, StruQ, SecAlign and IC (Table 7); SecurityLingua is explicitly excluded from the evaluation scope by the authors (Section 8).
    • The judge is an LLM (Qwen3-235B-A22B-Instruct-2507-FP8), and its agreement with humans is measured on 300 stratified samples; the paper does not report the number of attack queries or end-to-end runtime, and the case study (Figure 5) does not report a quantitative success rate.
  6. Summarize the main content of the paper

    The authors identify the prompt compressor as a new attack surface; the COMA black-box attack averages 0.71 ASR, and isolated compression achieves 0.96 DSR on SPC.

    An attack paper targeting the prompt compression stage of LLM agents. The authors argue that the compressor lies on the security-critical path: when trusted and untrusted inputs share the compression budget, an attacker can perturb only the untrusted input to make the compressor discard safety guardrails or key evidence, and the perturbation need not survive to the backend.

    • Formalization: adversarial information loss (AIL) is defined as the additional behavioral distortion caused by adversarial perturbation beyond benign compression distortion; the authors state that AIL is a conceptual quantity and measure it in experiments with black-box proxy metrics.
    • Method COMA: a transfer-based black-box attack that uses the attacker's proxy compressor and proxy backend LLM for two-stage optimization—first deleting key tokens in the compression space to obtain a target that induces erroneous behavior, then searching greedy token replacements for a perturbation that makes the proxy compression result match that target, and finally verifying end-to-end on the real black-box pipeline.
    • Main results: across 6 compressors × 3 tasks (ATS, Q&A, SPC), average ASR is 0.71, versus 0.21 for the strongest non-compression baseline; the no-attack and no-compression controls are both about 0.01 (Table 1).
    • Generalization and mechanism: at budget R=0.6, Q&A average ASR is 0.69 while no attack is only 0.01 (Table 2); across 7 backend LLMs the overall mean is 0.69 (Table 3); CTRR tracks ASR, and the authors state that the attack works by removing a small number of decision-critical tokens.
    • Defenses: the four existing defenses average only 0.04–0.07 DSR; the authors' isolated compression (IC) averages 0.96 DSR on SPC, with smaller improvements on ATS/Q&A (Table 7).
    • Authors' conclusion: prompt compression is not security-neutral; it substantively changes agent behavior and the attack surface; isolating trusted and untrusted inputs can improve robustness, but the authors also point out that reducing AIL involves a robustness-utility tension, and IC is only a preliminary mitigation.

Related papers

Read originalASE 2026