{"id":"CVE-2024-49365","aliases":["GHSA-5vhg-9xg4-cv9m"],"url":"https://o3.security/vulnerability/CVE-2024-49365","summary":"tiny-secp256k1 allows for verify() bypass when running in bundled environment","details":"### Summary\n\nA malicious JSON-stringifyable message can be made passing on `verify()`, when global Buffer is [`buffer` package](https://www.npmjs.com/package/buffer)\n\n### Details\n\nThis affects only environments where `require('buffer')` is <https://npmjs.com/buffer>\nE.g.: browser bundles, React Native apps, etc.\n\n`Buffer.isBuffer` check can be bypassed, resulting in strange objects being accepted as `message`, and those messages could trick `verify()` into returning false-positive `true` values\n\nv2.x is unaffected as it verifies input to be an actual `Uint8Array` instance\n\nSuch a message can be constructed for any already known message/signature pair\nThere are some restrictions though (also depending on the known message/signature), but not very limiting, see PoC for example\n\nhttps://github.com/bitcoinjs/tiny-secp256k1/pull/140 is a subtle fix for this\n\n### PoC\n\nThis code deliberately doesn't provide `reencode` for now, could be updated later\n\n```js\nimport { randomBytes } from 'crypto'\nimport tiny from 'tiny-secp256k1' // 1.1.6\n\n// Random keypair\nconst privateKey = randomBytes(32)\nconst publicKey = tiny.pointFromScalar(privateKey)\n\nconst valid = Buffer.alloc(32).fill(255) // let's sign a static buffer\nconst signature = tiny.sign(valid, privateKey)\n\n// Prevent processing any unverified data by fail-closed throwing\nfunction verified(data, signature) {\n  if (!Buffer.isBuffer(data)) data = Buffer.from(data, 'hex')\n  if (!tiny.verify(data, publicKey, signature)) throw new Error('Signature invalid!')\n  return new Uint8Array(data)\n}\n\nfunction safeProcess(payload) {\n  const totally = JSON.parse(payload) // e.g. json over network\n\n  const message = verified(totally, signature)\n  console.log(message instanceof Uint8Array)\n  console.log(Buffer.from(message).toString('utf8'))  \n}\n\nconst payload = reencode(valid, \"Secure contain protect\")\nsafeProcess(payload)\n```\n\nOutput (after being bundled):\n```console\ntrue\nSecure contain protect����\n```\n\n### Impact\n\nMalicious messages could crafted to be verified from a given known valid message/signature pair","published":"2025-07-01T02:07:02.922Z","modified":"2026-08-12T03:51:08.760915359Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"tiny-secp256k1","fixedVersion":"1.1.7"}],"fix":{"url":"https://github.com/bitcoinjs/tiny-secp256k1/pull/140","label":"bitcoinjs/tiny-secp256k1#140"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49365.json"},{"type":"ADVISORY","url":"https://github.com/bitcoinjs/tiny-secp256k1/security/advisories/GHSA-5vhg-9xg4-cv9m"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49365"},{"type":"FIX","url":"https://github.com/bitcoinjs/tiny-secp256k1/pull/140"},{"type":"PACKAGE","url":"https://github.com/bitcoinjs/tiny-secp256k1"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:08.760915359Z"}}