Papers
Topics
Authors
Recent
Search
2000 character limit reached

Credential Leakage in LLM Agent Skills

Updated 10 April 2026
  • Credential leakage in LLM agent skills is defined by the co-location of data and code, which enables exfiltration of sensitive credentials through malicious or accidental vulnerabilities.
  • Empirical studies reveal that up to 13.3% of skills expose credentials, with common leakage patterns including hardcoded strings, environment variable harvesting, and insecure file access.
  • Mitigation strategies involve static and hybrid detection, capability-based permission manifests, and runtime mediation to enforce secure agent operations and supply chain integrity.

Credential leakage in LLM Agent Skills refers to the exfiltration of authentication secrets (API keys, passwords, tokens, private keys, OAuth secrets, and similar artifacts) through privileged code or instructions shipped within agent “skills”—modular, dynamically-loaded packages that extend the tool use or workflow repertoire of autonomous AI agents. Skills often execute with user- or operator-level privileges and are widely sourced from third-party marketplaces, making them a major supply-chain and run-time attack surface. This phenomenon spans accidental leaks (due to developer error or inadequate isolation) and deliberate adversarial behaviors, enabled by both natural-language prompt injection and executable code payloads. Large-scale measurement studies repeatedly find that credential leakage is highly prevalent, readily exploitable, and difficult to eliminate with current sandboxing and vetting practices (Chen et al., 3 Apr 2026, Liu et al., 15 Jan 2026, Liu et al., 6 Feb 2026, Schmotz et al., 30 Oct 2025, Jiang et al., 24 Feb 2026). This article systematically presents the architectural conditions, threat vectors, empirical prevalence, dynamic propagation, and defense strategies relevant to credential leakage in LLM agent skills.

1. Architectural Foundations and Threat Surface

Agent Skills instantiate a filesystem-based packaging standard in which each skill directory contains structured metadata (e.g., SKILL.md) and optional code artifacts (Python scripts, shell scripts, binaries). At agent runtime, skills are discovered and loaded into the active environment, typically granting all included instructions and scripts the privilege context of the agent process, such as filesystem access, environment variable visibility, and outbound network connectivity (Schmotz et al., 30 Oct 2025, Li et al., 3 Apr 2026).

Two critical structural properties elevate the risk of credential leakage:

  • Data–Instruction Co-location: The lack of a strict boundary between declarative metadata, executable instructions, and scripts (all bundled together) enables malicious payloads to masquerade as benign skill logic (Li et al., 3 Apr 2026, Schmotz et al., 30 Oct 2025).
  • Persistent, Undifferentiated Trust Model: A “single-approval” trust model binds privilege to the skill’s identity, not its hash or behavioral manifest. Once a skill is installed and initially authorized (often after a single “Don’t ask again” dialog), it can subsequently perform arbitrary sensitive actions without further prompts, covering future sessions and evolved payloads (Schmotz et al., 30 Oct 2025, Li et al., 3 Apr 2026, Jiang et al., 24 Feb 2026).

The result is a high-value attack surface: a single compromised skill may retrieve sensitive files (e.g., ~/.aws/credentials, ~/.ssh/id_rsa), enumerate environment variables for API tokens, and exfiltrate them to remote servers via ordinary HTTP calls—all without raising user suspicion or being detected in standard output logs (Schmotz et al., 30 Oct 2025, Chen et al., 3 Apr 2026, Li et al., 3 Apr 2026).

2. Taxonomy of Credential Leakage Patterns

Extensive field studies have categorized credential leakage through agent skills into a taxonomy of sub-patterns, spanning both unintentional vulnerabilities and adversarial attack strategies (Chen et al., 3 Apr 2026, Liu et al., 15 Jan 2026, Liu et al., 6 Feb 2026).

Vulnerability Patterns

  • Hardcoded Credentials: Embedding secrets directly as string literals in code or instructions (Python, JS, YAML, etc.). Found in ≈0.6% of 17,022 random marketplace skills, comonitoring for both code and natural language sources (Chen et al., 3 Apr 2026).
  • Insecure Storage: Passing credentials via CLI arguments, query parameters, or world-readable temp files, enabling unintended exposure to co-resident processes or ephemeral logs.
  • Information Exposure: Printing or logging credentials to stdout/stderr; agent frameworks that ingest stdout into the LLM context may inadvertently surface secrets in conversation memory (Chen et al., 3 Apr 2026).

