CVE-2022-24814: Directus Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-xmjj-3c76-5w84
CVSS 8.8
CWE-79
Published
Advisory Summary

CVE-2022-24814 is a HIGH (CVSS 8.8) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Directus libraries in the npm ecosystem. The issue involves improper neutralization of input during web page generation ('cross-site scripting') in directus. Remediation is available by upgrading affected packages to version 9.7.0.

CVE-2022-24814 at a Glance

CVE Identifier CVE-2022-24814
GHSA Identifier GHSA-xmjj-3c76-5w84
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Directus
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:R/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2022-24814

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: 9.7.0
npm install directus@9.7.0
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-2022-24814, 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 9.7.0), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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

### Impact Unauthorized JavaScript can be executed by inserting an iframe into the rich text html interface that links to a file uploaded HTML file that loads another uploaded JS file in its script tag. This satisfies the regular content security policy header, which in turn allows the file to run any arbitrary JS. ### Patches This was resolved in https://github.com/directus/directus/pull/12020 which is released in 9.7.0 ### Workarounds You can disable the live embed in the WYSIWYG by adding `{ "media_live_embeds": false }` to the _Options Overrides_ option of the Rich Text HTML interface. ### References https://github.com/directus/directus/pull/12020 ### For more information If you have any questions or comments about this advisory: * Open an issue in [directus/directus](https://github.com/directus/directus) * Email us at [security@directus.io](mailto:security@directus.io)

CVE-2022-24814 Affected Directus Versions

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

References

Frequently Asked Questions

What is CVE-2022-24814?
CVE-2022-24814 is a security vulnerability in Directus involving Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in directus under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Directus versions are affected?
Affected versions include releases prior to 9.7.0 across affected packages: directus.
What version fixes CVE-2022-24814?
Upgrading to 9.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is directus affected?
Yes, directus is affected in releases prior to 9.7.0. Upgrade your dependency to 9.7.0 or later.
What is the CVSS score of CVE-2022-24814?
CVE-2022-24814 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-24814?
CVE-2022-24814 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2022-24814?
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-xmjj-3c76-5w84",
  "modified" : "2022-04-05T18:30:15Z",
  "published" : "2022-04-05T18:30:15Z",
  "aliases" : [ "CVE-2022-24814" ],
  "summary" : "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in directus",
  "details" : "### Impact\n\nUnauthorized JavaScript can be executed by inserting an iframe into the rich text html interface that links to a file uploaded HTML file that loads another uploaded JS file in its script tag. This satisfies the regular content security policy header, which in turn allows the file to run any arbitrary JS.\n\n### Patches\n\nThis was resolved in https://github.com/directus/directus/pull/12020 which is released in 9.7.0\n\n### Workarounds\n\nYou can disable the live embed in the WYSIWYG by adding `{ \"media_live_embeds\": false }` to the _Options Overrides_ option of the Rich Text HTML interface.\n\n### References\n\nhttps://github.com/directus/directus/pull/12020\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [directus/directus](https://github.com/directus/directus)\n* Email us at [security@directus.io](mailto:security@directus.io)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "directus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.7.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/security/advisories/GHSA-xmjj-3c76-5w84"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24814"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/pull/12020"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/directus/directus"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/releases/tag/v9.7.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-05T18:30:15Z",
    "nvd_published_at" : "2022-04-04T18:15:00Z"
  }
}