Back to skill

Security audit

Recursive Self Improvement

Security checks for vulnerabilities and agentic risk

Overview

This skill should be reviewed carefully because it directs an agent to recursively modify and optimize code without clear limits, approvals, or rollback controls.

Install only in a version-controlled, backed-up, isolated project where you are comfortable with agent-driven code changes. Require explicit file scope, review every proposed patch and version change, and stop recursive optimization unless you have clear budgets, rollback checkpoints, and acceptance criteria.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:10
Finding

Unbounded Autonomous Code-Modification and Recursion Workflow

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:10-40, SKILL.md:175-188, and references/workflows.md:24-53
Vulnerability Type: Uncontrolled autonomous modification workflow
Risk Level: Medium

Relevant Skill Instructions

The following is a faithful English translation of the relevant instructions in SKILL.md:10-40:

text
The system has two basic operating modes and switches between them
automatically according to system state.

Repair mode:
1. Identify the error, including its type, location, and impact.
2. Analyze the root cause.
3. Design a repair.
4. Change the code or logic.
5. Run unit tests.
6. Run integration tests.
7. If validation succeeds, mark the issue repaired; otherwise, return to step 1.

Optimization mode:
1. Collect performance metrics.
2. Analyze code complexity.
3. Design a refactoring plan.
4. Create a migration plan.
5. Implement the plan incrementally.
6. Run regression tests.
7. Compare metrics.
8. If performance improves, mark the system optimized; otherwise, retain
   the original state.

The following is a faithful English translation of SKILL.md:175-188:

text
The system automatically manages versions.

Version format: vN.M

Upgrade conditions:
- Complete N optimization rounds.
- Accumulate at least 10 improvements.
- Remain stable for 24 hours.

The recursive behavior is specified in references/workflows.md:51-53:

text
Phase 3: Recursive invocation

Successful validation → recursively invoke the workflow and return to Phase 1.

Technical Analysis

The Skill authorizes automatic mode selection, source-code or logic changes, incremental refactoring, version management, and recursive reinvocation. However, it does not define:

  • Allowed repository paths or an explicit write scope.
  • Protected files that the agent must not modify.
  • Human approval before changes are written.
  • A maximum numb ...[truncated 2845 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit scope

    • Require the user to specify permitted files or directories.
    • Deny writes outside that allowlist.
    • Treat credentials, access-control code, CI/CD files, deployment definitions, dependency manifests, lockfiles, and security policies as protected unless separately authorized.
  2. Add approval gates

    • Generate a proposed patch before writing.
    • Present the affected files, rationale, risk, and expected behavior.
    • Require explicit user approval before applying each patch or logically grouped change set.
    • Require separate approval for version changes.
  3. Bound recursive execution

    • Define a maximum number of repair and optimization rounds.
    • Add wall-clock, command, token, and compute budgets.
    • Stop after a configurable number of repeated validation failures.
    • Require user confirmation before another round begins.
  4. Constrain change size

    • Limit the number of modified files and lines per round.
    • Reject unexpected binary-file changes.
    • Prevent generated files or vendored code from being modified unless explicitly included in scope.
  5. Implement rollback safeguards

    • Require a clean version-control state before execution.
    • Create a checkpoint before each modification.
    • Automatically restore the checkpoint if tests fail, metrics regress, or the execution budget is exceeded.
    • Verify that rollback completed successfully.
  6. Strengthen validation

    • Run tests in an isolated environment with least privilege.
    • Define objective acceptance criteria before changes begin.
    • Require security tests for modifications affecting authentication, authorization, input handling, cryptography, dependencies, or deployment.
    • Preserve logs and diffs for review.
  7. Define deterministic termination

    • End after one successful, user-approved repair by default.
    • Permit o ...[truncated 146 chars]
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly describes autonomous error fixing, code/logic changes, and self-optimization, but the description does not warn users that it may modify system behavior or code automatically. In a self-improving skill, lack of clear disclosure can lead users to invoke it without informed consent, increasing the chance of unintended or unsafe changes to the target system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The version management section states that the system automatically manages versions and upgrades after optimization milestones, but it does not warn that these upgrades may introduce system-affecting changes. In the context of recursive self-improvement, automatic version progression can normalize unreviewed changes and conceal operational risk if users are not explicitly alerted.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents all usage examples and operational descriptions exclusively in Chinese. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

标题和全文均以中文编写,但未说明这是面向特定中文环境的限定文档,也未提供用户可选择语言的说明。根据语言/地区策略,若技能内容默认强制单一语言且没有用户选择或明确合理性说明,可构成自然语言策略问题。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The optimization trigger conditions are vague and subjective, such as 'stable performance' or 'can further evolve', without explicit thresholds, guardrails, or authorization gates. In a recursive self-improvement skill, ambiguous triggers can cause unnecessary or repeated self-modification, increasing the risk of unsafe changes, resource exhaustion, or drift from intended behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire skill description and instructions are presented in Chinese, with no indication that users may choose another language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale constraint is documented and justified, which it is not here.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.