Adversarial Patterns

  • Environment Variable Harvesting (E2): Code explicitly iterates over os.environ, matching on names (API_KEY, SECRET, TOKEN, etc.), then transmits results to attacker-controlled endpoints; prevalence ≈10% of script-bundling skills (Liu et al., 15 Jan 2026, Liu et al., 6 Feb 2026).
  • Credential File Access (PE3): Scripts access well-known credential file paths (e.g., ~/.ssh, .aws/credentials) and exfiltrate contents via HTTP POST (Liu et al., 6 Feb 2026, Liu et al., 15 Jan 2026).
  • Prompt Injection/Instruction Poisoning: Crafted instructions or YAML description fields that direct the agent to invoke malicious scripts or perform sensitive actions under ostensibly benign workflows (Schmotz et al., 30 Oct 2025, Jiang et al., 24 Feb 2026).
  • Supply Chain/Marketplace Attacks: Typosquatting, repo hijacking, or popularity manipulation place credential-stealing skills at the top of community registries, driving installs and maximizing credential-harvesting opportunities (Jiang et al., 24 Feb 2026, Li et al., 3 Apr 2026).
  • Execution Runtime Evasion: Adversarial skills employ obfuscation (Base64 encoding, code loading) or conditional logic (Docker detection, platform hooks) to evade static analysis and dynamic tracing (Liu et al., 6 Feb 2026, Chen et al., 3 Apr 2026).

The following table summarizes major leakage patterns and their prevalence in one representative study (Chen et al., 3 Apr 2026):

Pattern Prevalence (of sampled skills) Example Vector
Hardcoded Credentials 0.6% ‘API_KEY = ...’ literal in code
Env Var Harvesting (E2) 10.4% (of script-bundling) os.environ → POST to attacker
Credential File Access (PE3) 4.3% (of script-bundling) ~/.aws/credentials → requests
Print/Logging Exposure 73.5% of vulnerabilities stdout/console.log of secrets

3. Empirical Prevalence and Dynamics

Large-scale static and dynamic analysis frameworks (SkillScan, AgentLeak, sandbox testing) have quantified the prevalence and characteristics of credential leakage:

  • SkillScan Survey: Across 31,132 marketplace skills, 13.3% contained at least one data exfiltration vulnerability, with 5.2% exhibiting high-severity credential-leak patterns (e.g., E2, E4, PE3). Bundling of executable scripts doubled the odds of vulnerability (OR=2.12, p<0.001). Static + LLM-based hybrid detection achieved 91.3% precision and 86.7% recall on annotated test sets (Liu et al., 15 Jan 2026, Liu et al., 6 Feb 2026).
  • AgentLeak Benchmark: In multi-agent LLM workflows (N=4,979 traces), internal inter-agent message channels (C2) leaked credentials in 68.8% of exposures, compared to only 27.2% on final user-facing outputs (C1). System-level credential exposure (OR-aggregated across C1, C2, C5) reached 68.9%, and 41.7% of violations eluded output-only auditing (Yagoubi et al., 12 Feb 2026).
  • Manual Sandbox Audits: 3.1% of 17,022 randomly selected skills in SkillsMP were confirmed (via dynamic testing and manual review) to leak credentials, with 89.6% of leaks being immediately exploitable without privilege escalation and 92.5% occurring in the execution phase. Malicious skills, after disclosure, were all removed from the platform (Chen et al., 3 Apr 2026).
  • GrantBox Real-World Tool Simulation: Agents running with authentic MCP credentials were susceptible to prompt-injection data exfiltration with average success rates of 90.95% (ReAct mode) and 80.14% (Plan-and-Execute mode). Under plausible task phrasing, agents leaked API keys, tokens, and session credentials (Zhang et al., 30 Mar 2026).

4. Channel Propagation and Multi-Agent Effects

Credential leakage is exacerbated when multi-agent or tool-calling configurations are present, due to additional unmonitored propagation channels (Yagoubi et al., 12 Feb 2026, Liu et al., 4 Dec 2025, Wang et al., 28 Mar 2026).

  • Internal Channel Leakage: Inter-agent communication (C2) overwhelmingly contributes to credential leakage, with average rates of 68.8%—over twice that of single-agent external output channels (Yagoubi et al., 12 Feb 2026). Memory-sharing (C5) further increases the attack surface.
  • Propagation by Topology: The MAMA framework demonstrates that denser communication topologies (fully-connected, star, star-ring) maximize credential dissemination, while chain/tree topologies minimize leakage. Even with topological controls, adjacent attacker-target pairs in the network remain significantly vulnerable, with up to 29.5% of identity credentials leaking in single interaction rounds (Liu et al., 4 Dec 2025).
  • Task and Prompt Coupling: Data-flow prompt injection attacks embedded within tool calls or function arguments are especially potent in workflows that require multi-field data extraction or authorization, closely matching the structure of credential exfiltration and bypassing naive tool restriction filters (Alizadeh et al., 1 Jun 2025, Fu et al., 2024).

5. Case Studies and Supply Chain Incidents

