CVE-2024-45607: Whatsapp api js Whatsapp-api-js Fails To Validate Message's Vulnerability

MODERATE
Advisory Identifier: GHSA-mwhf-vhr5-7j23
CVSS 5.8
CWE-347
Published
Advisory Summary

CVE-2024-45607 is a MODERATE (CVSS 5.8) whatsapp-api-js fails to validate message's vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Whatsapp api js libraries in the npm ecosystem. The issue involves whatsapp-api-js fails to validate message's signature. Remediation is available by upgrading affected packages to version 4.0.3.

CVE-2024-45607 at a Glance

CVE Identifier CVE-2024-45607
GHSA Identifier GHSA-mwhf-vhr5-7j23
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product Whatsapp api js
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-45607

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

whatsapp-api-js fixed: 4.0.3
npm install whatsapp-api-js@4.0.3
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 whatsapp-api-js

How to Check if You Are Affected

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

npm ls whatsapp-api-js

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

Note: The npm ls whatsapp-api-js 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 Whatsapp api js, 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

### Impact Incorrect Access Control, anyone using the post or verifyRequestSignature methods to handle messages is impacted. ### Patches Patched in version 4.0.3. ### Workarounds It's possible to check the payload validation using the WhatsAppAPI.verifyRequestSignature and expect false when the signature is valid. ```ts function doPost(payload, header_signature) { if (whatsapp.verifyRequestSignature(payload.toString(), header_signature) { throw 403; } // Now the payload is correctly verified whatsapp.post(payload); } ``` ### References https://github.com/Secreto31126/whatsapp-api-js/pull/371

CVE-2024-45607 Affected Whatsapp api js Versions

1 component(s)
Fixed Versions:
4.0.3
Product / Package Ecosystem Affected Versions Fixed Version
whatsapp-api-js
npm
≥ 4.0.0
< 4.0.3
4.0.3

References

Frequently Asked Questions

What is CVE-2024-45607?
CVE-2024-45607 is a security vulnerability in Whatsapp api js involving whatsapp-api-js fails to validate message's signature under CWE-347: Improper Verification of Cryptographic Signature.
Which Whatsapp api js versions are affected?
Affected versions include releases prior to 4.0.3 across affected packages: whatsapp-api-js.
What version fixes CVE-2024-45607?
Upgrading to 4.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is whatsapp-api-js affected?
Yes, whatsapp-api-js is affected in releases prior to 4.0.3. Upgrade your dependency to 4.0.3 or later.
What is the CVSS score of CVE-2024-45607?
CVE-2024-45607 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with CVE-2024-45607?
CVE-2024-45607 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-45607?
Run the dependency tree command: 'npm ls whatsapp-api-js'. 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-mwhf-vhr5-7j23",
  "modified" : "2024-09-12T21:39:35Z",
  "published" : "2024-09-12T21:29:17Z",
  "aliases" : [ "CVE-2024-45607" ],
  "summary" : "whatsapp-api-js fails to validate message's signature",
  "details" : "### Impact\nIncorrect Access Control, anyone using the post or verifyRequestSignature methods to handle messages is impacted.\n\n### Patches\nPatched in version 4.0.3.\n\n### Workarounds\nIt's possible to check the payload validation using the WhatsAppAPI.verifyRequestSignature and expect false when the signature is valid.\n\n```ts\nfunction doPost(payload, header_signature) {\n    if (whatsapp.verifyRequestSignature(payload.toString(), header_signature) {\n        throw 403;\n    }\n    \n    // Now the payload is correctly verified\n    whatsapp.post(payload);\n}\n```\n\n### References\nhttps://github.com/Secreto31126/whatsapp-api-js/pull/371\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "whatsapp-api-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Secreto31126/whatsapp-api-js/security/advisories/GHSA-mwhf-vhr5-7j23"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45607"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Secreto31126/whatsapp-api-js/pull/371"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Secreto31126/whatsapp-api-js/commit/56620c65126427496a94d176082fbd8393a95b6d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Secreto31126/whatsapp-api-js"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-12T21:29:17Z",
    "nvd_published_at" : "2024-09-12T20:15:05Z"
  }
}