Back to skill

Security audit

skill-deep-audit

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a legitimate skill auditor, but it needs Review because its read-only claims are inconsistent and its bundled checker can read outside the chosen target through symlinks.

Install only if you are comfortable with an auditor that reads the target skill folder and writes an AUDIT report into it by default. Use it on trusted or sandboxed skill copies, be cautious with untrusted archives that may contain symlinks or huge files, and require explicit confirmation before any fix mode edits.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/check_path_boundary.py:56
Finding

Symlink Following Allows Reads Outside the Audited Skill Boundary

Content
View full analysis

Vulnerability Details

File Location: scripts/check_path_boundary.py, lines 56–64
Vulnerability Type: Filesystem boundary violation through symlink traversal
Risk Level: Medium

Vulnerable Code

python
for f in sorted(skill_path.rglob("*")):
    if f.suffix not in EXTS or not f.is_file():
        continue
    if SKIP_DIRS & set(f.parts):
        continue
    try:
        lines = f.read_text(encoding="utf-8", errors="ignore").splitlines()
    except OSError as e:
        print(f"WARN: could not read, skipping: {f} - {e}", file=sys.stderr)
        continue

Technical Analysis

The scanner recursively enumerates files beneath the supplied skill directory but does not reject symbolic links. Both Path.is_file() and Path.read_text() follow symbolic links.

Consequently, an untrusted skill can contain a path such as scripts/external.py that is a symbolic link to a file outside the audited directory. The scanner will treat the link as an ordinary Python file and read its target using the auditor process's filesystem privileges.

The filename filter does not prevent exploitation because it evaluates the symlink's path suffix. A link named external.py can point to a target with any filename or extension. If the external content matches a path-chain expression recognized by the scanner, part of that content may also be included in a finding.

Attack Path

  1. An attacker prepares a skill directory containing a symbolic link named with a .py suffix.
  2. The link points to a file outside the supplied skill root that is readable by the auditing process.
  3. A user or Agent runs check_path_boundary.py against the malicious skill.
  4. rglob() discovers the symlink and is_file() follows it.
  5. read_text() reads the external target.
  6. Matching content may influence scan results or be partially printed in the finding output.

Impact Assessment

This violates the scan ...[truncated 629 chars]

Remediation
View remediation

Remediation Suggestions

Reject symbolic links and verify the resolved location of every candidate before opening it:

python
skill_path = skill_path.resolve()

for f in sorted(skill_path.rglob("*")):
    if f.is_symlink():
        continue
    if f.suffix not in EXTS or not f.is_file():
        continue

    try:
        resolved = f.resolve(strict=True)
        resolved.relative_to(skill_path)
    except (OSError, ValueError):
        print(
            f"ERROR: file escapes or cannot be resolved: {f}",
            file=sys.stderr,
        )
        scan_failed = True
        continue

    try:
        with resolved.open("r", encoding="utf-8", errors="ignore") as source:
            lines = source.read().splitlines()
    except OSError as e:
        print(f"ERROR: could not read: {resolved} - {e}", file=sys.stderr)
        scan_failed = True
        continue

In addition:

  • Treat detected symlinks as an explicit finding or inconclusive scan rather than silently following them.
  • Perform the containment check immediately before opening the file.
  • Where supported, use no-follow filesystem semantics to reduce time-of-check/time-of-use risk.
  • Run audits of untrusted packages in a sandbox whose filesystem view contains only the package and required runtime files.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check_path_boundary.py:61
Finding

File Read Errors Cause the Security Check to Fail Open

Content
View full analysis

Vulnerability Details

File Location: scripts/check_path_boundary.py, lines 61–64 and 124–137
Vulnerability Type: Incomplete scan reported as successful
Risk Level: Medium

Vulnerable Code

python
try:
    lines = f.read_text(encoding="utf-8", errors="ignore").splitlines()
except OSError as e:
    print(f"WARN: could not read, skipping: {f} - {e}", file=sys.stderr)
    continue
python
findings = scan(target)
if as_json:
    print(json.dumps({"err_count": len(findings), "findings": findings},
                     ensure_ascii=False, indent=2))
elif not findings:
    print("OK  D3-E5 (1): no parent-chain derivation escapes the skill boundary")
else:
    print(f"ERR D3-E5 (1): {len(findings)} parent chain(s) escape the skill boundary\n")
    for x in findings:
        print(f"  {x['file']}:{x['line']}  ({x['parents']} hops -> escapes)")
        print(f"    {x['code']}")
        print(f"    endpoint: {x['endpoint']}")
        print(f"    boundary: {x['skill_root']}\n")
return 1 if findings else 0

Technical Analysis

