Default CORS Reflects Any Origin with Credentials
Description
Severity: Low for Community Edition, Medium for cookie-based deployments CWE: CWE-942 (Permissive Cross-domain Policy with Untrusted Domains) Affected version: v0.112.0 (latest as of 2026-05-30), clidey/whodb:latest Affected file: core/src/router/router.go (setupMiddlewares())
Summary
If WHODB_ALLOWED_ORIGINS is not set (the default), WhoDB allows the origin patterns https://* and http://* and also sets Access-Control-Allow-Credentials: true. The CORS library treats those patterns as match-anything, so it reflects whatever Origin the request carried and marks credentialed requests as allowed.
Root cause
// core/src/router/router.go
allowedOrigins := env.AllowedOrigins
if len(allowedOrigins) == 0 {
allowedOrigins = append(allowedOrigins, "https://*", "http://*")
}
cors.Handler(cors.Options{
AllowedOrigins: allowedOrigins,
AllowCredentials: true,
MaxAge: 300,
})go-chi/cors matches http://* and https://* against any host and, with AllowCredentials: true, reflects the exact request Origin back. That is the combination CORS guidance warns against.
PoC
curl -s -i -X OPTIONS http://localhost:8080/api/query \
-H "Origin: https://evil.attacker.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: content-type,authorization"Response headers:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://evil.attacker.com
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: POST
Access-Control-Allow-Headers: Content-Type, AuthorizationThe attacker's origin is reflected and credentials are allowed.
Impact
How much this matters depends on how the instance stores its auth, so it is worth splitting:
- Community Edition stores the session token in the browser's
localStorageand sends it as aAuthorization: Bearerheader. Attacker JavaScript on another site cannot read that token and cannot set theAuthorizationheader for a cross-origin request, so it cannot read authenticated responses. The practical exposure here is limited to endpoints that are already unauthenticated (for exampleSourceProfiles), which an attacker could also just request directly if they can reach the instance. - Cookie-based deployments (Enterprise Edition or a reverse proxy that uses a session cookie) are the real problem. There the browser sends the cookie automatically, so a malicious site can make authenticated requests on the victim's behalf and read the responses. That is full cross-site request forgery plus data theft.
So this is low severity for default CE and a genuine issue for any cookie-based setup.
Severity (CVSS 3.1)
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N = 4.7 (Moderate), and effectively Low for the localStorage-based CE default. Cookie-based deployments are higher because integrity is also affected.
Remediation
- Do not default to wildcard origins. If
WHODB_ALLOWED_ORIGINSis not set, allow same-origin only. - Never combine
AllowCredentials: truewith wildcard origin patterns. If credentials are needed, require an explicit list of origins. - Document
WHODB_ALLOWED_ORIGINSas a security setting.
Test environment
clidey/whodb:latest(v0.112.0), default config, noWHODB_ALLOWED_ORIGINSset.- Tested with several arbitrary origins, all reflected.
- Tested 2026-05-31.