Forge: Prototype Pollution in forge.http cookie handling via a malicious Set-Cookie
Impact
The `forge.http` client in node-forge versions before 1.4.1 is vulnerable to prototype pollution via a malicious `Set-Cookie` header, allowing a server to add or remove properties from `Object.prototype`. This can change application logic and break the page or process.
Summarized by @cf/meta/llama-3.3-70b-instruct-fp8-fast. Verify details against the original sources.forge.http is not loaded by require('node-forge').
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 1.4.1Semantic versions | 1.4.1 |
Version evidence: OSV · GHSA-6wvx-3r32-xmcg
View original version evidence (0 explicit versions)
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
digitalbazaar · GitHub_M
forge
1 range
digitalbazaar · GitHub_M
forge
Compare with this publisher’s ranges. This does not inspect your installation.
affected
< 1.4.1
Other versions: unknown
Original source description
Summary
The forge.http client stored cookies from Set-Cookie response headers in a plain object keyed by cookie name and path. A malicious server could use the cookie name __proto__ to add properties to Object.prototype, use inherited names such as constructor to add properties to Object, and send an empty cookie value to delete Object.prototype properties. Fixed in node-forge 1.4.1.
Details
client.setCookie() in lib/http.js stored a cookie with client.cookies[cookie.name][cookie.path] = cookie, creating client.cookies[cookie.name] only when !(cookie.name in client.cookies). Both values come from the server's Set-Cookie header via response.getCookies(). Because in also sees inherited properties:
- a cookie named
__proto__skipped the initialization,client.cookies['__proto__']returnedObject.prototype, and the cookie path was written as a newObject.prototypeproperty, visible on every object; - a cookie named
constructorwrote onto the globalObjectfunction the same way; - a cookie with an empty value calls
client.removeCookie(name, path), which used the sameinchecks and thendelete client.cookies[name][path], soSet-Cookie: __proto__=; path=toStringdeletedObject.prototype.toString. This path skipped the cookie's secure-flag and domain checks, so it also worked forhttp://clients.
forge.http is not loaded by require('node-forge'). It is included in the forge.all browser bundle and is used with a socket pool, for example by forge.xhr.
The fix uses own-property checks for the cookie store and ignores cookies named __proto__ or with the path __proto__.
Patches
Fixed in node-forge 1.4.1. Cookies from a server can no longer add or remove properties of Object.prototype or Object.
Workarounds
Don't use forge.http or forge.xhr with servers that aren't trusted, or filter Set-Cookie headers named __proto__, constructor or other Object.prototype property names before they reach the client.
Credits
Reported by @arunmozhivarman-dtx and @Dremig.
Proof of concept
A server response for a forge.http client (http.createClient({url: 'https://...', socketPool: ...})) containing:
Set-Cookie: __proto__=evil; path=polluted
On 1.4.0, after the client processes the response, ({}).polluted is the cookie object. With Set-Cookie: __proto__=; path=toLocaleString, Object.prototype.toLocaleString is deleted (for http:// and https:// clients). On 1.4.1 these cookies are ignored and Object.prototype is unchanged.
Regression tests are in tests/security/ghsa-6wvx-3r32-xmcg.js.
Impact
Applications that use the forge.http client (directly, or through forge.xhr in the forge.all browser bundle) against a server that can be malicious are affected. The server can add properties to Object.prototype and Object for the whole JavaScript realm, which can change application logic that reads properties from plain objects, and can delete built-in Object.prototype methods, breaking the page or process. Applications that don't use forge.http are not affected.
Inside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-118777View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
GitHub_M
Contributing organizations · 2
Assigning organization
Additional data publisher
What changed
Follow changes- CVE · CVE-2026-118777
Observed 2026-10-30T18:55:51.155Z · upstream updated 2026-10-30T17:12:06.088Z
Prioritization updated
before
[]
after
[ { "source": "CISA-ADP", "type": "SSVC", "role": "CISA Coordinator", "timestamp": "2026-10-30T15:20:36.875932Z", "decisions": [ { "name": "Exploitation", "value": "none" }, { "name": "Automatable", "value": "no" }, { "name": "Technical Impact", "value": "partial" } ] } ]
Large field values are marked as truncated previews. Original source snapshots remain retained.
Showing up to 50 most recent observed changes.