{"id":"RUSTSEC-2026-0228","summary":"NIP-04 parsing amplifies malformed ciphertext memory use","details":"The NIP-04 decryption parser split attacker-controlled content on every `?iv=`\nseparator and collected all resulting segments before checking that the message had\nthe expected two parts. It also Base64-decoded the complete IV text before checking\nthat it represented the required 16-byte AES-CBC IV.\n\nA malicious sender could include a large number of separators or an oversized IV in\nan encrypted direct message. Applications that attempted to decrypt the message\nperformed avoidable allocations proportional to the malformed input, with additional\nallocation amplification from the segment vector and Base64 output. This can consume\nmemory and CPU in clients processing messages received through a relay. It does not\nweaken NIP-04 encryption or reveal plaintext or key material.\n\nThe parser now uses a single bounded split, rejects additional separators, and\nvalidates the 24-byte encoded IV length before Base64 decoding. Malformed inputs are\nreturned as errors without allocating for every separator or decoding an arbitrarily\nlarge IV.","modified":"2026-08-02T18:00:03.502761436Z","published":"2026-08-01T12:00:00Z","database_specific":{"license":"CC0-1.0"},"references":[{"type":"PACKAGE","url":"https://crates.io/crates/nostr"},{"type":"ADVISORY","url":"https://rustsec.org/advisories/RUSTSEC-2026-0228.html"},{"type":"WEB","url":"https://github.com/nostrdevkit/nostr/commit/25e4e9ce66a533d9d7f5071f6c1dae992476cf83"}],"affected":[{"package":{"name":"nostr","ecosystem":"crates.io","purl":"pkg:cargo/nostr"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.44.7"}]}],"ecosystem_specific":{"affects":{"arch":[],"os":[],"functions":[]},"affected_functions":null},"database_specific":{"cvss":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L","informational":null,"source":"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0228.json","categories":["denial-of-service"]}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L"}]}