Manuscript Offprint

arXiv:2609.01663

Context Inference Attacks Without Jailbreaks

Prince Jha, Samuele Poppi, Nils Lukas

Abstract

Agentic AI systems are increasingly deployed to process sensitive data at inference time, such as healthcare records or financial documents assembled into a hidden context before the system answers. Prior work has studied privacy risks primarily through jailbreaking attacks that induce models to directly disclose sensitive content, but has largely overlooked the agentic setting where the context is assembled by the agent's own tool calls. We show that the agents we evaluate remain vulnerable to hidden-context leakage despite the controls we test against them, namely an instruction not to disclose the context, logit suppression, and context dilution. For instance, a web-browsing agent answering benign user queries still carries exploitable signals about records silently loaded into its context. We introduce and formalize context-inference attacks through a security game and evaluate three settings under decreasing attacker knowledge and increasingly indirect delivery of the context: a known context, an unknown context, and a context the agent retrieves through its own tool calls. We distinguish a grey-box setting, in which the target model is used to score observations, from black-box settings in which the attacker scores with a surrogate it controls. We further characterize how leakage varies with query budget, context size, and target-model size. A single attack carries through all three settings without modification, reaching 100% ASR on small candidate sets and 63% at 1024 candidates against a known context, 78.9 AUROC when the template and surrounding records are unknown, 92.5 AUROC when a 14B surrogate scores a 32B target, and 81.8 AUROC when the records arrive as an agent's retrieval returns, against chance rates of 1/|Z| and 50 respectively. Leakage grows with query budget in both the grey-box and within-family black-box settings. The attack additionally transfers to vision-language models (VLMs), reaching up to 99% ASR against a 1.6% guessing rate when the candidate record is delivered as an image.

1 Introduction

Agentic AI systems are increasingly deployed as general-purpose systems for automating information work. Unlike standalone chatbots, these agents assemble their own inference-time context: system instructions, retrieved documents, user records, images, tool outputs, browsing traces, and intermediate state [1]. This context is essential for utility. A coding assistant [3] may condition on repository files, a medical assistant [7] may condition on patient records, and a web-browsing agent may condition on pages retrieved during tool use. The same context may hold provider-confidential or privacy-sensitive information, such as API keys, private documents, financial records, or medical attributes [14, 15, 22, 26]. The sensitive quantity need not be the content of a record. That a particular record entered the context may itself be sensitive, even when the record is public.

Prior work on context privacy has largely focused on extraction: an attacker uses jailbreaks, prompt injection, or adversarial instructions to make the model directly reveal hidden content [4, 25]. Accordingly, many defenses focus on blocking direct disclosure of sensitive content in the output, often under jailbreaking-style prompts. Broadly, they can be divided into two categories. Instruction-based defenses [27] aim to prevent disclosure by refusing to answer certain queries or excluding sensitive spans from the output. Filtering-based defenses [26] rely on an auxiliary model to scan and block outputs mentioning PII. Both approaches depend on the sensitive content being detectable in the output, verbatim or encoded, e.g., Base64. In contrast, we show that context can be inferred even without explicit disclosure: benign-looking outputs can carry subtle signals about the hidden context that enable context inference.

To illustrate, consider a web-browsing assistant that answers benign user questions while silently loading external pages into its hidden context. Even if the assistant never cites, quotes, or names a page, its response distribution may still depend on whether that page was loaded, so an attacker

Figure

Figure 1: Overview of the context inference attack. The adversary submits up to KK benign queries, observes only the responses, and scores them under two contexts that differ solely in whether the candidate record zz is present. The same loop runs whichever way the hidden context reaches the model, as a system prompt, as retrieved documents, or as the agent's own tool calls. Here θ^\hat{\theta} is the target model in the grey-box setting and a surrogate in the black-box setting, and the figure shows one of JJ filler draws.

learns what the agent read without ever reading it. Similarly, an assistant grounded on private records may avoid copying a credential it was given while still producing responses that are statistically more consistent with that credential being present. In multimodal settings, a vision-language model may be instructed not to mention private image content, yet its text responses can still carry exploitable signals about the hidden image. These examples suggest that the attack surface is not limited to direct extraction: it includes inference over the hidden context itself, as illustrated in Figure 1.

We call this class of attacks context inference attacks. The key idea is to treat hidden context as a latent hypothesis. An adversary sends ordinary benign queries to the deployed system, observes the resulting responses, and then uses a scoring model to determine which hidden-context hypothesis best explains those responses. The attack does not require the model to print, quote, or summarize the sensitive content. Instead, it aggregates small distributional signals across multiple benign interactions. The queries carry no adversarial instruction and do not depend on the candidate being tested, so the same fixed set is issued whatever the attacker is testing for, and the sensitive content is never emitted, so filters that look for the hidden context in the output have nothing to match against.

We study this vulnerability across three settings that progressively approach a deployed agent under decreasing attacker knowledge and increasingly indirect delivery of the context. The first assumes a known context, where the attacker knows the template and a finite candidate set, and asks whether the hidden context measurably changes responses to benign queries at all. The second withdraws both, leaving an unknown context in which the attacker is given one candidate

and must decide whether it is present. The third places that same attacker against an agent-retrieved context, where the records enter through the agent's own tool calls rather than as text supplied with the query. The third is the deployment we target, while the first two establish the mechanism and make its result interpretable, since a negative result there could not distinguish a context that leaves no recoverable trace from queries too weak to find one. We formalize all three in Section 4. They share one failure mode: hidden context leaks through response distributions even without direct disclosure.

Our empirical results show that context inference is effective across models, modalities, and deployment settings. Against a known context, our likelihood-based attack reaches 100% attack success rate (ASR) on small candidate sets and 63% at 1024 candidates. Against an unknown context on the Qwen2.5 family, it reaches 78.9 AUROC at ten records, and 92.5 AUROC at three records when a 14B surrogate scores a 32B target, with leakage increasing as the query budget grows and decreasing as more records are added to the context. Against an agent-retrieved context, it reaches 81.8 AUROC once uninformative queries are filtered from the pool, again increasing with query budget and decreasing with context size. A GPT-4o-mini judge given the same queries, responses, and candidate stays close to chance throughout, which places the signal beyond what standard inference over the response text recovers. The attack also transfers to vision-language models, reaching up to 99% ASR against a 1.6% guessing rate.

Finally we summarise our contributions as follows:

Context inference as an attack surface. We identify and formalize a leakage mode in which hidden inference-time context can be inferred from benign interactions, even when the system discloses none of the sensitive content in its output.

Unified replay-based attack framework. We formulate context inference as hypothesis testing over hidden contexts and instantiate one attack, unchanged, across a known context, an unknown context, and a context the agent retrieves for itself.

Surrogate-guided inference with benign queries. We develop a practical likelihood-based attack that uses a weaker surrogate model to score target responses, together with a query-selection procedure that identifies informative benign queries under a fixed budget.

Empirical evaluation across attack surfaces. We evaluate LLMs, VLMs, static document contexts, and tool-mediated web-browsing settings, showing 100% ASR against a known context, 78.9 and 92.5 AUROC against an unknown context under grey-box and surrogate scoring, 81.8 AUROC against an agent-retrieved context, and up to 99% ASR under VLM transfer, in every case against a GPT-4o-mini judge that stays close to chance.

References (27)