# CVE-2025-47909: Improper validation of TrustedOrigins allows CSRF attacks in github.com/gorilla/csrf

> Network attackers can bypass CSRF protections via TrustedOrigins misconfiguration, allowing cross-site request forgery attacks against Go applications.

- **Severity:** High 7.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Aug 2025
- **Updated:** 29 Aug 2025
- **Also known as:** DEBIAN-CVE-2025-47909, ECHO-03c6-4c08-d89d, GHSA-82ff-hg59-8x73, GO-2025-3884, MINI-2xw7-mgw7-xv73, MINI-62r2-xxh4-hxvp, MINI-766h-829w-jqvg, MINI-8h6x-mv5w-823x, MINI-9x2w-qjgq-7472, MINI-cgrq-f9m4-h349, MINI-h9px-hqgf-wf26, MINI-j9g6-wr5v-55gf, MINI-m48j-xw9q-3c76, UBUNTU-CVE-2025-47909

## What is CVE-2025-47909?

CVE-2025-47909 is a high-severity vulnerability in github.com/gorilla/csrf, published on 29 Aug 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Hosts listed in TrustedOrigins implicitly allow requests from the corresponding HTTP origins, allowing network MitMs to perform CSRF attacks. After the CVE-2025-24358 fix, a network attacker that places a form at http://example.com can't get it to submit to https://example.com because the Origin header is checked with sameOrigin against a synthetic URL. However, if a host is added to TrustedOrigins, both its HTTP and HTTPS origins will be allowed, because the schema of the synthetic URL is ignored and only the host is checked. For example, if an application is hosted on https://example.com and adds example.net to TrustedOrigins, a network attacker can serve a form at http://example.net to perform the attack. Applications should migrate to net/http.CrossOriginProtection, introduced in Go 1.25. If that is not an option, a backport is available as a module at filippo.io/csrf, and a drop-in replacement for the github.com/gorilla/csrf API is available at filippo.io/csrf/gorilla.

Weakness: CWE-346 (Origin Validation Error)

## Which versions are affected by CVE-2025-47909?

3 open source packages ship an affected version, including github.com/gorilla/csrf.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gorilla/csrf` | Go | All versions to 1.7.3 | None |
| `github.com/gorilla/csrf` | Go | All versions to 1.7.3 | None |
| `github.com/gorilla/csrf` | Go | From 1.7.3 | None |

## How do I fix CVE-2025-47909?

Upgrade to a fixed version.

## Is CVE-2025-47909 being exploited?

There is no known exploitation of CVE-2025-47909 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-47909 and fix it if it is affected.

What it is: CVE-2025-47909 is a high-severity vulnerability in github.com/gorilla/csrf, published on 29 Aug 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-47909 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/gorilla/csrf (Go): affected all versions up to 1.7.3; no fix listed
- github.com/gorilla/csrf (Go): affected all versions up to 1.7.3; no fix listed
- github.com/gorilla/csrf (Go): affected from 1.7.3; no fix listed

Task:
1. 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.
2. 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.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-47909/ (Markdown: https://insights.sbomify.com/CVE-2025-47909/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-47909
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-47909
- OSV: https://osv.dev/vulnerability/CVE-2025-47909

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-47909/
Summaries are generated and may contain mistakes; the official description above is the record.
