rustsec-2026-0219
Vulnerability from osv_rustsec
Published
2026-07-26 12:00
Modified
2026-08-01 11:36
Summary
Remote Denial of Service via malformed NIP-04 IV
Details

The nostr crate did not validate the length of the initialization vector decoded from the ?iv= portion of a NIP-04 encrypted message.

The decoded IV was converted from a byte slice to the 16-byte AES-CBC IV type using a conversion that asserts the slice length. As a result, an IV whose decoded length was not exactly 16 bytes caused a panic before ciphertext decryption. For example, ?iv=AAAA decodes to a three-byte IV and triggers the panic.

Applications that decrypt untrusted NIP-04 content are affected. The issue is also reachable through NIP-47 (Nostr Wallet Connect), where response and notification events from a malicious or compromised wallet service are passed to NIP-04 decryption. If the panic is not isolated, a crafted event can terminate the application or disrupt message processing, causing a denial of service.

The issue does not affect confidentiality or integrity.

The flaw was corrected by converting the decoded IV to [u8; 16] using a checked conversion. Invalid IV lengths now return a Malformed error instead of panicking.

Credit

Discovered and responsibly disclosed by Muhammed Shekho (mhd-shekho.com).


{
  "affected": [
    {
      "database_specific": {
        "categories": [
          "denial-of-service"
        ],
        "cvss": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
        "informational": null
      },
      "ecosystem_specific": {
        "affected_functions": null,
        "affects": {
          "arch": [],
          "functions": [
            "nostr::nips::nip04::decrypt",
            "nostr::nips::nip04::decrypt_to_bytes"
          ],
          "os": []
        }
      },
      "package": {
        "ecosystem": "crates.io",
        "name": "nostr",
        "purl": "pkg:cargo/nostr"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.0.0-0"
            },
            {
              "fixed": "0.44.6"
            },
            {
              "introduced": "0.45.0-alpha.1"
            },
            {
              "fixed": "0.45.0-alpha.6"
            }
          ],
          "type": "SEMVER"
        }
      ],
      "versions": []
    }
  ],
  "aliases": [
    "GHSA-xg7c-246g-6qpv"
  ],
  "database_specific": {
    "license": "CC0-1.0"
  },
  "details": "The `nostr` crate did not validate the length of the initialization vector\ndecoded from the `?iv=` portion of a NIP-04 encrypted message.\n\nThe decoded IV was converted from a byte slice to the 16-byte AES-CBC IV type\nusing a conversion that asserts the slice length. As a result, an IV whose\ndecoded length was not exactly 16 bytes caused a panic before ciphertext\ndecryption. For example, `?iv=AAAA` decodes to a three-byte IV and triggers the\npanic.\n\nApplications that decrypt untrusted NIP-04 content are affected. The issue is\nalso reachable through NIP-47 (Nostr Wallet Connect), where response and\nnotification events from a malicious or compromised wallet service are passed\nto NIP-04 decryption. If the panic is not isolated, a crafted event can terminate\nthe application or disrupt message processing, causing a denial of service.\n\nThe issue does not affect confidentiality or integrity.\n\nThe flaw was corrected by converting the decoded IV to `[u8; 16]` using a\nchecked conversion. Invalid IV lengths now return a `Malformed` error instead of\npanicking.\n\n## Credit\n\nDiscovered and responsibly disclosed by **Muhammed Shekho** ([mhd-shekho.com](https://mhd-shekho.com)).",
  "id": "RUSTSEC-2026-0219",
  "modified": "2026-08-01T11:36:43Z",
  "published": "2026-07-26T12:00:00Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://crates.io/crates/nostr"
    },
    {
      "type": "ADVISORY",
      "url": "https://rustsec.org/advisories/RUSTSEC-2026-0219.html"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nostrdevkit/nostr/commit/b24619346f666d08ef7fefe27f033b8bc871697f"
    }
  ],
  "related": [],
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Remote Denial of Service via malformed NIP-04 IV"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…