Go Vulnerability Database
GO-2024-2955
Gin mishandles a wildcard in the origin string in github.com/gin-contrib/cors
Details
Gin-Gonic CORS middleware mishandles a wildcard at the end of an origin string. Examples: https://example.community/* is accepted by the origin string https://example.com/* and http://localhost.example.com/* is accepted by the origin string http://localhost/* .
Affected packages
| Ecosystem | Package | Affected versions |
|---|---|---|
| Go | github.com/gin-contrib/cors | All versions before 1.6.0 (fixed in 1.6.0) |
References
- https://github.com/advisories/GHSA-869c-j7wc-8jqv
- https://github.com/gin-contrib/cors/commit/27b723a473efd80d5a498fa9f5933c80204c850d
- https://github.com/gin-contrib/cors/pull/106
- https://github.com/gin-contrib/cors/pull/57
- https://github.com/gin-contrib/cors/compare/v1.5.0...v1.6.0
- https://github.com/gin-contrib/cors/releases/tag/v1.6.0