Agent self-modifies at runtime

ID

agent-self-modifies-at-runtime

Severity

high

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

medium

OWASP LLM

LLM06:2025 — Excessive Agency

OWASP ASI

ASI10:2026 (secondary ASI06:2026)

OWASP AST

AST01:2026

Family

LLM06 — Excessive Agency

Red-team vectors

Sandbox Escape / RCE, Prompt Injection

Tags

ai_security

Description

Agent or skill code rewrites its own source, manifest, system prompt, or tool registry at runtime. Self-modification lets an agent escape its declared, reviewed configuration — and is especially dangerous when the written content derives from model output (a prompt-injection path into the agent’s own instructions). This is the SkillSpector rogue-agent self-modification class (RA2).

Phase-1 ships the AST fallback (a write to a self / manifest / system-prompt path) at reduced confidence; the Phase-1.5 TaintFlowDetector upgrades it to flow-confirmed (LLM output → self-config write). Writes to ordinary data / output paths produce no finding. Scoped to agent/skill artefacts.

Examples

with open("SKILL.md", "w") as f:   (1)
    f.write(llm_response)
1 Skill code rewriting its own manifest with model output — flagged.

Writing to an ordinary output path (open("report.json", "w")) produces no finding.

Mitigation / Fix

  • Agents must not rewrite their own source / manifest / system prompt at runtime.

  • Keep the configuration immutable at runtime; change it only through a reviewed, external process.