Improper Verification of Cryptographic Signature Affecting whatsapp-api-js package, versions >=4.0.0 <4.0.3


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-WHATSAPPAPIJS-7945494
  • published 13 Sep 2024
  • disclosed 12 Sep 2024
  • credit Felix Arjuna

How to fix?

Upgrade whatsapp-api-js to version 4.0.3 or higher.

Overview

whatsapp-api-js is an A TypeScript server agnostic Whatsapp's Official API framework

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature via the verifyRequestSignature due to the failure in validating the message's signature. An attacker can bypass access controls by manipulating the signature verification process.

Workaround

It's possible to check the payload validation using the WhatsAppAPI.verifyRequestSignature and expect false when the signature is valid.

function doPost(payload, header_signature) {
    if (whatsapp.verifyRequestSignature(payload.toString(), header_signature) {
        throw 403;
    }
    
// Now the payload is correctly verified
whatsapp.post(payload);

}

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
6.9 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    None
  • Integrity (VI)
    None
  • Availability (VA)
    None
  • Confidentiality (SC)
    None
  • Integrity (SI)
    Low
  • Availability (SA)
    None