Node-forge, Uncontrolled Recursion, CVE-2022-24772 (High)

Listen to this Post

The vulnerability exists in the `asn1.fromDer` function within forge/lib/asn1.js. The DER parser implementation uses a recursive function, _fromDer, to process ASN.1 constructed types like SEQUENCE and SET. The function lacks a recursion depth guard. An attacker can craft a malicious DER-encoded object with an extremely deep nesting of these constructed types. When this object is parsed, the `_fromDer` function is called recursively for each nested level. This uncontrolled recursion exhausts the Node.js/V8 JavaScript call stack, triggering a `RangeError: Maximum call stack size exceeded` exception. This crashes the process, resulting in a Denial-of-Service.
Platform: Node.js
Version: <=1.3.1
Vulnerability: Stack Exhaustion
Severity: High
date: 2022-03-22

Prediction: 2022-03-29

What Undercode Say:

npm audit --production
const forge = require('node-forge');
const maliciousDer = forge.util.createBuffer().getBytes(); // Crafted deep DER
forge.asn1.fromDer(maliciousDer); // Triggers stack overflow

How Exploit:

Craft deep DER.

Send to service.

Crash process.

Protection from this CVE

Update node-forge.

Input validation.

Limit recursion.

Impact:

Denial-of-Service.

Service crash.

Availability loss.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top