Back to skill

Security audit

Agent 整体瘦身师

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marked this skill suspicious because it reports a bearer-token redirect exposure and other security and verification concerns, with some analysis incomplete.

Consider the suspicious verdict before installing. The reported redirect and diagnostic-output risks could expose credentials or sensitive details, and analysis was partial, so the available scan evidence cannot rule out additional issues.

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

Error
Location
scripts/mcp_probe.py
Finding

Authenticated HTTP redirects can disclose the bearer token to another origin

Content
View full analysis

Impact

The redirect recipient receives the bearer token and can potentially use its permissions against the intended service. Credential transmission occurs before JSON-RPC response validation, so a failed probe does not prevent disclosure.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (50)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied code's primary function is image generation. It does not inspect or compress agent content, measure token savings, or implement rollback. Although the icons could serve as ancillary branding for the skill, this chunk implements a separate asset-generation utility rather than the declared functionality. No network access, sensitive-data access, or malicious behavior is evident.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied script's primary purpose is release packaging, not agent optimization. Its ZIP compression compresses distribution files rather than reducing agent token usage. It contains no implementation for optimizing rules or memory, measuring token savings, or rolling back optimization changes. Although it could be an ancillary build utility in a larger project, the supplied chunk does not implement the declared behavior. No network access or malicious behavior is evident.

Content

No source excerpt is available for this finding.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
python3 scripts/agent_slim.py host --home <agent-home> [--layout layout.json] --output host.json

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

md
python3 scripts/agent_slim.py audit --home <agent-home> [--layout layout.json] --json --output audit.json

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 64)May include surrounding context.

md
python3 scripts/agent_slim.py plan --audit audit.json --output plan.json

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 65)May include surrounding context.

md
python3 scripts/agent_slim.py apply --plan plan.json # dry-run

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
python3 scripts/agent_slim.py apply --plan plan.json --apply # 显式事务

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

md
python3 scripts/agent_slim.py verify --plan plan.json --test-prompts prompts.json

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 68)May include surrounding context.

md
python3 scripts/agent_slim.py restore --manifest <transaction>/manifest.json --apply

MCP Config Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · references/case-workbuddy.md (reported line 118)May include surrounding context.

md
1. **先分清真注入与缓存**:`mcp-tool-list.json` 里可能几百个工具,其中大半属于未连接的 server,不进上下文。只统计真正注入的部分。
2. **按调用频次裁剪工具集**:GitHub 远程 MCP 支持 `X-MCP-Toolsets` / `X-MCP-Tools` header 限制暴露面,实测 46→21 工具。裁剪后必须对端点做一次 `initialize` + `tools/list` 验证,不能只看配置文件。
3. **插件缓存**:被新版本替代的旧版本、已 `enabled=false` 的市场包可以清;清之前先读注册表确认无引用,清之后同步 4 处注册记录。
4. **凭据**:`mcp.json` 权限收到 `600`。任何排查都不要把含 token 的文件整份打印到输出里。

### W6 验证与回滚

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/agent_slim_workflow.py (reported line 1322)May include surrounding context.

python
results.append({"id": case_id, "status": "UNKNOWN", "reason": "Command is empty."})
            any_unknown = True
            continue
        env = dict(os.environ)
        env["AGENT_SLIM_PROMPT"] = prompt
        env["AGENT_SLIM_CASE_ID"] = case_id
        expected = case.get("expect") if isinstance(case.get("expect"), dict) else {}

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/mcp_probe.py (reported line 103)May include surrounding context.

python
stderr=subprocess.PIPE,
            text=True,
            bufsize=1,
            env=os.environ.copy(),
        )
        self.timeout = timeout
        self.lines: "queue.Queue[Optional[str]]" = queue.Queue()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_layout.py (reported line 97)May include surrounding context.

python
self.assertFalse(report["host"]["layoutDescribed"])

    def test_path_escape_is_rejected(self):
        layout = self.write_layout({"hot": ["../../etc/passwd"]})
        result = self.run_audit("--layout", str(layout))
        self.assertEqual(result.returncode, 64)
        self.assertIn("LAYOUT_PATH_REJECTED", result.stderr)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · tests/test_workflow.py (reported line 164)May include surrounding context.

python
]
        }
        prompt_path.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
        return prompt_path

    def test_plan_dry_run_apply_verify_restore_roundtrip(self):
        baseline = file_state(self.home)

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, network, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · manifest.json (reported line 235)May include surrounding context.

