CVE-2025-46721
nosurf vulnerable to CSRF due to non-functional same-origin request checks
Check your servers for CVE-2025-46721
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-46721 affects nosurf, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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).
Severity (CVSS)
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
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Attack requirements
- present: an attack works only when the target is in a certain state or configuration
- Privileges required
- none: the attacker does not need an account
- User interaction
- passive: a user has to take part without knowing, such as by viewing a page
- Impact on the vulnerable system
- confidentiality none, integrity high, availability none: what an attacker can read, change or stop in the vulnerable component
- Impact on other systems
- confidentiality none, integrity none, availability none: what an attacker can read, change or stop beyond it
Exploitation
EPSS 0.25%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 17.2% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 13 May 2025):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-352 Cross-Site Request Forgery
Affected products
As the CNA lists them.
Is my server affected?
Find the installed version of nosurf and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i nosurf
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2025-46721 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2025-46721RHEL, Rocky, Alma, Fedora
rpm -q nosurf
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2025-46721Alpine
apk list --installed | grep -i nosurfWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-46721
trivy image --scanners vuln IMAGE | grep CVE-2025-46721
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
Exploits and proof of concept
- https://github.com/advisories/GHSA-rq77-p4h8-4crw github.com · exploit
Other references
- https://github.com/justinas/nosurf/commit/ec9bb776d8e5ba9e906b6eb70428f4e7b009feee github.com
- https://github.com/justinas/nosurf-cve-2025-46721 github.com
- https://github.com/justinas/nosurf/releases/tag/v1.2.0 github.com
Source: the record CVE-2025-46721 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse