Skip to content

Directus has MySQL accent insensitive email matching

High severity GitHub Reviewed Published Mar 1, 2024 in directus/directus • Updated Mar 2, 2024

Package

npm directus (npm)

Affected versions

<= 10.8.2

Patched versions

10.8.3

Description

Password reset vulnerable to accent confusion

The password reset mechanism of the Directus backend is implemented in a way where combined with (specific, need to double check if i can work around) configuration in MySQL or MariaDB. As such, it allows attackers to receive a password reset email of a victim user, specifically having it arrive at a similar email address as the victim with a one or more characters changed to use accents.

This is due to the fact that by default MySQL/MariaDB are configured for accent-insenstive and case-insensitve comparisons.

MySQL weak comparison:

select 1 from directus_users where 'julian@cure53.de' = 'julian@cüre53.de';

This is exploitable due to an error in the API using the supplied email address for sending the reset password mail instead of using the email from the database.

Steps to reproduce:

  1. If the attacker knows the email address of the victim user, i.e., julian@cure53.de. (possibly just the domain could be enough for an educated guess)
  2. A off-by-one accented domain cüre53.de can be registered to be able to receive emails.
  3. With this email the attacker can request a password reset for julian@cüre53.de.
POST /auth/password/request HTTP/1.1
Host: example.com
[...]
{"email":"julian@cüre53.de"}
  1. The supplied email (julian@cüre53.de) gets checked against the database and will match the non-accented email julian@cure53.de and will continue to email the password reset link to the provided email address instead of the saved email address.
  2. With this email the attacker can log into the target account and use it for nefarious things

Workarounds

Should be possible with collations but haven't been able to confirm this.

References

References

@rijkvanzanten rijkvanzanten published to directus/directus Mar 1, 2024
Published by the National Vulnerability Database Mar 1, 2024
Published to the GitHub Advisory Database Mar 1, 2024
Reviewed Mar 1, 2024
Last updated Mar 2, 2024

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N

EPSS score

0.043%
(10th percentile)

Weaknesses

CVE ID

CVE-2024-27295

GHSA ID

GHSA-qw9g-7549-7wg5

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.