Back to skill

Security audit

Agent Harness Doctor

Security checks for vulnerabilities and agentic risk

Overview

The skill is a plausible harness diagnostic and fixer, but it needs Review because its supposedly read-only diagnostic path can persistently change workspace and agent instruction files.

Install only if you are comfortable with a harness tool that can alter repository-level agent state. Avoid using fix_apply through harness_check unless you have reviewed the target workspace and are prepared for agent-progress.json to be created or overwritten and AGENTS.md to be changed. I found no evidence of credential theft, network exfiltration, remote code execution, or system-level persistence.

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
scripts/run.py:190
Finding

Read-Only Diagnostic Action Can Persistently Modify Workspace State and Agent Instructions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:9-22; scripts/run.py:151-181,190-201
Vulnerability Type: Permission mismatch and persistent agent-state modification
Risk Level: Medium

The harness_check tool is declared as read_only, but its optional fix_apply parameter causes the implementation to write files in the current workspace. These writes include creating persistent session state and modifying AGENTS.md, which can influence behavior in future agent sessions.

Relevant Code

Tool declaration in SKILL.md:9-22:

yaml
tools:
  - name: harness_check
    description: "Run full diagnostic on current agent harness. Returns scores, findings, and recommended actions."
    input_schema:
      type: object
      properties:
        fix_apply:
          type: array
          items:
            type: string
          description: "List of finding IDs to auto-fix (P0 only recommended)"
      required: []
    permission: read_only

Mutation triggered from the supposedly read-only action in scripts/run.py:190-201:

python
if action == "harness_check":
    result = run_diagnostic()
    # If fix_apply provided, apply those fixes automatically
    fix_ids = input_data.get("fix_apply", [])
    if fix_ids:
        applied = []
        for fid in fix_ids:
            res = apply_fix(fid)
            if "error" not in res:
                applied.append(fid)
            else:
                res["applied"] = False
        result["applied_fixes"] = applied

Persistent write sinks in scripts/run.py:151-181:

python
PROGRESS_FILE.write_text(json.dumps(template, indent=2))
return {"created": str(PROGRESS_FILE)}

def fix_startup_sequence():
    """Insert fixed startup sequence into AGENTS.md if missing"""
    if not AGENTS_FILE.exists():
        return {"error": "AGENTS.md not found"}
    content = AGENTS_FILE.read_text()
    if "## Sess
...[truncated 3996 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove fix_apply from harness_check and make that action strictly diagnostic.
  2. Require all mutations to use the separately declared apply_fix tool, whose danger_full_access permission can trigger an explicit approval flow.
  3. If combined checking and fixing is required, change the declared permission to accurately reflect write access and require affirmative confirmation before each mutation.
  4. Present the target path and a proposed diff before changing AGENTS.md or agent-progress.json.
  5. Create backups before replacing existing files, particularly AGENTS.md.
  6. Use atomic writes: create a temporary file in the same directory, flush and synchronize it, then replace the destination with os.replace.
  7. Prevent concurrent-update loss by checking file metadata or hashes before replacement.
  8. Validate that the resolved workspace and destination paths are within an explicitly authorized project root.
  9. Add tests asserting that every action declared read_only leaves the workspace byte-for-byte unchanged.
  10. Clearly document that fixes persist across sessions and identify every file that may be created or modified.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises tools with meaningful capabilities, including a dangerous write-capable operation (apply_fix with danger_full_access), but it does not declare a clear top-level tool scope such as permissions or allowed-tools. This weakens policy transparency and can cause users or enforcement layers to underestimate what the skill can access or modify, increasing the risk of unintended file changes in the workspace.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill supports auto-applying fixes that create or modify files such as agent-progress.json, AGENTS.md, and CLAUDE.md, but the user-facing description around invocation does not prominently warn that configuration files will be changed. This can lead to silent or poorly understood modifications of agent instructions and workspace state, which is especially sensitive because it alters control-flow and persistent behavior for future agent runs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill description says it "generates a prioritized improvement plan," which implies meaningful prioritization across the assessed dimensions. In practice, the code explicitly leaves P1 and P2 empty and only populates P0, so the implemented planning behavior is materially narrower than advertised.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest suggests the skill can auto-apply P0 fixes as part of its audit/remediation workflow. However, the code only implements fixes for creating agent-progress.json and editing AGENTS.md startup guidance, while other dimensions marked or described as high-priority have no corresponding auto-fix path.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated JSON template includes Chinese-language explanatory fields such as _说明 and Chinese descriptions, which imposes a specific language on downstream users without opt-in. This is a natural-language policy issue because the skill does not offer a language choice or justify a region-specific requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script can modify workspace files automatically during harness_check when fix_apply is supplied, without an interactive confirmation, dry-run default, or prominent warning. In an agent/tooling context, this increases the risk of unintended repository changes, workflow corruption, or policy bypass if another component passes fix IDs implicitly or maliciously.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.