Skip to content

Just Ask: Curious Code Agents Reveal System Prompts of Frontier LLMsJust Ask: Curious Code Agents Reveal System Prompts in Frontier LLMs

arXiv· arXiv:2601.21233· ICML 2026· Xiang Zheng, Yutao Wu, Hanxun Huang, Yige Li, Xingjun Ma, Bo Li, Yu-Gang Jiang, Cong Wang·Indexed by this site · 2026-10-12· Originally publishedAttacks

Quick read

Attacks

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

JustAsk extracts system prompts from 41 black-box models; the authors report a 100% success rate when consistency≥0.7.

Threat modelThe attacker's goal is high-fidelity extraction of the system prompt's semantics. The attacker only knows the target is a chat API language model, not its content, architecture, or defenses. Black-box chat API: arbitrary text in, text out, no weights, logits, or internal state, with multiple queries allowed. Success is determined by self-consistency and cross-skill consistency.

Questions
Code agents encode identity and safety rules into hidden system prompts. The authors believe autonomous multi-turn interaction expands the attack surface, allowing these instructions to be probed and recovered through conversation alone.
Methods
JustAsk uses a fixed set of 28 extraction skills, selects online per target with UCB, and uses embedding consistency as the reward. It requires no labeled data, handcrafted attack sentences, or weights, only a standard chat API.
Experiments and results
All 41 black-box models succeeded at consistency≥0.7, with closed-source models averaging 4.8 rounds. Attack-aware defenses reduced extraction quality by an average of 18.4% on four models, while simply prohibiting disclosure gave 6.0%. JustAsk's Sim-GT on GPT-4o is 0.727 (B=3).
Limitations and future work
The authors state the results are a January 2026 snapshot via OpenRouter, mostly semantic paraphrases, and that consistency on black-box is not accuracy. The evaluation includes 41 models, four models with three levels of defense, and five production systems; the paper does not report JustAsk's backbone model.
Experimental setupClaude Code (Claude Opus 4.5)、openai/gpt-5.2-codex et al. · OpenRouter 41-model black-box set、Claude Code et al. · consistency score、Sim-GT et al.
Evaluated models
Claude Code (Claude Opus 4.5)openai/gpt-5.2-codexanthropic/claude-opus-4.5google/gemini-3-procohere/command-aperplexity/sonar-proopenai/o1deepseek/deepseek-v3.2microsoft/phi-4tencent/hunyuan-a13bmeta-llama/llama-4-maverickx-ai/grok-4.1-fastDeepSeek V3Gemini FlashClaude Sonnet 4GPT-4oMistral LargeQwen 72BLlama 4 ScoutMiniMax M2.7
Benchmarks
OpenRouter 41-model black-box setClaude Code1,168-token ground-truth promptGemini CLICodex CLICursor Agent CLIPerplexity SonarCopilot CLI
Metrics
consistency scoreSim-GTextraction success (consistency ≥ 0.7)average turns
AI summaryThe researchers propose JustAsk, a self-evolving framework that requires no handcrafted prompts, labeled supervision, or privileged access, enabling code agents to autonomously discover and extract system prompts of frontier LLMs through interaction alone. The framework frames extraction as an online exploration problem, using UCB-based policy selection and a hierarchical skill space covering atomic probes and high-level orchestration, exploiting imperfect generalization of system instructions and the tension between helpfulness and safety. On 41 black-box commercial models from multiple vendors, JustAsk achieves complete or near-complete system prompt recovery, which the authors say exposes system prompts as a critical yet largely unprotected attack surface in modern agent systems.

