GHSA-cf57-c578-7jvv: Anubis vulnerable to possible XSS via redir parameter when using subrequest auth mode
N/A
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| github.com/TecharoHQ/anubis | go | < 1.23.0 | 1.23.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability lies in the lack of input validation for redirect URLs in Anubis's subrequest authentication mode. The analysis of the patch commit 7ed1753fcced351c81961bf520a7bfb2caac6e88 reveals modifications in lib/http.go that address this issue. Two functions were identified as vulnerable:
-
Server.constructRedirectURL: This function constructs a redirect URL based onX-Forwarded-*headers. Before the patch, it did not validate theX-Forwarded-Protoheader, allowing schemes likejavascript:. The patch introduces a validation to only allowhttpandhttpsprotocols. -
Server.ServeHTTPNext: This function handles the/.within.website/endpoint and processes theredirquery parameter. The original code usedurl.Parse, which is too permissive. The patch replaces it withurl.ParseRequestURIand adds explicit scheme validation to prevent schemes likejavascript:,data:, etc.
Both functions are part of the Server struct and are directly involved in handling and constructing redirect URLs. Exploitation would involve a user clicking a crafted link that triggers the subrequest authentication flow with a malicious redir parameter or specially crafted X-Forwarded-Proto header, potentially leading to XSS.
Vulnerable functions
Server.constructRedirectURLlib/http.go
Server.ServeHTTPNextlib/http.go