recursion-dos

recursion-dos is a skill for Claude Code, Codex from ByamB4/find-cve-agent. It costs 28 tokens per session (1,096 once invoked), scanned A, original, Apache-2.0.

A security review for denial-of-service flaws caused by recursive code processing deeply nested input. Denial of service means making a program crash or unavailable.

In plain words
What is it for?
Use it to inspect recursive parsers, serializers, tree walkers, and deep-copy or merge functions handling user-controlled structures.
Why use it?
It helps find missing depth limits that can exhaust memory or the call stack when processing hostile data.

Skill for Claude CodeCodex

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

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.

agentmods
npx agentmods add skills/byamb4/find-cve-agent/recursion-dos
Any agent
npx skills add ByamB4/find-cve-agent --skill recursion-dos
Clone the repo
git clone --depth 1 https://github.com/ByamB4/find-cve-agent

Made for: Claude Code, Codex.

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 recursion-dos

README.md
[![agentmods](https://agentmods.dev/badge/skills/byamb4/find-cve-agent/recursion-dos.svg)](https://agentmods.dev/skills/byamb4/find-cve-agent/recursion-dos)
Your own site
<a href="https://agentmods.dev/skills/byamb4/find-cve-agent/recursion-dos"><img src="https://agentmods.dev/badge/skills/byamb4/find-cve-agent/recursion-dos.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,096 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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.00028 $0.01096
Opus 5 $0.00014 $0.00548
Sonnet 5 $0.00006 $0.00219
Haiku 4.5 $0.00003 $0.00110

Measured 5d ago against content hash 63f3a301f5b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

recursion-dos scanned grade A with 1 finding 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 5d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

const { execSync } = require('child_process');
skills/recursion-dos/SKILL.md · 147 lines

How it starts

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

Recursion DoS Detection

When to Use

Audit parsers, serializers, tree walkers, deep clone/merge functions, and any recursive function that processes user-controlled data structures with unbounded nesting depth.

Key Distinction: OOM vs RangeError

Crash Type Severity Catchable? Process Dies?
OOM (heap exhaustion) HIGH 7.5 NO YES -- uncatchable, process killed
RangeError (stack overflow) MEDIUM 5.3-6.5 YES (try/catch) Only if uncaught

OOM crash = process dies regardless of error handling. This is HIGH severity. RangeError = catchable in try/catch. Only HIGH if the library does NOT catch it.

Process

Step 1: Find Recursive Functions

grep -rn "function.*recurse\|function.*recursive\|function.*walk\|function.*traverse" .
grep -rn "function.*serialize\|function.*stringify\|function.*clone\|function.*deep" .
grep -rn "function.*parse\|function.*process\|function.*visit\|function.*transform" .

Look for functions that call themselves:

# Find function definitions and then check if they self-reference
grep -rn "function\s\+\w\+" . --include="*.js" | head -50
# Then for each function name, check if it calls itself

Step 2: Check for Depth Limits

grep -rn "maxDepth\|max_depth\|depthLimit\|depth_limit\|MAX_DEPTH" .
grep -rn "depth\s*>\|depth\s*>=\|depth\s*<\|depth\s*<=" .
grep -rn "recursion.*limit\|stack.*limit\|nesting.*limit" .

Step 3: Test with Nested Input

Create deeply nested input matching the data format:

// JSON-like nesting
let nested = "x";
for (let i = 0; i < 100000; i++) {
  nested = { a: nested };
}

// String-based nesting
let nested = "a";
for (let i = 0; i < 100000; i++) {
  nested = "[" + nested + "]";
}

Step 4: Measure Stack Consumption

// Run in subprocess to avoid crashing main process
const { execSync } = require('child_process');
try {
  execSync('node -e "const pkg = require('./'); pkg.parse(payload)"', {
    timeout: 10000,
    maxBuffer: 1024
  });
} catch (e) {
  if (e.status === null) {
    console.log('[+] OOM: process killed (HIGH severity)');
  } else {
    console.log('[!] RangeError: catchable (MEDIUM severity)');
  }
}

Read the full file on GitHub · 147 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. 5d ago First seen · 147 lines · 28 tokens per session scan A 63f3a301f5b8

Subscribe to this mod's changes

recursion-dos is a skill published in the GitHub repository ByamB4/find-cve-agent (47 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 28 tokens to every session and 1,096 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). 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