json
"tests/fixtures/aging-agent/memories/memory_summary.md",
    "tests/fixtures/aging-agent/plugins/cache/test-market/plug-a/1.0.0/.app.json",
    "tests/fixtures/aging-agent/plugins/cache/test-market/plug-a/1.0.0/.mcp.json",
    "tests/fixtures/aging-agent/plugins/cache/test-market/plug-a/1.0.0/skills/plugin-skill/SKILL.md",
    "tests/fixtures/aging-agent/rules/conditional.md",
    "tests/fixtures/aging-agent/rules/duplicate-a.md",
    "tests/fixtures/aging-agent/rules/duplicate-b.md",

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · tests/fixtures/build_aging_agent_s4.py (reported line 106)May include surrounding context.

python
json.dumps({"apps": {"fixture-app": {"enabled": True}}}, ensure_ascii=False, indent=2) + "\n",
    )
    _write(
        root / "plugins/cache/fixture-market/active-helper/1.0.0/skills/plugin-skill/SKILL.md",
        "---\n"
        "name: plugin-skill\n"
        "description: Synthetic enabled plugin skill used to prove plugin inventory.\n"

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · manifest.json (reported line 244)May include surrounding context.

json
"tests/fixtures/aging-agent/sessions/2024/01/rollout-old.jsonl",
    "tests/fixtures/aging-agent/sessions/2026/01/rollout-recent.jsonl",
    "tests/fixtures/aging-agent/skills/.usage.json",
    "tests/fixtures/aging-agent/skills/alpha/SKILL.md",
    "tests/fixtures/aging-agent/skills/alpha/references/guide.md",
    "tests/fixtures/aging-agent/skills/alpha/templates/template.md",
    "tests/fixtures/aging-agent/skills/beta/SKILL.md",

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · tests/test_audit.py (reported line 159)May include surrounding context.

python
self.assertFalse(plugins["missing"]["discovered"])
        self.assertTrue(any(u["code"] == "SESSION_BODY_NOT_READ" for u in report["unknowns"]))

        alpha = self.find_item(report, "skills/alpha/SKILL.md")
        # The same evidence path has both hot metadata and warm body; pick the hot item explicitly.
        self.assertEqual(alpha["layer"], "hot")
        self.assertTrue(alpha["meta"]["recentUse"]["recorded"])

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · manifest.json (reported line 247)May include surrounding context.

json
"tests/fixtures/aging-agent/skills/alpha/SKILL.md",
    "tests/fixtures/aging-agent/skills/alpha/references/guide.md",
    "tests/fixtures/aging-agent/skills/alpha/templates/template.md",
    "tests/fixtures/aging-agent/skills/beta/SKILL.md",
    "tests/fixtures/aging-agent/skills/beta/packs/nested/pack.md",
    "tests/fixtures/aging-agent/skills/beta/references/huge.md",
    "tests/fixtures/aging-agent/skills/gamma/SKILL.md",

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · tests/test_audit.py (reported line 133)May include surrounding context.

python
self.assertTrue(any(item["category"] == "logs" for item in cold))
        self.assertTrue(any(item["category"] == "databases" for item in cold))

        beta_meta = self.find_item(report, "skills/beta/SKILL.md")
        self.assertEqual(beta_meta["layer"], "hot")
        self.assertGreater(beta_meta["chars"], 600)
        self.assertTrue(beta_meta["candidate"])

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · manifest.json (reported line 250)May include surrounding context.

json
"tests/fixtures/aging-agent/skills/beta/SKILL.md",
    "tests/fixtures/aging-agent/skills/beta/packs/nested/pack.md",
    "tests/fixtures/aging-agent/skills/beta/references/huge.md",
    "tests/fixtures/aging-agent/skills/gamma/SKILL.md",
    "tests/fixtures/aging-agent/skills/gamma/references/unreferenced.md",
    "tests/fixtures/aging-agent/state.db",
    "tests/fixtures/build_aging_agent_s4.py",

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/mcp-measure.md (reported line 35)May include surrounding context.

bash
# 先在当前 shell 设置 GITHUB_PAT_TOKEN,值不写进命令或日志
python3 scripts/mcp_probe.py \
  --http https://api.githubcopilot.com/mcp/ --name github --bearer-env GITHUB_PAT_TOKEN

已知禁用

Tainted flow: 'text' from os.environ.get (line 1647, credential/environment) → pathlib.Path.write_text (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/agent_slim.py (reported line 1653)May include surrounding context.

python
return
    path = Path(output).expanduser()
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text(text, encoding="utf-8")


def build_parser() -> CliParser:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent_slim_workflow.py (reported line 1330)May include surrounding context.

python
expected_text = expected.get("stdoutContains", case.get("stdoutContains"))
        timeout = int(case.get("timeoutSeconds") or DEFAULT_ACTION_TIMEOUT)
        try:
            completed = subprocess.run(
                argv,
                cwd=str(home),
                env=env,