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

btc: limit Miniscript encoding depth

Public commit record

What the developer wrote

Authored by benma's agent

78/100 · Adequate
btc: limit Miniscript encoding depth

Reject WSH policies and Taproot leaves that exceed the firmware-specific recursive encoding limit.

Cover the boundary and known deep-policy shape with tests.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a safety limit to how deeply nested a Bitcoin policy (a set of spending rules) can be before the BitBox02 hardware wallet will reject it. Without such a limit, an attacker could craft an unusually deep policy that causes the wallet's stack memory to overflow during normal processing, potentially crashing the device or causing undefined behavior. The fix caps the allowed depth and adds tests to confirm both the boundary and a known problematic shape are blocked.

Recommended action

Treat this as a security hardening fix and include it in the next firmware release. Review whether other recursive Miniscript operations (e.g., satisfaction, script generation) need similar depth limits, and consider whether 64 is appropriate for the device's actual stack size under worst-case call frames.

Security signals we found

01

Adds explicit depth bound to prevent recursive stack exhaustion

02

Applies to both WSH and Taproot (TR) policy parsing paths

03

Includes boundary and regression-style tests for deep policies

04

Returns generic InvalidInput error, consistent with existing parse failures

05

Comment notes limit is conservative rather than exact stack threshold

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/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.