entity-expansion

entity-expansion is a skill for Claude Code from ByamB4/find-cve-agent. It costs 29 tokens per session (1,497 once invoked), scanned A, original, Apache-2.0.

A security review for entity expansion, where specially crafted XML or YAML input grows dramatically while being parsed. XML and YAML are structured text formats used for documents and configuration.

In plain words
What is it for?
Use it to inspect XML, SVG, document, feed, and YAML parsers for unbounded entity or alias expansion.
Why use it?
It helps find parser settings that allow excessive expansion, which can consume memory and crash the process.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the find-cve-agent plugin — 21 skills, 7 commands, 5 agents shipped together

Good fit Use it to inspect XML, SVG, document, feed, and YAML parsers for unbounded entity or alias expansion.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/byamb4/find-cve-agent/entity-expansion
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ByamB4/find-cve-agent --skill entity-expansion
Clone the repo
git clone --depth 1 https://github.com/ByamB4/find-cve-agent

Made for: Claude Code.

Or install find-cve-agent, the plugin that ships this one along with the rest of its 21 skills, 7 commands, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for entity-expansion

README.md
[![agentmods](https://agentmods.dev/badge/skills/byamb4/find-cve-agent/entity-expansion/github.svg)](https://agentmods.dev/skills/byamb4/find-cve-agent/entity-expansion)
Your own site
<a href="https://agentmods.dev/skills/byamb4/find-cve-agent/entity-expansion"><img src="https://agentmods.dev/badge/skills/byamb4/find-cve-agent/entity-expansion/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for entity-expansion

Your own site · 80×15
<a href="https://agentmods.dev/skills/byamb4/find-cve-agent/entity-expansion"><img src="https://agentmods.dev/badge/skills/byamb4/find-cve-agent/entity-expansion.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,497 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01497
Opus 5 $0.00015 $0.00749
Sonnet 5 $0.00006 $0.00299
Haiku 4.5 $0.00003 $0.00150

Measured 10d ago against content hash 9461ea0b4f95, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

entity-expansion scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/entity-expansion/SKILL.md · 154 lines

How it starts

The opening of the file, as written. The whole thing — 154 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Entity Expansion (Billion Laughs) Detection

When to Use

Audit any package that parses XML, SVG, HTML with entity support, or YAML with alias/anchor support. This includes:

  • XML/SVG parsing libraries
  • Document processors (DOCX, XLSX, RSS, Atom, SOAP)
  • YAML parsers with alias expansion
  • Configuration file parsers

~90% CVE acceptance rate when confirmed.

Key Insight

Many parsers have NO default entity expansion limit. A 1KB XML payload with recursive entity definitions can expand to 1GB+ in memory, crashing the process with an OOM kill (uncatchable — process dies).

Entity Expansion Types

1. Billion Laughs (Internal Entity Recursion)

<?xml version="1.0"?>
<!DOCTYPE lolz [
  <!ENTITY lol "lol">
  <!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
  <!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
  ...
  <!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<root>&lol9;</root>

Each level multiplies by 10. Level 9 = 10^9 = 1 billion "lol" strings.

2. Quadratic Blowup (Single Entity Repeated)

<!DOCTYPE foo [
  <!ENTITY a "AAAAAAAAAA..."> <!-- 50KB entity -->
]>
<root>&a;&a;&a;&a;&a;...&a;</root> <!-- 50000 references -->

Less dramatic but still effective — 50KB entity × 50000 refs = 2.5GB.

3. YAML Alias Expansion

a: &anchor
  x: *anchor
  y: *anchor

Recursive alias references can cause exponential expansion in some YAML parsers.

Process

Step 1: Find XML/YAML Parsing

# JavaScript
grep -rn "xml2js\|fast-xml-parser\|xmldom\|sax\|DOMParser\|cheerio" .
grep -rn "\.parseString\|\.parse(" . --include="*.js" --include="*.ts"
grep -rn "yaml\.load\|yaml\.parse\|YAML\.parse" .

# Python
grep -rn "xml\.etree\|lxml\|minidom\|xml\.sax\|defusedxml" .
grep -rn "yaml\.load\|yaml\.safe_load\|yaml\.unsafe_load" .

# Go
grep -rn "xml\.Decoder\|xml\.Unmarshal\|encoding/xml" .
grep -rn "yaml\.Unmarshal\|gopkg.in/yaml" .

# Ruby
grep -rn "Nokogiri\|REXML\|Ox\.\|LibXML" .

# PHP
grep -rn "simplexml\|DOMDocument\|XMLReader\|xml_parse" .

Read the full file on GitHub · 154 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 154 lines · 29 tokens per session scan A 9461ea0b4f95

Subscribe to this mod's changes

entity-expansion is a skill published in the GitHub repository ByamB4/find-cve-agent (48 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 29 tokens to every session and 1,497 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories