# Assertion crash on crafted input

Unwrap, assert, or abort reachable from parsed or self-referential input with no graceful error path

_Area: Memory corruption and native code. Seen in 3 disclosed reports; one confirmed bounty: $10,000; latest 2025-09-01. Updated 2026-11-09._

## How it works
Code assumes a conversion, parse, or copy step always succeeds, so it calls `unwrap`, `assert`, or an equivalent abort instead of returning an error. When crafted input reaches that step, the assumption breaks and the process aborts. The danger grows when the abort happens inside a critical section: a panic while holding a lock poisons it, turning one bad request into a lasting outage [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md). Native-backed types add a second trap: a freshly allocated backing struct can be read before it is populated, so an assertion fires on empty state [E1](https://bugbountylibrary.com/r/h1%3A185775.md).

## Where it shows up
- `unwrap()`/`expect()` on conversion functions that only handle a subset of formats (e.g. legacy-only conversions returning `None` for newer versions) [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md)
- Panics or aborts inside a scope holding a write lock or other shared guard [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md)
- Self-referential initialization: `obj.initialize(obj)` or copy paths that call a method on the instance before its backing struct is filled [E1](https://bugbountylibrary.com/r/h1%3A185775.md)
- Parsers with `assert` on enum/type tags they do not enumerate; unusual certificate GeneralName types beyond DNS/IP/URI [E3](https://bugbountylibrary.com/r/h1%3A746733.md)
- Native extension code (C/C++/Rust FFI) where an assertion in the backing library is reachable from interpreted input [E1](https://bugbountylibrary.com/r/h1%3A185775.md)[E3](https://bugbountylibrary.com/r/h1%3A746733.md)

## How to review
For every fallible conversion or parse on an input-reachable path, confirm the failure is propagated as an error, not unwrapped or asserted. The invariant: no input-controlled value may reach an abort, and no abort may occur while a lock or shared guard is held. For native-backed types, confirm the backing struct is fully populated before any method reads it, including self-copy paths. For parsers, confirm every tag/type value has a handled branch or a clean rejection.

## How finders spotted it
- Traced the initialize path and saw that initializing a Decimal with itself allocates an empty `mpd_t`, then calls `to_s` on the same instance to fill it, reading uninitialized state [E1](https://bugbountylibrary.com/r/h1%3A185775.md)
- Read the `simulateTransaction` handler and noticed `into_legacy_transaction()` returns `None` for v0/v1 formats but was unwrapped unconditionally inside a lock-holding section [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md)
- Noted the inverse of a known client-side crash and hypothesized the server side would crash symmetrically on a malformed SAN, then crafted certs to confirm [E3](https://bugbountylibrary.com/r/h1%3A746733.md)

## Variants seen
- Self-referential initialization reading an empty native struct [E1](https://bugbountylibrary.com/r/h1%3A185775.md)
- Unwrap on a version-gated conversion, panicking inside a lock and poisoning it [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md)
- Unhandled certificate GeneralName type tag hitting an assertion in native parsing [E3](https://bugbountylibrary.com/r/h1%3A746733.md)

## Impact and severity
All three are denial of service via crash. Severity rises when the crash is remote and unauthenticated [E3](https://bugbountylibrary.com/r/h1%3A746733.md), or when a panic poisons a shared lock so a single request disables all RPC calls persistently [E2](https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md). The lock-poisoning case is the most damaging because the effect outlasts the triggering request.

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Node.js**: Remotely trigger an assertion on a TLS server with a malformed certificate string (CVE-2019-15604). Report: https://bugbountylibrary.com/r/h1%3A746733.md

## Evidence
- E1: https://bugbountylibrary.com/r/h1%3A185775.md
- E2: https://bugbountylibrary.com/r/cantina%3Asolaxy%3A3.2.2.md
- E3: https://bugbountylibrary.com/r/h1%3A746733.md