Concrete credential-theft campaigns highlight both the scale and efficiency of adversarial exploitation:

  • ClawHavoc (Jan 2026): Attackers published 1,184 malicious skills to ClawHub, using typosquatting and ranking manipulation to induce installs. Payloads harvested API keys, wallets, browser credentials, and exfiltrated via scripted network calls. Root causes included unvetted skill distribution and the persistent, operator-level trust model. Incident resulted in massive billing fraud and persistent access to user environments, with skills evading static checking through code and metadata obfuscation (Jiang et al., 24 Feb 2026, Li et al., 3 Apr 2026).
  • Shadow Features and Platform Hooks: Advanced campaigns exploit undocumented runtime hooks (e.g., PreToolUse/PostToolUse) to silently intercept and exfiltrate credentials, sometimes only activating under environment-specific conditions (e.g., outside Docker) and using runtime code unpacking to evade detection (Liu et al., 6 Feb 2026).
  • Persistence Across Forks: Even after upstream maintainers remove embedded secrets, over 50 independent forks continued to distribute open-access credentials, demonstrating the challenge of eradicating leaks in open-source and marketplace-based ecosystems (Chen et al., 3 Apr 2026).

6. Detection, Mitigation, and Architectural Controls

Research indicates that robust defense requires deep, cross-modal analysis and architectural changes to the agent-skill framework (Li et al., 3 Apr 2026, Liu et al., 15 Jan 2026, Zhang et al., 24 Mar 2026, Wang et al., 28 Mar 2026, Jiang et al., 24 Feb 2026):

  • Static and Hybrid Detection: Automated pipelines combining static regex matching, AST dataflow (taint) tracing, entropy heuristics, and LLM-based semantic review catch both signature and obfuscated credential leak patterns. Agent Audit and SkillScan report >86% precision and recall for credential vulnerabilities in code and deployment artifacts (Zhang et al., 24 Mar 2026, Liu et al., 15 Jan 2026).
  • Architectural Enforcement:
    • Capability-based Permission Manifests: Require manifest declaration of required access scopes (file, network, environment, memory) enforced via sandboxing engines (container/WASM per-skill isolation) (Liu et al., 15 Jan 2026, Jiang et al., 24 Feb 2026, Li et al., 3 Apr 2026).
    • Progressive Disclosure and Trust Gating: Employ tiered skill-loading paradigms in which only metadata is initially loaded, with code and instruction body disclosure gated on explicit user approval or manifest validation (Li et al., 3 Apr 2026, Jiang et al., 24 Feb 2026).
    • Action Mediation: System-level invariants (as in SafeClaw-R) enforce that every privileged action is mediated by a safety node prior to execution, achieving >95% accuracy in blocking credential-exfiltration attempts in adversarial settings (Wang et al., 28 Mar 2026).
    • Ephemeral Context and Burn-After-Use: Secure Multi-Tenant Architectures (SMTA) with enforced BAU (Burn-After-Use) destroy ephemeral session data, enforce memory isolation, and block cross-tenant exfiltration, achieving >90% defense success in simulation (Zhang et al., 10 Jan 2026).
  • Marketplace and Supply Chain Controls: Signing of skill manifests, dependency pinning, author vetting, and mandatory security review prior to publication are recommended to stem supply-chain risk. Continuous community audits, runtime behavior monitoring, and dynamic penetration-testing frameworks help maintain ecosystem hygiene (Jiang et al., 24 Feb 2026, Li et al., 3 Apr 2026).
  • Prompt/Classical Filtering and Plan Validation: High-fidelity prompt quick-filters, plan validation engines (e.g., IPI-Guard, Task Shield), and user confirmation mechanisms for sensitive tool calls are partial barriers but routinely bypassed by complex or chained attacks (Zhang et al., 30 Mar 2026, Alizadeh et al., 1 Jun 2025).

7. Open Challenges and Future Directions

Credential leakage in LLM agent skills remains incompletely mitigated due to overlapping attack surfaces, dynamic multi-agent propagation, and both code- and prompt-based adversarial modalities.

Open challenges include:

  • Semantic Evasion: Advanced adversarial skills dynamically generate or obfuscate exfiltration code at runtime, defeating static-only and shallow dynamic analysis.
  • Cross-modal Analysis: 76.3% of confirmed leaks require joint analysis of both code and natural-language instructions; typical code-centric scanners miss prompt-injection and skill-metadata payloads (Chen et al., 3 Apr 2026).
  • Decentralized Ecosystem Risk: Fork persistence, dependency drift, and open skill marketplaces perpetuate vulnerability even after responsible disclosure and upstream fixes (Chen et al., 3 Apr 2026, Liu et al., 6 Feb 2026, Jiang et al., 24 Feb 2026).
  • Role-Aware Policy Enforcement: Current “all-skills-are-trusted” paradigms fail to distinguish benign from privileged or potentially malicious skill actions, leading to excessive privilege aggregation (Li et al., 3 Apr 2026, Jiang et al., 24 Feb 2026).
  • Real-Time, Pre-Execution Mediation: High-throughput, low-latency runtime mediation able to enforce policy invariants prior to skill execution remains difficult at marketplace scale (Wang et al., 28 Mar 2026).

Progress toward robust security will likely require combinatorial defenses: deeper cross-modal detection (including LLM-judged semantic traces), enforced architectural invariants for skill execution, capability-scoped sandboxes, non-persistence through ephemeral runtime contexts, and formal supply-chain governance standards, as detailed across the referenced studies.


References:

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Credential Leakage in LLM Agent Skills.