The researchers propose JustAsk, a self-evolving framework that requires no handcrafted prompts, labeled supervision, or privileged access, enabling code agents to autonomously discover and extract system prompts of frontier LLMs through interaction alone. The framework frames extraction as an online exploration problem, using UCB-based policy selection and a hierarchical skill space covering atomic probes and high-level orchestration, exploiting imperfect generalization of system instructions and the tension between helpfulness and safety. On 41 black-box commercial models from multiple vendors, JustAsk achieves complete or near-complete system prompt recovery, which the authors say exposes system prompts as a critical yet largely unprotected attack surface in modern agent systems.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors state that autonomous interaction by code agents expands the attack surface, making hidden system prompts extractable through interaction.

    Code agents can extract hidden system prompts through conversation alone.

    • Scenario: the authors state that code agents such as Claude Code, Cursor, and GitHub Copilot integrate file exploration, shell, planning, and testing modules, and their behavior is governed by system prompts encoding identity, safety constraints, and operational rules; after exposure to sensitive codebases and execution privileges, the secrecy of hidden instructions becomes a first-order security problem.
    • Existing shortcomings: the authors state that existing methods rely on small static datasets (LeakAgent trained on 87 benign prompts and does not consider safety-aware defenses), are mostly single-turn or fixed multi-turn, fail on hardened frontier models, and cannot discover new strategies after initial probing fails.
    • Observation and hypothesis: under direct request, Claude Code disclosed its own instructions totaling 6,973 tokens, while its sub-agents initially refused; the authors state that after switching to extraction-oriented interaction, the sub-agents also disclosed, and they hypothesize that sufficiently autonomous code agents can recover the target system prompt through interaction alone.
    • Method in this paper: propose JustAsk, framing extraction as online exploration. The skill table is fixed at 14 single-turn atomic skills and 14 multi-turn orchestration strategies; UCB balances exploitation and exploration, and consistency verification provides external reward. What is learned online is a per-target selection policy, not rewriting the skills themselves.
    • Threat model (Section 3.2):
      • Goal: high-fidelity extraction of the system prompt's semantic content; repeated use of the same skill should be stable, and extractions across different skills should be semantically similar.
      • Knowledge: only knows the target is a language model on a chat API, not the prompt, base architecture, or defenses.
      • Capabilities: black-box standard chat API, arbitrary text in, text out; no weights, logits, attention, or internal state; multiple queries allowed, subject to rate and cost constraints.
      • Victim system: a language model served via a standard chat API (which the authors call LLM-as-Service).
  2. What related research exists?

    The authors position this work as adaptive extraction that requires no annotation and targets production APIs.

    The authors position this work as adaptive extraction that requires no annotation and targets production APIs.

    Multi-turn attacks

    • Structural: Crescendo (Russinovich et al., 2024) and Chain of Attack (Yang et al., 2024) advance context along semantics; PANDORA (Chen et al., 2024) splits queries into benign subrequests; ActorAttack (Ren et al., 2025) builds fictional relationship networks; MUSE (Yan et al., 2025) does MCTS on semantic trajectories.
    • Persuasion: FITD (Wang et al., 2024b) uses stepwise commitment, RACE (Ying et al., 2025) frames harmful content as logical questions. The authors say this distinction corresponds to H1–H14, and claim 40% higher than single-turn on defended models; the numbers come from Related Work, and the paper provides no corresponding table.

    Self-evolving attacks

    • Strategy discovery: SEAttack (Liu et al., 2026) evolves mutation prompts, SEAS (Diao et al., 2025) optimizes adversarial safety testing, AutoDAN-Turbo (Liu et al., 2025) uses separate strategy, evaluation, and memory components for lifelong jailbreak discovery.
    • Author comparison: Only an explicit comparison against AutoDAN-Turbo. The authors say JustAsk uses a single code agent to orchestrate the ranking, thinking, generation, multi-turn calling, verification, and evolution in Figure 2, to tighten feedback and unify state.

    Prompt extraction and defenses

    • Extraction methods: Zhang et al. (2024a) reverse-engineer prompts from outputs; LeakAgent (Nie et al., 2025) uses RL to learn strategies, which the authors criticize for relying on static data, not considering safety-aware defenses, and training on only 87 benign prompts; PLeak (Hui et al., 2024) and Raccoon (Wang et al., 2024a) compare attacks in controlled settings.
    • Defenses: Prompt instructions prohibiting disclosure, and methods like ProxyPrompt (Zhuang et al., 2025) that rewrite prompts, preserve functionality, and hide the original text. The authors say this work needs no annotated data and targets production deployment rather than controlled benchmarks.

    Alignment, baselines, and setup

    • Principles: Askell et al. (2021) HHH and Bai et al. (2022) Constitutional AI. The authors say harmless, helpful, and honest are 96%, 91%, and 89% respectively in their analysis.
    • Baseline methods: PLeak optimizes queries on a proxy model, Raccoon replays handcrafted templates, and Zhang et al. train a neural inversion model. The setup is a known ground-truth prompt of 1,168 tokens, with models DeepSeek V3, Gemini Flash, Claude Sonnet 4, GPT-4o, budget B=3, and metric Sim-GT. Production comparisons also include Gemini CLI, Codex CLI, Cursor Agent CLI, Perplexity Sonar, and Copilot CLI.

    The authors' positioning: UCB selection over fixed skills replaces static templates or annotated training, with the main target being production chat APIs.

  3. How does the paper address this problem?

    JustAsk selects online among a fixed set of 28 skills using UCB and judges success by a consistency score ≥0.7.

    JustAsk frames extraction as black-box online exploration: 28 skills are fixed, and what is updated online is the per-target selection policy.

    Closed Loop

    • Components (Figure 2): UCB ranking, Interleaved Thinking, skill generation, multi-turn interaction, consistency verification, and skill evolution. The authors describe the orange blocks as agent components and the gray blocks as tool components.
    • Learning signal: It reflects extraction results and updates selection, without updating gradients (verbal RL, Shinn et al., 2023). Consistency is the external reward, and the UCB bonus is the internal motivation. The skill space is analogous to the discrete skill variable in skill-conditioned policies.
    • What is not learned: The authors emphasize that the skill table is fixed during an activity and is manually designed; self-evolving refers to per-target selection adaptation, not skill mutation.

    Skill Space

    • Hierarchy: L1–L14 are single-turn atomic actions, and H1–H14 orchestrate multi-turn sequences (the low-level/high-level terminology of Park & Levine, 2024).
    • Mechanism: Citing Wei et al. (2023), the authors divide skills into structural (mismatched generalization: unusual formats or framings not trained to be refused) and persuasive (competing objectives: helpfulness conflicting with safety constraints).
    • Entries: Low-level structural skills are Roleplay, Formatting, Obfuscation, Translation, Continuation, and Framing; persuasive skills are Authority, Evidence, Scarcity, Social Proof, Unity, Reciprocity, Liking, and Introspection. High-level skills are Confirmation, Completion, Format Pivot, Distraction, Semantic Progression, Actor Network, Reframe, as well as FITD, Low Ball, Bait & Switch, Self-Reference, DITF, That's Not All, and Role Escalation. Appendix A has the full prompts; example sentences are not reproduced here.
    • Scale: The authors state that 10 turns have at least 14×14^10≈4.0×10^12 possible sequences, hence UCB. Some names differ slightly between Table 1 and the appendix table (e.g., H7 is Reframe in Table 1 and Reformulation in the appendix); skill names follow Table 1.

    Selection and Update

    The selection score is UCB(s)=r̄s+c√(ln N/ns). r̄_s is the empirical success rate of skill s, N is the total number of attempts, n_s is the number of times that skill was used, and c is the balancing coefficient. Under-tried skills receive a bonus proportional to their uncertainty.

    Algorithm 1 in Appendix B: initialize n_s=0, r̄_s=0; within the budget, select the one with the highest UCB, execute it, observe o∈{0,1}, and update with the incremental mean; return on success, otherwise declare failure when the budget is exhausted. The 41-model experiment uses c=√2 and B=20, estimated with uniform initialization. Multi-turn mode uses API-native sessions to maintain state.

    Determination

    • Consistency: text-embedding-3-large (Appendix C: 3,072 dimensions) separately computes same-skill repetition and cross-skill similarity, and the score is the average of the two. The success threshold is ≥0.7.
    • Controlled metric: The cosine similarity between the extracted text and the true prompt is also used as Sim-GT. The authors state that the attacker cannot see the ground truth during extraction.
    • Threshold source: The authors state that 0.7 was determined empirically from the similarity distributions of successful and failed attempts; sensitivity is in Figure 6, with the numbers placed in the first experimental question.
  4. What experiments did the paper conduct?

    The authors report that all 41 black-box models were extracted successfully at consistency≥0.7, with closed-source models requiring an average of 4.8 rounds.

    Experimental Setup

    • Access: Targets via OpenRouter. Black-box 41: 12 closed-source API-only, 23 open-source available on HuggingFace, 6 community fine-tunes (Table 12). Case study Claude Code, which the authors state is powered by Claude Opus 4.5.
    • Other objects: Baselines are DeepSeek V3, Gemini Flash, Claude Sonnet 4, GPT-4o. Ablations on Claude Sonnet 4. End-to-end are DeepSeek V3, Mistral Large, Qwen 72B, Llama 4 Scout, MiniMax M2.7, Kimi K2.5. Defenses are GPT-5.2, Claude Opus 4.5, Gemini 3 Pro, Grok 4.1 Fast. Production systems are Gemini CLI, Codex CLI, Cursor Agent CLI, Perplexity Sonar, Copilot CLI.
    • Hyperparameters and metrics: c=√2. 41-model experiment B=20, skill estimates uniformly initialized. Baselines B=3, ablations B∈{3,5,10}, end-to-end B=5, production B=15. consistency is the average of same-skill and cross-skill similarity, embeddings text-embedding-3-large; success line ≥0.7. When ground truth exists, report Sim-GT.
    • Control variants: PLeak, Raccoon, Zhang et al.; within the framework also Bare-Agent (direct request without skills), L14-Only, Random, JustAsk-Full, and Unguided without the skill framework.
    • Repeats and backbone: Table 7 is mean±SD over three seeds. For the 41 models, Table 8, Table 9, the paper does not report the number of repeats. The paper does not state the backbone model for JustAsk.
    • Table usability: Table 17's note states Self-C is recorded on 2 models, Cross-C on 32, missing as —. The transcribed table body does not match the note, columns may be misaligned, so we do not cite per-cell scores from that table.

    Main Results

    According to Table 3, summarized by weight availability, not per-model scores.

    | Category | Number of models | Average rounds | Main skills | | Closed-weight | 12 | 4.8 | H8+H4, L14+L7 | | Open-weight | 23 | 2.4 | L14, L7, H4 | | Fine-tunes | 6 | 1.3 | L14 | | Overall | 41 | 2.8 | 100% success |

    • The authors state that all 41 models achieve consistency≥0.7; closed-source average 4.8 rounds, fine-tunes 1.3 rounds, and state that difficulty correlates with commercial safety investment.
    • The authors state that 8 attributes require multi-round orchestration in the hardened tier, while the remaining 33 disclose on a single introspection. Figure 4 annotations: 85% succeed on first attempt, 7% need 2–3 attempts, 7% need 4+; initial attempts are all low-level skills; 86% succeed using only low-level, 14% escalate to high-level.
    • In the case study, a direct request obtains Claude Code's own instructions of 6,973 tokens. Table 13: five agents average 1,395 tokens, Avg-C 0.93. Main text 4.3 states GPT-5.2-codex uses H5 (Foot-in-the-Door), Appendix H states 11 rounds of H8 (Low Ball), Table 2 records H8 (11-turn). In Table 1, H5 is Semantic Prog., H8 is FITD, H9 is Low Ball; the same section writes L6 as Reciprocity, while Table 1 has L6 as Framing and L12 as Reciprocity.

    Comparison with Existing Methods

    According to Table 5, B=3, 1,168 token ground truth, metric Sim-GT. Columns are DeepSeek V3, Gemini Flash, Claude Sonnet 4, GPT-4o.

    | Method | DeepSeek | Gemini | Claude | GPT-4o | Drop | | PLeak | 0.766 | 0.551 | 0.722 | 0.454 | −41% | | Raccoon | 0.950 | 0.941 | 0.757 | 0.701 | −26% | | Zhang et al. | 0.461 | 0.548 | 0.673 | 0.360 | −22% | | JustAsk | 0.752 | 0.812 | 0.756 | 0.727 | −3% |

    • The authors state that static baselines degrade on harder targets, JustAsk drops only 3% from DeepSeek V3 to GPT-4o, and on GPT-4o it has the largest Sim-GT among the four methods (0.727). In the same table, Raccoon is higher than JustAsk on DeepSeek V3 (0.950), Gemini Flash (0.941), and Claude Sonnet 4 (0.757).
    • Table 8, B=15: JustAsk averages 0.703 across five systems, +Raccoon 0.724, Raccoon 0.606, PLeak 0.503, Zhang et al. 0.420. On Gemini CLI, JustAsk is 0.872, lower than Raccoon and +Raccoon's 0.919. The authors state that JustAsk alone is higher than each static baseline on 4 of the 5 systems.
    • The authors state that after seeding Raccoon templates into the skill pool, easy targets can match Raccoon and hard targets can exceed it; the paper does not separately list this variant's numbers on the four models in Table 5.

    Ablations and Defenses

    • Framework ablation (Table 6, Claude Sonnet 4, best Sim-GT): At B=3, JustAsk-Full is 0.756, lower than Bare-Agent's 0.801. At B=5, Bare-Agent 0.800, L14-Only 0.771, Random 0.757, JustAsk-Full 0.867. At B=10, Random and JustAsk-Full are 0.867 and 0.889, Bare-Agent remains 0.801. The authors state that gains come from adaptive selection, not simply more queries.
    • End-to-end (Table 7, B=5, three random seeds): Self-Evolving relative to Unguided: DeepSeek V3 +6.6%, Qwen 72B +18.4%, Llama 4 Scout +25.9%, MiniMax M2.7 +13.7%, Kimi K2.5 +5.8%; Mistral Large is −6.7% (0.52±0.08 vs 0.55±0.08). The authors state that 5 of 6 improve, average +10.6%, and that Llama 4 Scout's standard deviation goes from 0.150 to 0.014; in the table, the corresponding values are 0.15 and 0.01.
    • Defenses (Table 9): Four-model averages: None 0.719, Simple 0.676, Aware 0.587, aware relative to None is −18.4%. GPT-5.2 is −21.8%, Claude Opus 4.5 is −15.5%. Simple average drops 6.0%; Claude Opus 4.5's Simple (0.616) is higher than None (0.600). After aware, all four models have similarity above 0.5. The authors state that informed defenses are necessary but not sufficient.

    Other Ablations and Analyses

    • Figure 6 thresholds 0.70, 0.75, 0.80, 0.85, 0.90, 0.95 success rates: 100%, 90.2%, 73.2%, 46.3%, 4.9%, 0.0%.
    • Grok 4.1 Fast's semantic similarity to official prompts is 0.89; Figure 1's Explore control is 0.94.
    • Section 4.10: Pearson r=0.94 (p<0.001) between average consistency and ground-truth similarity.
    • Quality tiers of 46 extractions: verbatim 2% (only Grok), strong semantic 29%, weak semantic 68%. HHH: harmless 96%, helpful 91%, honest 89%; identity confusion 26.8% (11/41), persistent 6, partial 2, correctable 3 (Figure 5).
    • Table 4: illegal activities 83%, privacy/doxxing 78%, violence 63%, self-harm 48%, malware 46%, fraud 37%, CSAM 20%. The authors believe CSAM may be underreported due to terminology differences.
    • Figure 3's caption writes H1–H15 and labels H5 as Distraction and H9 as FITD; Table 1 has H4 as Distraction and H8 as FITD, with high-level ending at H14. The main text states L14 is used 67 times in total.
  5. What are some points that can be further explored?

    The authors state that extraction is mostly semantic paraphrase, consistency does not equal accuracy, and call for agent-level defenses.

    Limitations and future directions noted by the authors

    • Access (Section 5 Limitations): The target is accessed via OpenRouter.
    • Timing (same section): The extraction represents a snapshot from January 2026; providers may revise at any time.
    • Paraphrasing (same section): Most recovered content is semantic description rather than verbatim text; fidelity is limited by the model's willingness to paraphrase.
    • Metric meaning (same section): Without public ground truth, consistency measures whether multiple attempts agree, not accuracy; absolute fidelity is only checked on controlled sets.
    • Future work (Appendix L; Section 5 points to this appendix): The authors state that agentic defenses matching automated discovery capabilities are needed, including stateful safety evaluation over request sequences rather than single turns.

    Experimental coverage

    • Black-box: 41 models on OpenRouter, split into 12 closed-weight, 23 open-weight, 6 fine-tunes; per model B=20, c=√2, success line consistency≥0.7 (Section 4.1, Table 3, Table 12).
    • Case studies: Claude Code's general, bash, main, plan, explore (Table 13). 5 production systems, B=15 (Table 8).
    • Experiments with ground truth: 4 models, 1,168 token prompts, B=3 (Table 5); Claude Sonnet 4, B∈{3,5,10}, four variants (Table 6); 6 models, B=5, three seeds (Table 7); 4 models × none/simple/aware (Table 9).
    • Similarity uses text-embedding-3-large. Appendix K explains that ProxyPrompt was not used: it requires weights, embedding injection, and gradients, whereas the evaluation is a black-box API text system prompt.
    • The paper does not report the JustAsk backbone model, nor the number of repetitions for the 41-model main experiment, Table 8, and Table 9.
  6. Summarize the main content of the paper

    JustAsk uses curiosity-driven skill selection to extract system prompts; the authors report that all 41 models reached the success threshold.

    JustAsk is a system prompt extraction framework for black-box chat APIs that selects fixed skills online rather than rewriting them.

    • Problem: the authors believe autonomous interaction by code agents expands the attack surface, allowing hidden instructions encoding identity and safety rules to be recovered through conversation alone. Under direct questioning, Claude Code disclosed 6,973 tokens.
    • Approach: 14 single-turn skills plus 14 multi-turn orchestrations, selected per target via UCB; the reward is the average of same-skill and cross-skill similarity on text-embedding-3-large, with a threshold of 0.7. The attacker has no weights or internal state.
    • Coverage: all 41 commercial models reached the threshold (Table 3). Closed-weight averaged 4.8 rounds, open-weight 2.4 rounds, fine-tunes 1.3 rounds. In Figure 4, 86% of successful extractions used only low-level skills.
    • Comparison: with 1,168-token ground truth and B=3, JustAsk achieved Sim-GT 0.727 on GPT-4o with a Drop of −3%; Raccoon had a Drop of −26% but reached 0.950 on DeepSeek V3, higher than JustAsk's 0.752 (Table 5).
    • Defenses and content: across four models, the aware defense decreased from 0.719 to 0.587 (−18.4%), Simple decreased by 6.0% on average, and Claude Opus 4.5's Simple was higher than None (Table 9). The authors report HHH as 96%, 91%, 89%, and identity confusion as 26.8% (11/41).
    • Authors' conclusion: the authors believe prompt secrecy is not achievable with current technology, prompt-level informed defenses are necessary but not sufficient, and they hope for agentic defenses that match automated discovery. Without ground truth, consistency is not accuracy.

Related papers

Show 2 more papers
Read originalICML 2026