GO-2025-3884

Source
https://pkg.go.dev/vuln/GO-2025-3884
Import Source
https://vuln.go.dev/ID/GO-2025-3884.json
JSON Data
https://api.test.osv.dev/v1/vulns/GO-2025-3884
Aliases
Published
2025-08-29T15:42:26Z
Modified
2025-08-29T21:14:35.387800Z
Summary
Improper validation of TrustedOrigins allows CSRF attacks in github.com/gorilla/csrf
Details

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.

Database specific
{
    "review_status": "REVIEWED",
    "url": "https://pkg.go.dev/vuln/GO-2025-3884"
}
References
Credits
    • Filippo Valsorda

Affected packages

Go / github.com/gorilla/csrf

Package

Name
github.com/gorilla/csrf
View open source insights on deps.dev
Purl
pkg:golang/github.com/gorilla/csrf

Affected ranges

Type
SEMVER
Events
Introduced
1.7.3

Ecosystem specific

{
    "imports": [
        {
            "symbols": [
                "TrustedOrigins"
            ],
            "path": "github.com/gorilla/csrf"
        }
    ]
}