CVE-2024-27295: Directus Directus Has MySQL Accent Insensitive Vulnerability

HIGH
Advisory Identifier: GHSA-qw9g-7549-7wg5
CVSS 8.2
CWE-706
Published
Advisory Summary

CVE-2024-27295 is a HIGH (CVSS 8.2) directus has mysql accent insensitive vulnerability (CWE-706: Use of Incorrectly-Resolved Name or Reference) affecting Directus libraries in the npm ecosystem. The issue involves directus has mysql accent insensitive email matching. Remediation is available by upgrading affected packages to version 10.8.3.

CVE-2024-27295 at a Glance

CVE Identifier CVE-2024-27295
GHSA Identifier GHSA-qw9g-7549-7wg5
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-706: Use of Incorrectly-Resolved Name or Reference
Affected Product Directus
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-27295

To remediate this vulnerability, upgrade all affected Directus dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

directus fixed: 10.8.3
npm install directus@10.8.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls directus

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-27295, inspect your project dependencies using npm:

npm ls directus

Analyze the terminal output to locate any version of Directus in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.8.3), your application is affected.

Note: The npm ls directus 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-706: Use of Incorrectly-Resolved Name or Reference, where the product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere. In Directus, 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

## 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: ```sql 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`. ```http POST /auth/password/request HTTP/1.1 Host: example.com [...] {"email":"julian@cüre53.de"} ``` 4. 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. 5. 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 - https://www.monolune.com/articles/what-is-the-utf8mb4_0900_ai_ci-collation/ - https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html

CVE-2024-27295 Affected Directus Versions

1 component(s)
Fixed Versions:
10.8.3
Product / Package Ecosystem Affected Versions Fixed Version
directus
npm
< 10.8.3
10.8.3

References

Frequently Asked Questions

What is CVE-2024-27295?
CVE-2024-27295 is a security vulnerability in Directus involving Directus has MySQL accent insensitive email matching under CWE-706: Use of Incorrectly-Resolved Name or Reference.
Which Directus versions are affected?
Affected versions include releases prior to 10.8.3 across affected packages: directus.
What version fixes CVE-2024-27295?
Upgrading to 10.8.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is directus affected?
Yes, directus is affected in releases prior to 10.8.3. Upgrade your dependency to 10.8.3 or later.
What is the CVSS score of CVE-2024-27295?
CVE-2024-27295 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2024-27295?
CVE-2024-27295 is classified under CWE-706: Use of Incorrectly-Resolved Name or Reference (The product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere.).
How can I check npm dependencies for CVE-2024-27295?
Run the dependency tree command: 'npm ls directus'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qw9g-7549-7wg5",
  "modified" : "2024-03-01T18:58:40Z",
  "published" : "2024-03-01T16:58:20Z",
  "aliases" : [ "CVE-2024-27295" ],
  "summary" : "Directus has MySQL accent insensitive email matching",
  "details" : "## Password reset vulnerable to accent confusion\n\nThe 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. \n\nThis is due to the fact that by default MySQL/MariaDB are configured for accent-insenstive and case-insensitve comparisons.\n\nMySQL weak comparison:\n```sql\nselect 1 from directus_users where 'julian@cure53.de' = 'julian@cüre53.de';\n```\n\nThis 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.\n\n### Steps to reproduce:\n\n1. 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)\n2. A off-by-one accented domain `cüre53.de` can be registered to be able to receive emails.\n3. With this email the attacker can request a password reset for `julian@cüre53.de`. \n```http\nPOST /auth/password/request HTTP/1.1\nHost: example.com\n[...]\n{\"email\":\"julian@cüre53.de\"}\n```\n4. 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.\n5. With this email the attacker can log into the target account and use it for nefarious things\n\n### Workarounds\nShould be possible with collations but haven't been able to confirm this. \n\n### References\n- https://www.monolune.com/articles/what-is-the-utf8mb4_0900_ai_ci-collation/\n- https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "directus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "10.8.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 10.8.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/security/advisories/GHSA-qw9g-7549-7wg5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27295"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/commit/a8ef790ea2d28b1727f9027d99bd360920d57919"
  }, {
    "type" : "WEB",
    "url" : "https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/directus/directus"
  }, {
    "type" : "WEB",
    "url" : "https://www.monolune.com/articles/what-is-the-utf8mb4_0900_ai_ci-collation"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-706" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-01T16:58:20Z",
    "nvd_published_at" : "2024-03-01T16:15:46Z"
  }
}