Skip to content

Add ATR-derived skill manifest and MCP tool security rules#3842

Open
eeee2345 wants to merge 1 commit into
semgrep:developfrom
eeee2345:add-atr-skill-injection-rules
Open

Add ATR-derived skill manifest and MCP tool security rules#3842
eeee2345 wants to merge 1 commit into
semgrep:developfrom
eeee2345:add-atr-skill-injection-rules

Conversation

@eeee2345
Copy link
Copy Markdown

This PR adds five rules under ai/ai-best-practices targeting two attack surfaces that are not covered by the existing ai-best-practices rules: agent skill manifests (SKILL.md, AGENT.md, AGENTS.md) and MCP tool name typosquatting.

The four skill manifest rules use generic mode and run on *.md skill files. They detect prompt-injection markers in frontmatter descriptions, exfiltration directives in skill bodies, base64 or hex payload smuggling, and instructed access to credential files such as ~/.ssh/id_rsa, ~/.aws/credentials, .env, and browser cookie stores. The fifth rule uses Python pattern syntax to flag MCP tool functions whose names match typosquatted variants of filesystem, github, and database tools.

These complement, but do not duplicate, the existing mcp-tool-poisoning rule (which targets Python docstrings) and ai-config-hidden-unicode (which targets cursorrules and CLAUDE.md). Skill manifests are a distinct attack surface in the agent supply chain because they ship inside skill marketplaces and are loaded by agents at runtime.

The detection patterns are derived from the open Agent Threat Rules (ATR) detection standard at https://github.com/Agent-Threat-Rule/agent-threat-rules, which is licensed under Apache-2.0. ATR rule packs are shipped in production at Cisco AI Defense (skill-scanner) and Microsoft agent-governance-toolkit (PolicyEvaluator).

All five rules pass semgrep test and semgrep validate locally on Semgrep 1.157.0. Each rule directory contains a yaml rule and a corresponding test fixture with positive and negative cases. No existing rule IDs were modified or shadowed.

If the maintainers prefer a smaller initial drop, I can split this into two PRs (skill manifest rules and MCP tool name rule) or trim to the highest-confidence subset.

Add five rules under ai/ai-best-practices targeting agent skill manifests
and MCP tool definitions.

skill-md-prompt-injection-generic detects override directives (ignore
previous instructions, persona switching, IMPORTANT delimiters) inside
SKILL.md or AGENT.md frontmatter descriptions.

skill-md-data-exfiltration-generic detects directives that instruct an
agent to send results, contents, or credentials to an external endpoint.

skill-md-base64-payload-generic detects encoded payload smuggling via
base64 or hex inside skill bodies.

skill-md-sensitive-file-access-generic detects directives that read
~/.ssh, ~/.aws/credentials, .env, /etc/shadow, or browser cookie stores.

mcp-typosquatted-tool-name-python detects MCP tool functions and tool
name aliases that resemble typosquatted variants of well-known tools
(filesystem, github, database).

Patterns are derived from the open Agent Threat Rules detection standard
at https://github.com/Agent-Threat-Rule/agent-threat-rules (Apache-2.0).
ATR rule packs are shipped in production at Cisco AI Defense and
Microsoft agent-governance-toolkit.

All five rules pass semgrep test and semgrep validate.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Panguard AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Panguard AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@eeee2345
Copy link
Copy Markdown
Author

@CLAassistant recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants