All vulnerabilities

npm

CVE-2026-118776

Forge: Incomplete PKCS#7 padding validation in AES/DES CBC and ECB decryption

Severity
Low 3.7
Published
10 Nov 2026
Last changed
10 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.4.1
Exploit chance
0.2% in the next 30 daysHigher than 6% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Improper input validation (CWE-20)CWE-354
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Also known as
GHSA-2vgq-wchc-25w7
Sources
OSV.dev and GitHub

Description

decipher.finish() in CBC and ECB mode accepted malformed PKCS#7 padding: only the last byte was checked, against a limit of four blocks, so mismatched padding bytes, a zero count and oversized counts were accepted and up to four blocks of plaintext could be silently removed. Fixed in node-forge 1.4.1.

modes.cbc.prototype.unpad() and modes.ecb.prototype.unpad() in lib/cipherModes.js read the last decrypted byte as the PKCS#7 padding count, rejected it only if it was larger than blockSize << 2 (64 for AES, 32 for DES), and then removed that many bytes. They did not reject a count of 0 or a count larger than one block, and did not check that every padding byte equals the count, as PKCS#7 (RFC 5652 section 6.3) requires. On the Wycheproof AES-CBC-PKCS5 test vectors, 69 of 144 invalid vectors decrypted successfully.

CBC and ECB without a MAC do not provide integrity: an attacker who can modify ciphertext can already make the final block decrypt to any padding.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

Authenticate CBC/ECB ciphertext before decrypting it, or use AES-GCM. To check padding on 1.4.0, set decipher.mode.unpad = false and validate the padding in application code.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
node-forgenpm · osv:npm:node-forge
  • Every version before 1.4.1

About node-forge

Weekly downloads (npm)
55,543,907npm, 23 Nov 2026

References