{"answers":{"affected":"3 open source packages ship an affected version, including github.com/justinas/nosurf. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-46721 exists.","fix":"Upgrade github.com/justinas/nosurf to 1.2.0 or later.","what":"CVE-2025-46721 is a medium-severity vulnerability in justinas nosurf, published on 13 May 2025. 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-2025-46721 and fix it if it is affected.\n\nWhat it is: CVE-2025-46721 is a medium-severity vulnerability in justinas nosurf, published on 13 May 2025. 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-2025-46721 exists.\n\nAffected packages and fixed versions:\n- github.com/justinas/nosurf (Go): affected all versions; fixed in 1.2.0\n- github.com/justinas/nosurf (Go): affected all versions; fixed in 1.2.0\n- github.com/justinas/nosurf (Go): affected all versions; fixed in 1.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-2025-46721/ (Markdown: https://insights.sbomify.com/CVE-2025-46721/index.md)","id":"CVE-2025-46721","markdown":"https://insights.sbomify.com/CVE-2025-46721/index.md","name":"CVE-2025-46721","record":{"aliases":["GHSA-w9hf-35q4-vcjw","GO-2025-3683"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"Go CSRF middleware","requires_auth":"none","summary":"An attacker with control over site content or subdomains can bypass CSRF protections in the nosurf Go library to perform actions on behalf of users.","user_interaction":"required","vuln_class":"csrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"nosurf","vendor":"nosurf_project"}],"cvss":{"score":6,"severity":"medium","source":"cna","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N","version":"4.0"},"cwes":[{"id":"CWE-352","name":"Cross-Site Request Forgery"}],"description":"nosurf is cross-site request forgery (CSRF) protection middleware for Go. A vulnerability in versions prior to 1.2.0 allows an attacker who controls content on the target site, or on a subdomain of the target site (either via XSS, or otherwise) to bypass CSRF checks and issue requests on user's behalf. Due to misuse of the Go `net/http` library, nosurf categorizes all incoming requests as plain-text HTTP requests, in which case the `Referer` header is not checked to have the same origin as the target webpage. If the attacker has control over HTML contents on either the target website (e.g. `example.com`), or on a website hosted on a subdomain of the target (e.g. `attacker.example.com`), they will also be able to manipulate cookies set for the target website. By acquiring the secret CSRF token from the cookie, or overriding the cookie with a new token known to the attacker, `attacker.example.com` is able to craft cross-site requests to `example.com`. A patch for the issue was released in nosurf 1.2.0. In lieu of upgrading to a patched version of nosurf, users may additionally use another HTTP middleware to ensure that a non-safe HTTP request is coming from the same origin (e.g. by requiring a `Sec-Fetch-Site: same-origin` header in the request).","ecosystems":["Go"],"exploits":{"exploitdb":0,"first_seen":"2025-04-30","github_poc":1,"max_poc_stars":0,"metasploit":0,"nuclei":0,"refs":[{"date":"2025-04-30T13:53:32Z","kind":"github_poc","ref":"https://github.com/justinas/nosurf-cve-2025-46721","stars":0,"title":null}],"tier":"weaponised"},"has_fix":true,"headline":"nosurf vulnerable to CSRF due to non-functional same-origin request checks","id":"CVE-2025-46721","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Go","product":null,"products":[],"type":"csrf","year":"2025"},"n_packages":3,"n_references":5,"next":{"headline":"vLLM has a Weakness in MultiModalHasher Image Hashing Implementation","id":"CVE-2025-46722"},"packages":[{"ecosystem":"Go","fixed":["1.2.0"],"introduced":["0"],"last_affected":[],"package":"github.com/justinas/nosurf","purl":null,"source":"GHSA-w9hf-35q4-vcjw"},{"ecosystem":"Go","fixed":["1.2.0"],"introduced":["0"],"last_affected":[],"package":"github.com/justinas/nosurf","purl":"pkg:golang/github.com/justinas/nosurf","source":"GHSA-w9hf-35q4-vcjw"},{"ecosystem":"Go","fixed":["1.2.0"],"introduced":["0"],"last_affected":[],"package":"github.com/justinas/nosurf","purl":"pkg:golang/github.com/justinas/nosurf","source":"GO-2025-3683"}],"prev":{"headline":"Keystone has an unintended `isFilterable` bypass that can be used as an oracle to match hidden fields","id":"CVE-2025-46720"},"products":["nosurf"],"published":"2025-05-13","related":[{"cvss_score":7.5,"headline":"Improper input validation in github.com/justinas/nosurf","id":"CVE-2020-36564","kev_date_added":null,"published":"2022-12-27"}],"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":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"},{"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)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"partial"},"state":"PUBLISHED","updated":"2025-05-13","vendors":["justinas"]},"summary":"An attacker with control over site content or subdomains can bypass CSRF protections in the nosurf Go library to perform actions on behalf of users.","url":"https://insights.sbomify.com/CVE-2025-46721/"}