When a candidate Python file cannot be read, the scanner emits a warning and skips the file. The scan() function returns only confirmed findings and does not communicate that part of the input was not inspected.

The caller then interprets an empty findings list as a successful scan, prints an OK message, and returns exit code 0. JSON mode has the same semantic defect because it reports only err_count and findings, with no incomplete-scan status.

This is fail-open behavior in a security checker. A clean result means that no issue was found in the subset of files successfully read, not that the entire requested scope was verified.

Attack Path

  1. An attacker supplies a skill containing a relevant .py file that the auditor cannot read, such as a broken link, inaccessible target, or file that triggers an I/O error.
  2. The scanner dis ...[truncated 793 chars]
Remediation
View remediation

Remediation Suggestions

Return structured scan status containing both findings and errors, and use a distinct nonzero exit code for incomplete scans:

python
def scan(skill_path: Path):
    skill_path = skill_path.resolve()
    findings = []
    errors = []

    for f in sorted(skill_path.rglob("*")):
        if f.suffix not in EXTS or not f.is_file():
            continue
        try:
            lines = f.read_text(
                encoding="utf-8",
                errors="strict",
            ).splitlines()
        except (OSError, UnicodeError) as e:
            errors.append({
                "file": str(f),
                "error": str(e),
            })
            continue

        # Existing analysis logic goes here.

    return findings, errors
python
findings, errors = scan(target)

if as_json:
    print(json.dumps({
        "status": "incomplete" if errors else "complete",
        "err_count": len(findings),
        "scan_error_count": len(errors),
        "findings": findings,
        "scan_errors": errors,
    }, ensure_ascii=False, indent=2))
elif errors:
    print(
        f"INCONCLUSIVE: {len(errors)} candidate file(s) could not be scanned",
        file=sys.stderr,
    )
elif not findings:
    print("OK  D3-E5 (1): all candidate files scanned; no escape found")

if errors:
    return 2
return 1 if findings else 0

Document the exit-code contract clearly and ensure callers treat an incomplete scan as inconclusive or failed, never as passed.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check_path_boundary.py:56
Finding

Unbounded Whole-File Scanning Enables Local Resource Exhaustion

Content
View full analysis

Vulnerability Details

File Location: scripts/check_path_boundary.py, lines 56–61
Vulnerability Type: Uncontrolled resource consumption
Risk Level: Medium

Vulnerable Code

python
for f in sorted(skill_path.rglob("*")):
    if f.suffix not in EXTS or not f.is_file():
        continue
    if SKIP_DIRS & set(f.parts):
        continue
    try:
        lines = f.read_text(encoding="utf-8", errors="ignore").splitlines()

Technical Analysis

The scanner has no limit on directory entries, candidate file count, individual file size, total bytes, line length, or total execution time.

sorted(skill_path.rglob("*")) materializes and sorts the complete recursive traversal. For every selected Python file, read_text() then allocates a string containing the entire file, and splitlines() creates an additional list and line objects. Peak memory can therefore substantially exceed the raw input size.

Since the audited directory is potentially attacker-controlled, an attacker can package very large Python files or a very large number of files and force the auditing process to consume excessive memory and CPU.

Attack Path

  1. An attacker constructs a skill containing one oversized .py file, many Python files, extremely long lines, or a combination of these.
  2. A victim starts the audit using the bundled checker.
  3. The checker recursively materializes and sorts the directory traversal.
  4. Each candidate file is loaded completely into memory and split into a second in-memory representation.
  5. Resource consumption causes severe delay, memory exhaustion, process termination, or disruption of the hosting Agent.

Impact Assessment

Exploitation can deny availability of the audit process and may affect other workloads sharing the same Agent or container. It does not provide elevated filesystem or operating-system privileges, but it lets untrusted package contents consume resources beyo ...[truncated 222 chars]

Remediation
View remediation

Remediation Suggestions

Apply layered resource controls:

  1. Set configurable limits for:
    • Maximum number of traversed entries.
    • Maximum number of candidate files.
    • Maximum size of an individual file.
    • Maximum cumulative bytes scanned.
    • Maximum line length and scan duration.
  2. Reject or mark the scan inconclusive when a limit is exceeded.
  3. Iterate without sorting the full recursive result unless deterministic ordering is essential.
  4. Read files incrementally instead of calling read_text().splitlines().
  5. Run the checker with operating-system memory, CPU, and wall-clock limits.

Example bounded scanning pattern:

python
MAX_FILES = 10_000
MAX_FILE_BYTES = 5 * 1024 * 1024
MAX_TOTAL_BYTES = 100 * 1024 * 1024

file_count = 0
total_bytes = 0

