# GHSA-C746-GJC8-G9HH: Default CORS Reflects Any Origin with Credentials

- Database: GitHub
- Severity: CVSS 4.7 (Medium)
- Published: 2026-09-25
- Modified: 2026-09-25

## Affected versions

- github.com/clidey/whodb (Go): through 0.112.0

## 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

```go
// 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

```bash
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, Authorization
```

The 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 `localStorage` and sends it as a `Authorization: Bearer` header. Attacker JavaScript on another site cannot read that token and cannot set the `Authorization` header for a cross-origin request, so it cannot read authenticated responses. The practical exposure here is limited to endpoints that are already unauthenticated (for example `SourceProfiles`), 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

1. Do not default to wildcard origins. If `WHODB_ALLOWED_ORIGINS` is not set, allow same-origin only.
2. Never combine `AllowCredentials: true` with wildcard origin patterns. If credentials are needed, require an explicit list of origins.
3. Document `WHODB_ALLOWED_ORIGINS` as a security setting.

## Test environment

- `clidey/whodb:latest` (v0.112.0), default config, no `WHODB_ALLOWED_ORIGINS` set.
- Tested with several arbitrary origins, all reflected.
- Tested 2026-05-31.

## References

- https://github.com/clidey/whodb/security/advisories/GHSA-c746-gjc8-g9hh

Page: https://cve.now/GHSA-C746-GJC8-G9HH

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
