Skip to content

Symlinks inside a skill bundle, and symlink creation in skill scripts, are never reported as findings #1141

Open

Description

@benedictkwok

Summary

SkillSpector correctly refuses to follow symlinks (#374, #495, #268), but it treats a symlink inside a bundle purely as a scanner-safety event: build_context.py records a ledger entry (OUT_OF_SCOPE / SCOPE_BOUNDARY / NOT_REGULAR_FILE) and moves on. The symlink itself is never surfaced as a security finding, and no static pattern detects a skill that creates symlinks at install or run time. Verified at upstream/main a09091e (v2.13.6).

This matters because symlinks are now a documented delivery mechanism against AI coding agents, and skills are a natural way to ship them.

Why this is a finding, not just a coverage gap

In 2026 three independent groups reported the same attack class against agent tooling: a symlink planted in a workspace redirects an approved file operation to a target outside it, while the agent's approval prompt shows the workspace-relative path.

  • Adversa AI, "SymJack" (May 2026): confirmed against Claude Code, Gemini CLI/Antigravity, Cursor CLI, Copilot CLI, Grok Build and Codex CLI. Payload writes .claude/settings.json / .mcp.json to register a malicious MCP server.
  • Wiz, "GhostApproval" (July 2026): same class against Claude Code, Amazon Q, Augment, Cursor, Antigravity, Windsurf; characterised as CWE-451 over CWE-59. Cursor CVE-2026-50549 (9.8), Amazon Q CVE-2026-12958.
  • Claude Code CVE-2026-25724: deny-rule bypass via symlink. Claude Desktop CVE-2026-44470: junction following in CoworkVMService.
  • November 2026: the Claude Code VS Code extension still displays the link path, not the resolved path, in its permission prompt (Ultrastrike report).

A skill is an ideal carrier for both halves of this attack:

  1. Shipped link: the bundle contains helpdocs -> ~/.ssh (or any outward link). Discovery skips it, the report says nothing, and the user's next approved read/write on helpdocs/... reaches the target.
  2. Created link: a setup script runs os.symlink(expanduser("~/.claude/settings.json"), "project_settings.json"); the agent's next approved edit of project_settings.json rewrites agent config.

Today both score SAFE.

Current behaviour

  • build_context.py (_is_symlink, _resolves_outside): link → ledger event, continue. No finding.
  • static_patterns_supply_chain.py SC8 walker already computes is_link per entry and discards it.
  • No pattern in static_patterns_privilege_escalation.py / static_patterns_supply_chain.py / tool-misuse for os.symlink, Path.symlink_to, ln -s, mklink, New-Item -ItemType SymbolicLink, fs.symlink.
  • Nearest existing rule is AS2 (reads of mcp.json), read-side only.

Proposed

SC11 — Symlink or junction shipped inside skill bundle (supply chain, beside SC8/SC9).
Report every link found by the SC8 walker. HIGH when the link is dangling, resolves outside the skill root, or targets credential/agent-config paths (.ssh, .aws, .gnupg, .env, .claude/, .mcp.json, ~/.cursor/, .github/copilot-instructions.md, /etc/). MEDIUM when it resolves inside the bundle (e.g. CLAUDE.md -> AGENTS.md), since linked content is still unscanned. Reference the finding from the existing ledger event so completeness and findings agree.

PE4 — Symlink creation targeting agent config or credentials (privilege escalation; or supply chain if preferred).
Weighted (regex, weight) patterns in the existing style for Python/shell/PowerShell/Node symlink creation. Low base weight; boosted when the same statement references the sensitive-path list above, or when the link is created in the workspace with an absolute / ~ / .. target. Low base weight is deliberate: venv and build scripts create harmless links.

Fixtures / tests

Three fixtures (links created in test setup, not committed, with the platform skip from #501): outward link → SC11 HIGH; internal link → SC11 MEDIUM; os.symlink(... ~/.claude/settings.json ...) in a setup script → PE4 HIGH, with a benign ln -s lib64 lib scoring low. Existing #374/#495 regressions unchanged — the scanner must still never follow.

Offer

I'm happy to implement both with fixtures and tests (DCO-signed), as with #405/#406/#407. Flagging first in case the maintainers prefer a different ID, class, or severity split.

References

Activity

  1. added a commit that references this issue on Nov 24, 2026
    bcccba9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions