{"id":"GHSA-4xw9-cx39-r355","revision":null,"records":[{"revision":"32ea808b7da14267813e00f463bd5b16","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2023-48238","aliases":[],"title":"JWT Algorithm Confusion in json-web-token library","description":"joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JWT algorithm confusion attack. On line 86 of the 'index.js' file, the algorithm to use for verifying the signature of the JWT token is taken from the JWT token, which at that point is still unverified and thus shouldn't be trusted. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work against this library is the RS256 algorithm is in use, however it is a best practice to use that algorithm. Version 4.0.0 fixes the issue.","state":0,"publishedAt":"2023-11-17T21:35:00.111+00:00","modifiedAt":"2026-06-08T23:38:16.955+00:00","affected":[{"ecosystem":"Vendor product","name":"json-web-token","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"vendor\": \"joaquimserafim\",\n                    \"product\": \"json-web-token\",\n                    \"versions\": [\n                        {\n                            \"version\": \"< 4.0.0\",\n                            \"status\": \"affected\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"severity":"HIGH"}],"references":["https://github.com/joaquimserafim/json-web-token/security/advisories/GHSA-4xw9-cx39-r355","https://github.com/joaquimserafim/json-web-token/commit/b6e56b1346f48432d29133c76b65222ad93956b7"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2023-48238","license":"CVE Program Terms of Use","key":"cve-program:CVE-2023-48238","identifiers":["CVE-2023-48238"]},"retained":false,"historicalAffected":[]},{"revision":"ab35ddc7c3a247878914173f1e0589f9","observedAt":"2026-11-06T23:28:47.194+00:00","statement":{"source":"euvd","id":"EUVD-2023-2883","aliases":["CVE-2023-48238","GHSA-4xw9-cx39-r355"],"title":"joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JW…","description":"joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JWT algorithm confusion attack. On line 86 of the 'index.js' file, the algorithm to use for verifying the signature of the JWT token is taken from the JWT token, which at that point is still unverified and thus shouldn't be trusted. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work against this library is the RS256 algorithm is in use, however it is a best practice to use that algorithm. Version 4.0.0 fixes the issue.","state":0,"publishedAt":null,"modifiedAt":null,"affected":[],"metrics":[{"system":"EUVD CVSS 3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"severity":null}],"references":["https://github.com/joaquimserafim/json-web-token/security/advisories/GHSA-4xw9-cx39-r355","https://github.com/joaquimserafim/json-web-token/commit/b6e56b1346f48432d29133c76b65222ad93956b7"],"sourceUrl":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2023-2883","license":"ENISA EUVD · source terms and attribution apply","enrichment":{"sourceStatus":null,"weaknesses":[],"productCriteria":[],"sourceDates":{"datePublished":"Nov 17, 2023, 9:35:00 PM","dateUpdated":"Jun 8, 2026, 11:38:16 PM"},"relatedAdvisories":[],"note":"EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON."},"key":"euvd:EUVD-2023-2883","identifiers":["EUVD-2023-2883","CVE-2023-48238","GHSA-4xw9-cx39-r355"]},"retained":false,"historicalAffected":[]},{"revision":"a048973b94214b149283a561a3b5758a","observedAt":"2026-10-24T22:17:33.701+00:00","statement":{"source":"nvd","id":"CVE-2023-48238","aliases":[],"title":"joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JW…","description":"joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JWT algorithm confusion attack. On line 86 of the 'index.js' file, the algorithm to use for verifying the signature of the JWT token is taken from the JWT token, which at that point is still unverified and thus shouldn't be trusted. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work against this library is the RS256 algorithm is in use, however it is a best practice to use that algorithm. Version 4.0.0 fixes the issue.","state":0,"publishedAt":"2023-11-17T22:15:07.817+00:00","modifiedAt":"2026-06-17T06:33:48.49+00:00","affected":[],"metrics":[{"system":"CVSS 3.1 · security-advisories@github.com · Secondary","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"severity":"HIGH"},{"system":"CVSS 3.1 · nvd@nist.gov · Primary","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"severity":"HIGH"}],"references":["https://github.com/joaquimserafim/json-web-token/commit/b6e56b1346f48432d29133c76b65222ad93956b7","https://github.com/joaquimserafim/json-web-token/security/advisories/GHSA-4xw9-cx39-r355"],"sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2023-48238","license":"NIST NVD usage terms; underlying source attribution retained","enrichment":{"sourceStatus":"Modified","weaknesses":["CWE-345"],"productCriteria":["cpe:2.3:a:joaquimserafim:json_web_token:*:*:*:*:*:node.js:*:*"],"sourceDates":{"published":"2023-11-17T22:15:07.817","lastModified":"2026-06-17T06:33:48.490"},"relatedAdvisories":[],"note":"NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON."},"key":"nvd:CVE-2023-48238","identifiers":["CVE-2023-48238"]},"retained":false,"historicalAffected":[]},{"revision":"89c90557a64b4769871d891cf3b367a8","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-4xw9-cx39-r355","aliases":["CVE-2023-48238"],"title":"json-web-token library is vulnerable to a JWT algorithm confusion attack","description":"### Summary\nThe json-web-token library is vulnerable to a JWT algorithm confusion attack.\n\n### Details\nOn line 86 of the 'index.js' file, the algorithm to use for verifying the signature of the JWT token is taken from the JWT token, which at that point is still unverified and thus shouldn't be trusted. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work against this library is the RS256 algorithm is in use, however it is a best practice to use that algorithm.\n\n### PoC\nTake a server running the following code:\n```javascript\nconst express = require('express');\nconst jwt = require('json-web-token');\nconst fs = require('fs');\nconst path = require('path');\n\nconst app = express();\nconst port = 3000;\n\n// Load the keys from the file\nconst publicKeyPath = path.join(__dirname, 'public-key.pem');\nconst publicKey = fs.readFileSync(publicKeyPath, 'utf8');\nconst privateKeyPath = path.join(__dirname, 'private-key.pem');\nconst privateKey = fs.readFileSync(privateKeyPath, 'utf8');\n\napp.use(express.json());\n\n// Endpoint to generate a JWT token with admin: False\napp.get('/generateToken', async (req, res) => {\n  const payload = { admin: false, name: req.query.name };\n  const token = await jwt.encode(privateKey, payload, 'RS256', function (err, token) {\n    res.json({ token });\n  });\n});\n\n// Middleware to verify the JWT token\nfunction verifyToken(req, res, next) {\n  const token = req.query.token;\n\n  jwt.decode(publicKey, token, (err, decoded) => {\n    if (err) {\n      console.log(err)\n      return res.status(401).json({ message: 'Token authentication failed' });\n    }\n\n    req.decoded = decoded;\n    next();\n  });\n}\n\n// Endpoint to check if you are the admin or not\napp.get('/checkAdmin', verifyToken, (req, res) => {\n  res.json(req.decoded);\n});\n\napp.listen(port, () => {\n  console.log(`Server is running on port ${port}`);\n});\n```\n\n**Public key recovery**\nFirst, an attacker needs to recover the public key from the server in any way possible. It is possible to extract this from just two JWT tokens as shown below.\nGrab two different JWT tokens and utilize the following tool: `https://github.com/silentsignal/rsa_sign2n/blob/release/standalone/jwt_forgery.py`\n```\npython3 jwt_forgery.py token1 token2\n```\nThe tool will generate 4 different public keys, all in different formats. Try the following for all 4 formats.\n\n**Algorithm confusion**\nChange the JWT to the HS256 algorithm and modify any of the contents to your liking at `https://jwt.io/`.\nCopy the resulting JWT token and use with the following tool: `https://github.com/ticarpi/jwt_tool`.\n```\npython /opt/jwt_tool/jwt_tool.py --exploit k -pk public_key token\n```\nYou will now get a resulting JWT token that is validly signed.\n\n### Impact\nApplications using the RS256 algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads that the verifier will accept.\n\n### Solution\nEither one of the following solutions will work.\n1. Change the signature of the `decode` function to ensure that the algorithm is set in that call\n2. Check whether or not the secret could be a public key in the decode function and in that case, set the key to be a public key.\n\n\n> Fixed in 4.0.0. Both encode and decode now reject combinations where the key type (PEM vs plain secret) doesn't match the algorithm family. Upgrade with npm install json-web-token@^4.","state":0,"publishedAt":"2023-11-17T22:48:15+00:00","modifiedAt":"2026-10-19T20:00:04.7136766+00:00","affected":[{"ecosystem":"npm","name":"json-web-token","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"4.0.0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/joaquimserafim/json-web-token/security/advisories/GHSA-4xw9-cx39-r355","https://nvd.nist.gov/vuln/detail/CVE-2023-48238","https://github.com/joaquimserafim/json-web-token/commit/b6e56b1346f48432d29133c76b65222ad93956b7","https://github.com/joaquimserafim/json-web-token","https://github.com/joaquimserafim/json-web-token/blob/acf6a462471e1b14187eb77414e9161b8b7bff7e/index.js#L86"],"sourceUrl":"https://github.com/advisories/GHSA-4xw9-cx39-r355","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-4xw9-cx39-r355","identifiers":["GHSA-4xw9-cx39-r355","CVE-2023-48238"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-11-08T19:47:20.1649891+00:00","complete":true,"records":1769,"lastAttemptAt":"2026-11-08T19:47:20.1649891+00:00","lastSuccessAt":"2026-11-08T19:47:20.3943637+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:20.3943658+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-eaa64dac63caa79c8d4905619258c41c51b39e461b996124e1a21b5e85e7e738-5ed072895efd00dfc9298eaa4ea0dc8e51b29da4254bc61a9f28835ec1fa6ea6","complete":true,"records":421260,"lastAttemptAt":"2026-11-08T19:47:19.7023073+00:00","lastSuccessAt":"2026-11-08T19:47:19.6080199+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:19.7023073+00:00","snapshotPublishedAt":"2026-11-08T19:27:43+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-f1b70ba09149408c9b3f93f80725b8b9","complete":true,"records":13654,"lastAttemptAt":"2026-11-08T19:48:04.0257169+00:00","lastSuccessAt":"2026-11-08T19:48:04.022+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:48:04.022+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13706,"expectedIdentifiers":13706,"failedIdentifiers":0},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-11-08T19:47:20.1649891+00:00","complete":true,"records":1096,"lastAttemptAt":"2026-11-08T19:47:20.1649891+00:00","lastSuccessAt":"2026-11-08T19:47:20.3951142+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:20.3951146+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-3b79c659b4ac42b2801e63ff6ff3a882","complete":false,"records":13666,"lastAttemptAt":"2026-11-08T19:47:46.1695591+00:00","lastSuccessAt":"2026-11-08T19:47:46.166+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:46.166+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13206,"expectedIdentifiers":13706,"failedIdentifiers":0},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-980593e6977a6d1b4fb1eed5a1ffe88a468736f89f0a06f710924ad59132c023","complete":true,"records":9914,"lastAttemptAt":"2026-11-08T19:47:20.0165357+00:00","lastSuccessAt":"2026-11-08T11:07:07.068788+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:20.0165357+00:00","snapshotPublishedAt":"2026-11-08T11:02:46+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-fde804134ecdda0ddd5ff5c26ee1fff5a6fa659311f7ef2e51c6ad54964db0e2","complete":true,"records":1971,"lastAttemptAt":"2026-11-08T19:47:19.7560084+00:00","lastSuccessAt":"2026-11-06T19:03:17.0399903+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:19.7560084+00:00","snapshotPublishedAt":"2026-11-06T18:17:57+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-964c14035e6f0f6478b2870fad6a7ef9f6045876d4a12af2c2e514521e54b6af","complete":true,"records":3055,"lastAttemptAt":"2026-11-08T19:47:20.1181272+00:00","lastSuccessAt":"2026-11-08T11:07:12.1927025+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:20.1181272+00:00","snapshotPublishedAt":"2026-11-08T11:02:46+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-f8647d7ba64b1ba0dfdc7130944766d5b36d5b77d18fff0c79e651a4cff3c2b9","complete":true,"records":231293,"lastAttemptAt":"2026-11-08T19:47:19.9161497+00:00","lastSuccessAt":"2026-11-08T11:06:56.2918717+00:00","error":null,"lastVerifiedAt":"2026-11-08T19:47:19.9161497+00:00","snapshotPublishedAt":"2026-11-08T11:02:50+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null}]}