CVE-2022-25324

7.5 HIGH

📋 TL;DR

CVE-2022-25324 is a Denial of Service vulnerability in the bignum npm package where improper type checking in the .powm function causes V8 engine crashes that bypass Node.js try/catch blocks. This affects any Node.js application using vulnerable versions of the bignum package for big integer arithmetic operations. The crash leads to immediate process termination regardless of error handling.

💻 Affected Systems

Products:
  • node-bignum
Versions: All versions before fix
Operating Systems: All platforms running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that use the .powm method of the bignum package. The vulnerability is in the package itself, not Node.js core.

📦 What is this software?

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service disruption with Node.js process crashes causing application downtime and potential cascading failures in dependent services.

🟠

Likely Case

Application crashes when processing specific mathematical operations with malformed inputs, requiring process restarts and causing intermittent availability issues.

🟢

If Mitigated

Limited impact with proper input validation and monitoring that catches crashes quickly for rapid recovery.

🌐 Internet-Facing: MEDIUM - Exploitable via API endpoints that accept user input for mathematical operations, but requires specific function calls.
🏢 Internal Only: LOW - Typically requires intentional or malformed internal calls to trigger, less likely in controlled environments.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires calling the vulnerable .powm function with malformed second argument. Public proof-of-concept code exists demonstrating the crash.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Not specifically versioned - package appears unmaintained

Vendor Advisory: https://github.com/justmoon/node-bignum/security/advisories

Restart Required: Yes

Instructions:

1. Remove bignum package: npm uninstall bignum
2. Consider migrating to maintained alternatives like bn.js or big-integer
3. Update package.json to prevent reinstallation
4. Restart all Node.js processes

🔧 Temporary Workarounds

Input validation wrapper

all

Wrap all bignum.powm() calls with type checking of second argument

// Before calling bignum.powm(a, b, m):
// if (typeof b !== 'number' && !(b instanceof bignum)) {
//   throw new Error('Invalid second argument type');
// }

Package replacement

all

Replace bignum with bn.js which has similar functionality

npm uninstall bignum
npm install bn.js

🧯 If You Can't Patch

  • Implement strict input validation for all mathematical operations using bignum
  • Deploy monitoring to detect and automatically restart crashed Node.js processes

🔍 How to Verify

Check if Vulnerable:

Check package.json or node_modules for bignum dependency: npm list bignum

Check Version:

npm list bignum | grep bignum

Verify Fix Applied:

Confirm bignum is removed from dependencies and test .powm functionality with alternative library

📡 Detection & Monitoring

Log Indicators:

  • Node.js process crashes with V8 fatal errors
  • Application logs showing unhandled exceptions from mathematical operations
  • Process monitor alerts for repeated Node.js restarts

Network Indicators:

  • Sudden HTTP 503/500 responses from previously healthy endpoints
  • Increased timeout errors for mathematical API calls

SIEM Query:

source="application.logs" AND ("FATAL ERROR" OR "Process crashed" OR "uncaughtException") AND message CONTAINS "bignum"

🔗 References

📤 Share & Export