
Advisory for node-forge ⌯⌲ 53 mill weekly downloads
Forge: Incomplete PKCS#7 padding validation in AES/DES CBC and ECB decryption
| Field | Value |
|---|---|
| CVE ID | CVE-2026-118776 |
| State | PUBLISHED |
| Assigner | GitHub_M |
| Date Reserved | 2026-10-28T19:20:05.018Z |
| Date Published | 2026-10-29T18:37:32.362Z |
| Date Updated | 2026-10-29T18:37:32.362Z |
Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used decipher.finish(), CBC and ECB modes, PKCS#7 padding to process the relevant input or security decision. node-forge validated only the final byte of PKCS#7 padding during CBC and ECB decryption and accepted zero, oversized, or mismatched padding bytes. Malformed ciphertext could consequently be accepted and up to four plaintext blocks could be silently removed, causing an integrity failure in applications that treated successful decryption as proof of valid padding. This issue is fixed in version 1.4.1.
| Vendor | Product | Versions |
|---|---|---|
| digitalbazaar | forge | < 1.4.1 |
Oren Yomtov (@orenyomtov, Fireblocks), @zebbern, and Brian Lee (@hibrian827, Georgia Tech SSLab, Team Atlanta).
Proof of concept
var forge = require('node-forge');
// Wycheproof aes_cbc_pkcs5_test tcId 26: zero padding instead of PKCS#7
var d = forge.cipher.createDecipher('AES-CBC',
forge.util.hexToBytes('db4f3e5e3795cc09a073fa6a81e5a6bc'));
d.start({iv: forge.util.hexToBytes('23468aa734f5f0f19827316ff168e94f')});
d.update(forge.util.createBuffer(
forge.util.hexToBytes('aa62606a287476777b92d8e4c4e53028')));
console.log(d.finish()); // 1.4.0: true; 1.4.1: false
Directly, unpad() on 1.4.0 also accepts a final block ending in 03 02 01 04 (removing 4 bytes) and a count of 0x20 on 16-byte blocks (removing 32 bytes).
Regression tests are in tests/unit/aes.js ("PKCS#7 padding checks").
Applications that decrypt AES or DES data in CBC or ECB mode and use the result of decipher.finish() to decide whether the data is valid could accept malformed ciphertext, with up to four blocks of trailing plaintext removed. This also affects PKCS#7 EncryptedData/EnvelopedData decryption, PKCS#12 and encrypted private keys. Because CBC and ECB without a MAC are malleable, the additional capability given to an attacker is small. There is no confidentiality or availability impact.