Update module github.com/gorilla/csrf to v1.7.3 [SECURITY] #7

Open
renovate wants to merge 1 commit from renovate/go-github.com-gorilla-csrf-vulnerability into sr2
Member

This PR contains the following updates:

Package Change Age Confidence
github.com/gorilla/csrf v1.7.2v1.7.3 age confidence

github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks

CVE-2025-47909 / GHSA-82ff-hg59-8x73 / GO-2025-3884

More information

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.

Severity

  • CVSS Score: 4.6 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:U

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


gorilla/csrf CSRF vulnerability due to broken Referer validation

CVE-2025-24358 / GHSA-rq77-p4h8-4crw / GO-2025-3607

More information

Details

Summary

gorilla/csrf is vulnerable to CSRF via form submission from origins that share a top level domain with the target origin.

Details

gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice.

	// URL specifies either the URI being requested (for server
	// requests) or the URL to access (for client requests).
	//
	// For server requests, the URL is parsed from the URI
	// supplied on the Request-Line as stored in RequestURI.  For
	// most requests, fields other than Path and RawQuery will be
	// empty. (See [RFC 7230, Section 5.3](https://rfc-editor.org/rfc/rfc7230.html#section-5.3))
	//
	// For client requests, the URL's Host specifies the server to
	// connect to, while the Request's Host field optionally
	// specifies the Host header value to send in the HTTP
	// request.
	URL *[url](https://pkg.go.dev/net/url).[URL](https://pkg.go.dev/net/url#URL)
PoC
  • create trusted origin target.example.test protected with gorilla/csrf and served over TLS hosting form on /submit
  • create attacker origin attack.example.test served over TLS
  • attacker exfiltrates token & cookie combination from target.example.test
  • attacker sets exfiltrated cookie with domain=.example.test and path=/submit
    • as the cookie has a more specific path than / (the default for CSRF cookies) it will be sent first by the browser on submit to our target origin
  • submit form from attack.example.test with exfiltrated CSRF form token
  • observe valid form submission as attack.example.test Origin / Referer headers are not validated.
Impact

This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain.

This bug has existed in gorilla/csrf since its initial release in 2015.

Severity

  • CVSS Score: 5.4 / 10 (Medium)
  • Vector String: 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/E:P

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf

CVE-2025-24358 / GHSA-rq77-p4h8-4crw / GO-2025-3607

More information

Details

gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf

Severity

Unknown

References

This data is provided by OSV and the Go Vulnerability Database (CC-BY 4.0).


Release Notes

gorilla/csrf (github.com/gorilla/csrf)

v1.7.3

Compare Source

This Release fixes the following:

  • CVE-2025-24358

Full Changelog: https://github.com/gorilla/csrf/compare/v1.7.2...v1.7.3


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate.

This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [github.com/gorilla/csrf](https://github.com/gorilla/csrf) | `v1.7.2` → `v1.7.3` | ![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgorilla%2fcsrf/v1.7.3?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgorilla%2fcsrf/v1.7.2/v1.7.3?slim=true) | --- ### github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks [CVE-2025-47909](https://nvd.nist.gov/vuln/detail/CVE-2025-47909) / [GHSA-82ff-hg59-8x73](https://github.com/advisories/GHSA-82ff-hg59-8x73) / [GO-2025-3884](https://pkg.go.dev/vuln/GO-2025-3884) <details> <summary>More information</summary> #### 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. #### Severity - CVSS Score: 4.6 / 10 (Medium) - Vector String: `CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:U` #### References - [https://nvd.nist.gov/vuln/detail/CVE-2025-47909](https://nvd.nist.gov/vuln/detail/CVE-2025-47909) - [https://github.com/golang/vulndb/issues/3884](https://github.com/golang/vulndb/issues/3884) - [https://github.com/gorilla/csrf](https://github.com/gorilla/csrf) - [https://pkg.go.dev/vuln/GO-2025-3884](https://pkg.go.dev/vuln/GO-2025-3884) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-82ff-hg59-8x73) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### gorilla/csrf CSRF vulnerability due to broken Referer validation [CVE-2025-24358](https://nvd.nist.gov/vuln/detail/CVE-2025-24358) / [GHSA-rq77-p4h8-4crw](https://github.com/advisories/GHSA-rq77-p4h8-4crw) / [GO-2025-3607](https://pkg.go.dev/vuln/GO-2025-3607) <details> <summary>More information</summary> #### Details ##### Summary gorilla/csrf is vulnerable to CSRF via form submission from origins that share a top level domain with the target origin. ##### Details gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the `r.URL.Scheme` value. However, this value is never populated for "server" requests [per the Go spec](https://pkg.go.dev/net/http#Request), and so this check does not run in practice. ``` // URL specifies either the URI being requested (for server // requests) or the URL to access (for client requests). // // For server requests, the URL is parsed from the URI // supplied on the Request-Line as stored in RequestURI. For // most requests, fields other than Path and RawQuery will be // empty. (See [RFC 7230, Section 5.3](https://rfc-editor.org/rfc/rfc7230.html#section-5.3)) // // For client requests, the URL's Host specifies the server to // connect to, while the Request's Host field optionally // specifies the Host header value to send in the HTTP // request. URL *[url](https://pkg.go.dev/net/url).[URL](https://pkg.go.dev/net/url#URL) ``` ##### PoC - create trusted origin `target.example.test` protected with gorilla/csrf and served over TLS hosting form on `/submit` - create attacker origin `attack.example.test` served over TLS - attacker exfiltrates token & cookie combination from `target.example.test` - attacker sets exfiltrated cookie with `domain=.example.test and path=/submit` - as the cookie has a more specific path than `/` (the default for CSRF cookies) it will be sent first by the browser on submit to our target origin - submit form from `attack.example.test` with exfiltrated CSRF form token - observe valid form submission as `attack.example.test` Origin / Referer headers are not validated. ##### Impact This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This bug has existed in gorilla/csrf since its initial release in 2015. #### Severity - CVSS Score: 5.4 / 10 (Medium) - Vector String: `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/E:P` #### References - [https://github.com/gorilla/csrf/security/advisories/GHSA-rq77-p4h8-4crw](https://github.com/gorilla/csrf/security/advisories/GHSA-rq77-p4h8-4crw) - [https://nvd.nist.gov/vuln/detail/CVE-2025-24358](https://nvd.nist.gov/vuln/detail/CVE-2025-24358) - [https://github.com/gorilla/csrf/commit/9dd6af1f6d30fc79fb0d972394deebdabad6b5eb](https://github.com/gorilla/csrf/commit/9dd6af1f6d30fc79fb0d972394deebdabad6b5eb) - [https://github.com/gorilla/csrf](https://github.com/gorilla/csrf) - [https://lists.debian.org/debian-lts-announce/2025/05/msg00002.html](https://lists.debian.org/debian-lts-announce/2025/05/msg00002.html) - [https://pkg.go.dev/vuln/GO-2025-3607](https://pkg.go.dev/vuln/GO-2025-3607) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-rq77-p4h8-4crw) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf [CVE-2025-24358](https://nvd.nist.gov/vuln/detail/CVE-2025-24358) / [GHSA-rq77-p4h8-4crw](https://github.com/advisories/GHSA-rq77-p4h8-4crw) / [GO-2025-3607](https://pkg.go.dev/vuln/GO-2025-3607) <details> <summary>More information</summary> #### Details gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf #### Severity Unknown #### References - [https://github.com/gorilla/csrf/security/advisories/GHSA-rq77-p4h8-4crw](https://github.com/gorilla/csrf/security/advisories/GHSA-rq77-p4h8-4crw) - [https://nvd.nist.gov/vuln/detail/CVE-2025-24358](https://nvd.nist.gov/vuln/detail/CVE-2025-24358) - [https://github.com/gorilla/csrf/commit/9dd6af1f6d30fc79fb0d972394deebdabad6b5eb](https://github.com/gorilla/csrf/commit/9dd6af1f6d30fc79fb0d972394deebdabad6b5eb) This data is provided by [OSV](https://osv.dev/vulnerability/GO-2025-3607) and the [Go Vulnerability Database](https://github.com/golang/vulndb) ([CC-BY 4.0](https://github.com/golang/vulndb#license)). </details> --- ### Release Notes <details> <summary>gorilla/csrf (github.com/gorilla/csrf)</summary> ### [`v1.7.3`](https://github.com/gorilla/csrf/releases/tag/v1.7.3) [Compare Source](https://github.com/gorilla/csrf/compare/v1.7.2...v1.7.3) This Release fixes the following: - CVE-2025-24358 **Full Changelog**: <https://github.com/gorilla/csrf/compare/v1.7.2...v1.7.3> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODYuNSIsInVwZGF0ZWRJblZlciI6IjQzLjE4Ni41IiwidGFyZ2V0QnJhbmNoIjoic3IyIiwibGFiZWxzIjpbXX0=-->
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin renovate/go-github.com-gorilla-csrf-vulnerability:renovate/go-github.com-gorilla-csrf-vulnerability
git switch renovate/go-github.com-gorilla-csrf-vulnerability

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch sr2
git merge --no-ff renovate/go-github.com-gorilla-csrf-vulnerability
git switch renovate/go-github.com-gorilla-csrf-vulnerability
git rebase sr2
git switch sr2
git merge --ff-only renovate/go-github.com-gorilla-csrf-vulnerability
git switch renovate/go-github.com-gorilla-csrf-vulnerability
git rebase sr2
git switch sr2
git merge --no-ff renovate/go-github.com-gorilla-csrf-vulnerability
git switch sr2
git merge --squash renovate/go-github.com-gorilla-csrf-vulnerability
git switch sr2
git merge --ff-only renovate/go-github.com-gorilla-csrf-vulnerability
git switch sr2
git merge renovate/go-github.com-gorilla-csrf-vulnerability
git push origin sr2
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sr2/docker-cshare!7
No description provided.