for f in skill_path.rglob("*"):
    if f.suffix not in EXTS or not f.is_file() or f.is_symlink():
        continue

    size = f.stat().st_size
    file_count += 1
    total_bytes += size

    if file_count > MAX_FILES:
        raise RuntimeError("scan limit exceeded: too many Python files")
    if size > MAX_FILE_BYTES:
        raise RuntimeError(f"scan limit exceeded: oversized file: {f}")
    if total_bytes > MAX_TOTAL_BYTES:
        raise RuntimeError("scan limit exceeded: cumulative input too large")

    with f.open("r", encoding="utf-8", errors="ignore") as source:
        for lineno, line in enumerate(source, 1):
            if len(line) > 1_000_000:
                raise RuntimeError(f"scan limit exceeded: oversized line: {f}")
            # Analyze the current line incrementally.

Any limit violation should produce an explicit incomplete-scan result and a nonzero exit status rather than a clean audit outcome.

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (14)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The red-line statement says the audit 'never modifies its files,' but the workflow explicitly writes a report into the audited skill folder. Because this appears in the safety guarantees section, it can cause downstream automation, reviewers, or operators to treat the skill as non-mutating when it is in fact mutating the target directory, undermining trust boundaries and potentially violating policies for read-only analysis.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims a broad 7-dimension audit framework, scoring model, depth modes, and fix workflow, but the available implementation evidence does not support those claims. This can cause users to rely on incomplete or nonexistent checks, creating a false sense of security and potentially allowing unsafe skills to be approved or modified based on misleading audit results.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documentation says normal audits are read-only and must not modify audited files, but later mandates creating a report inside that same directory. This kind of self-contradiction is dangerous because downstream agents or users may trust the stricter statement and authorize execution in contexts where any write is unacceptable, causing unintended modification of user assets.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The auto-fix section instructs the agent to create backups and edit files, while its red lines simultaneously say not to execute any write operation. Contradictory safety rules are hazardous because implementations may follow the permissive path while operators rely on the restrictive one, leading to unauthorized file writes or broader policy bypass in fix mode.

Content

No source excerpt is available for this finding.

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 · references/check-rules.md (reported line 1030)May include surrounding context.

md
### D5-W3 Plaintext-credential scan in config files (3 pts, WARN, L1)

**Why**: D5-E1 only scans **script assignments** for plaintext credentials;
it does not scan config file content (config.json / .env / *.yaml).

**Decision**:
- Scan all `.json` / `.yaml` / `.yml` / `.env` / `.ini` / `.toml` files

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The README labels the audit as 'read-only' while also documenting that normal operation writes an AUDIT-{YYYY-MM-DD}.md file into the target skill directory. That contradiction is security-relevant because users or calling agents may rely on the read-only claim when choosing whether to run the tool on sensitive or immutable targets, leading to unintended filesystem modification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The invocation examples include broad natural-language phrases such as 'audit my-skill' and 'lint this skill,' which may overlap with ordinary conversation and cause unintended activation by an agent router. In this skill's context, accidental triggering is more dangerous because the tool recursively reads a skill directory and may perform L2 external checks or write a report artifact, creating unplanned data access or side effects.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

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.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description emphasizes read-only behavior without clearly warning that the optional fix workflow can modify user files and create backups. This omission can mislead users or calling agents into granting trust or invoking the skill under assumptions that do not hold once fix mode is entered, increasing the risk of unintended file changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill describes itself as read-only by default, yet its normal audit flow requires writing an AUDIT-*.md file into the audited skill directory. This contradiction can bypass user expectations and policy assumptions about non-mutating operation, especially in environments where touching target directories is sensitive or prohibited.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The activation examples include broad phrases such as "audit a skill", "check skill quality", and "lint my skill" without clear exclusion conditions or tighter context boundaries. In a manifest/markdown description, this can cause unintended invocation when users make general requests about skills rather than explicitly invoking this specific auditor.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/check-rules.md (reported line 172)May include surrounding context.

Typical mistake:

python
upload(file_path)
print("uploaded")  # ❌ no verification

Correct:

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/check-rules.md (reported line 1021)May include surrounding context.

md
**Decision logic**:
- The skill contains write-op commands (submit, upload, delete, etc.).
- The script has an interactive UI (`input()`, confirmation prompts) but
  no confirmation logic before the write op → **WARN**.

> Pure-automation scripts (no TTY) auto-skip this item.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file hard-codes supported trigger phrases in specific languages, especially English and Chinese, but does not state that language choice is configurable or user-selected. This can be interpreted as a language/locale policy issue because the skill defines language behavior without explicit opt-in or alternatives.

Content

No source excerpt is available for this finding.