{"answers":{"affected":"2 open source packages ship an affected version, including @fastify/oauth2. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-31999 exists.","fix":"Upgrade @fastify/oauth2 to 7.2.0 or later.","what":"CVE-2023-31999 is a high-severity vulnerability in npm @fastify/oauth2, published on 4 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2023-31999 and fix it if it is affected.\n\nWhat it is: CVE-2023-31999 is a high-severity vulnerability in npm @fastify/oauth2, published on 4 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-31999 exists.\n\nAffected packages and fixed versions:\n- @fastify/oauth2 (npm): affected all versions; fixed in 7.2.0\n- @fastify/oauth2 (npm): affected all versions; fixed in 7.2.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-31999/ (Markdown: https://insights.sbomify.com/CVE-2023-31999/index.md)","id":"CVE-2023-31999","markdown":"https://insights.sbomify.com/CVE-2023-31999/index.md","name":"CVE-2023-31999","record":{"aliases":["CVE-2023-35935","GHSA-g8x5-p9qc-cf95"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"Fastify OAuth2 plugin","requires_auth":"none","summary":"An attacker can bypass CSRF protections in the @fastify/oauth2 library due to a static state parameter, potentially allowing unauthorized actions.","user_interaction":"required","vuln_class":"csrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"hackerone","cpe":[{"product":"oauth2","vendor":"fastify"}],"cvss":{"score":8.8,"severity":"high","source":"nvd","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-352","name":"Cross-Site Request Forgery"}],"description":"All versions of @fastify/oauth2 used a statically generated state parameter at startup time and were used across all requests for all users. The purpose of the Oauth2 state parameter is to prevent Cross-Site-Request-Forgery attacks. As such, it should be unique per user and should be connected to the user's session in some way that will allow the server to validate it.\r\n\r\nv7.2.0 changes the default behavior to store the state in a cookie with the http-only and same-site=lax attributes set. The state is now by default generated for every user. Note that this contains a breaking change in the checkStateFunction function, which now accepts the full Request object.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"@fastify/oauth2 vulnerable to Cross Site Request Forgery due to reused Oauth2 state","id":"CVE-2023-31999","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"csrf","year":"2023"},"n_packages":2,"n_references":3,"next":{"headline":"Cross-site scripting in UniFi Network Application","id":"CVE-2023-32000"},"packages":[{"ecosystem":"npm","fixed":["7.2.0"],"introduced":["0"],"last_affected":[],"package":"@fastify/oauth2","purl":null,"source":"GHSA-g8x5-p9qc-cf95"},{"ecosystem":"npm","fixed":["7.2.0"],"introduced":["0"],"last_affected":[],"package":"@fastify/oauth2","purl":"pkg:npm/%40fastify/oauth2","source":"GHSA-g8x5-p9qc-cf95"}],"prev":{"headline":"Memory corruption in Aircube","id":"CVE-2023-31998"},"products":["@fastify/oauth2"],"published":"2023-07-04","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-11-26","vendors":["npm"]},"summary":"An attacker can bypass CSRF protections in the @fastify/oauth2 library due to a static state parameter, potentially allowing unauthorized actions.","url":"https://insights.sbomify.com/CVE-2023-31999/"}