All vulnerabilities

npm

CVE-2026-119186

Forge: AES-GCM authentication bypass via unvalidated tagLength option

Severity
Medium 5.9
Published
30 Oct 2026
Last changed
30 Oct 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.4.1
Exploit chance
0.2% in the next 30 daysHigher than 9% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
CWE-1284CWE-354
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Change data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Also known as
GHSA-5cwg-6vw7-rj6p
Sources
OSV.dev and GitHub

Description

The AES-GCM mode in forge.cipher does not validate the tagLength option passed to start(). With a tagLength of 0 or a value that converts to 0 (such as null, false, '' or '0'), the authentication tag is empty, and decipher.finish() returns true for any ciphertext and additional data when the supplied tag is empty or missing. Fixed in node-forge 1.4.1.

modes.gcm.prototype.start() in lib/cipherModes.js stored the tagLength option without validation, and lib/cipher.js documented it as accepting "0-128". After processing the data, afterFinish() truncates the 16-byte tag with truncate(16 % (tagLength / 8)). For a tagLength that converts to 0, this is 16 % 0 = NaN, and truncating by NaN empties the tag. On decryption, the start-time check that the supplied tag has tagLength / 8 bytes passes for an empty tag, and the final tag comparison compares two empty strings, so decipher.finish() returns true for any ciphertext and additional data.

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

Workarounds

Do not derive tagLength from received data. Pass a fixed tagLength (or omit it to use the default of 128 bits), and check that the received tag has the expected length before calling start(), for example if(tag.length !== 16) { throw new Error('Invalid tag.'); } before decipher.start({iv: iv, tag: tag});.

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