Skip to content

scan: a skill's scripts are never read, and the report does not say so #360

Done

Description

@blitzcrieg1

agentmetry scan <folder> reads a skill's text and none of the code the skill tells the agent to run. A clean result therefore covers the half of a skill an attacker is least likely to use.

How it showed up

On 2026-10-31 I scanned Cloudflare's security-audit-skill (commit c1c8a8c, about 55k stars) before considering installing it:

agentmetry scan .../skills/security-audit
  no findings in 15 items scanned
  No findings means these checks found nothing. It does not mean safe.

The 15 items are its 15 markdown files. The folder also holds two Node scripts, validate-findings.cjs (29 KB) and validate-coverage-ledger.cjs (34 KB), which SKILL.md tells the agent to run. scan did not open them, and its output does not say so. I read them by hand: they load only fs, path and util, with no child processes, network, eval, environment reads or writes. So this skill is fine; the gap is the point.

Why

core/scanner/scan.py selects files by name: TEXT_SUFFIXES = (".md", ".mdc", ".txt"), the instruction-file names in TEXT_NAMES, and .json files that parse as a tools/list. Everything else in the folder is skipped silently, including .js, .cjs, .mjs, .py, .sh and .ps1.

A malicious skill would put its payload exactly there: clean, helpful markdown that tells the agent to "run the validator", and a validator that reads ~/.ssh or fetches a second stage. scan would report no findings.

Two levels of fix

  1. Say what was not read. Count the files skipped by type and print them beside the result, for example 2 script files not read (.cjs). Without this the output overstates what was checked, which is the thing the "does not mean safe" line exists to prevent. Small, and arguably a correctness fix to the report rather than a feature.
  2. Check the scripts. A first pass needs no interpreter: flag imports or calls that reach the network, spawn processes, read credential paths, or decode and execute (child_process, subprocess, fetch/http, eval/new Function, base64 into exec, reads under ~/.ssh, ~/.aws, .env). The command classifier in detection/traits.py already knows much of this for shell; whether to reuse it is a design question, since that file is frozen.

Status

Not started. scan.py is not a ruleset fingerprint input, so neither level restarts the dogfood clock. Level 2 is new behaviour and waits for a restart trigger under the maintenance-only rule; level 1 could be argued either way and is the maintainer's call.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions