AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
High 72 Bitcoin

Count miniscript wrappers in the parser's recursion depth limit

Public commit record

What the developer wrote

Authored by Salvatore Ingala

73/100 · Adequate
Count miniscript wrappers in the parser's recursion depth limit

parse_script bounds the depth of the parsed policy with
MAX_PARSE_SCRIPT_RECURSION_DEPTH, but the miniscript wrappers were
not charged to that budget; this can cause stack exhaustion in other
functions that process the parsed AST recursively.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in the Ledger Bitcoin app's wallet-policy parser. Miniscript 'wrappers' (short letters like 'n' that modify a policy) were not counted toward the parser's recursion-depth safety limit. A crafted wallet descriptor with a long chain of wrappers could create an extremely deep policy tree, causing later recursive functions to exhaust the device's limited stack and crash. The patch now charges each wrapper against the same depth budget as nested expressions, and adds tests proving the boundary works.

Recommended action

Treat this as a security-hardening fix for a denial-of-service condition. Ensure the patch is included in the next release, run the new unit test, and consider whether any other AST walkers or parser paths have unbounded depth accounting gaps.

Security signals we found

01

Stack-exhaustion / denial-of-service via crafted descriptor template

02

Missing recursion-depth accounting for parser-level wrapper expansion

03

Patch adds explicit depth budget check and regression test

04

Affected function: compute_miniscript_policy_ext_info and other recursive AST walkers

05

No evidence of memory corruption or code execution in the diff

Risk score

Why this scored 72/100

Our methodology →
Potential impact 22/30
Exploitability 16/25
Stealth signal 10/15
Affected reach 12/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.