CVE-2024-49365: Tiny secp256k1 Tiny-secp256k1 Allows For Verify() Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-5vhg-9xg4-cv9m
CWE-347
Published
Advisory Summary

CVE-2024-49365 is a HIGH tiny-secp256k1 allows for verify() bypass vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Tiny secp256k1 libraries in the npm ecosystem. The issue involves tiny-secp256k1 allows for verify() bypass when running in bundled environment. Remediation is available by upgrading affected packages to version 1.1.7.

CVE-2024-49365 at a Glance

CVE Identifier CVE-2024-49365
GHSA Identifier GHSA-5vhg-9xg4-cv9m
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product Tiny secp256k1
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2024-49365

To remediate this vulnerability, upgrade all affected Tiny secp256k1 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tiny-secp256k1 fixed: 1.1.7
npm install tiny-secp256k1@1.1.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls tiny-secp256k1

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-49365, inspect your project dependencies using npm:

npm ls tiny-secp256k1

Analyze the terminal output to locate any version of Tiny secp256k1 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.7), your application is affected.

Note: The npm ls tiny-secp256k1 command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In Tiny secp256k1, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A malicious JSON-stringifyable message can be made passing on `verify()`, when global Buffer is [`buffer` package](https://www.npmjs.com/package/buffer) ### Details This affects only environments where `require('buffer')` is <https://npmjs.com/buffer> E.g.: browser bundles, React Native apps, etc. `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 v2.x is unaffected as it verifies input to be an actual `Uint8Array` instance Such a message can be constructed for any already known message/signature pair There are some restrictions though (also depending on the known message/signature), but not very limiting, see PoC for example https://github.com/bitcoinjs/tiny-secp256k1/pull/140 is a subtle fix for this ### PoC This code deliberately doesn't provide `reencode` for now, could be updated later ```js import { randomBytes } from 'crypto' import tiny from 'tiny-secp256k1' // 1.1.6 // Random keypair const privateKey = randomBytes(32) const publicKey = tiny.pointFromScalar(privateKey) const valid = Buffer.alloc(32).fill(255) // let's sign a static buffer const signature = tiny.sign(valid, privateKey) // Prevent processing any unverified data by fail-closed throwing function verified(data, signature) { if (!Buffer.isBuffer(data)) data = Buffer.from(data, 'hex') if (!tiny.verify(data, publicKey, signature)) throw new Error('Signature invalid!') return new Uint8Array(data) } function safeProcess(payload) { const totally = JSON.parse(payload) // e.g. json over network const message = verified(totally, signature) console.log(message instanceof Uint8Array) console.log(Buffer.from(message).toString('utf8')) } const payload = reencode(valid, "Secure contain protect") safeProcess(payload) ``` Output (after being bundled): ```console true Secure contain protect���� ``` ### Impact Malicious messages could crafted to be verified from a given known valid message/signature pair

CVE-2024-49365 Affected Tiny secp256k1 Versions

1 component(s)
Fixed Versions:
1.1.7
Product / Package Ecosystem Affected Versions Fixed Version
tiny-secp256k1
npm
< 1.1.7
1.1.7

References

Frequently Asked Questions

What is CVE-2024-49365?
CVE-2024-49365 is a security vulnerability in Tiny secp256k1 involving tiny-secp256k1 allows for verify() bypass when running in bundled environment under CWE-347: Improper Verification of Cryptographic Signature.
Which Tiny secp256k1 versions are affected?
Affected versions include releases prior to 1.1.7 across affected packages: tiny-secp256k1.
What version fixes CVE-2024-49365?
Upgrading to 1.1.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tiny-secp256k1 affected?
Yes, tiny-secp256k1 is affected in releases prior to 1.1.7. Upgrade your dependency to 1.1.7 or later.
What CWE is associated with CVE-2024-49365?
CVE-2024-49365 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check npm dependencies for CVE-2024-49365?
Run the dependency tree command: 'npm ls tiny-secp256k1'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5vhg-9xg4-cv9m",
  "modified" : "2025-07-01T13:13:38Z",
  "published" : "2025-06-30T17:44:14Z",
  "aliases" : [ "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",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "tiny-secp256k1"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.1.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "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" : "WEB",
    "url" : "https://github.com/bitcoinjs/tiny-secp256k1/pull/140"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bitcoinjs/tiny-secp256k1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-06-30T17:44:14Z",
    "nvd_published_at" : "2025-07-01T03:15:21Z"
  }
}