# CVE-2022-24814: Cross-site Scripting in Directus

> Attackers can execute arbitrary JavaScript via crafted iframes in rich text fields, potentially leading to session hijacking or data theft.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 4 Apr 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-xmjj-3c76-5w84

## What is CVE-2022-24814?

CVE-2022-24814 is a high-severity cross-site scripting vulnerability in directus, published on 4 Apr 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Directus is a real-time API and App dashboard for managing SQL database content. Prior to version 9.7.0, unauthorized JavaScript (JS) 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. This issue was resolved in version 9.7.0. As a workaround, disable the live embed in the what-you-see-is-what-you-get by adding `{ "media_live_embeds": false }` to the _Options Overrides_ option of the Rich Text HTML interface.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2022-24814?

2 open source packages ship an affected version, including directus. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `directus` | npm | All versions | 9.7.0 |
| `directus` | npm | All versions | 9.7.0 |

Products: Rangerstudio Directus.

## How do I fix CVE-2022-24814?

Upgrade directus to 9.7.0 or later.

## Is CVE-2022-24814 being exploited?

There is no known exploitation of CVE-2022-24814 in the wild and no public exploit code.

## Other vulnerabilities in directus

- [CVE-2018-10723](https://insights.sbomify.com/CVE-2018-10723/): Hardcoded credentials in n/a (critical 9.8)
- [CVE-2021-29641](https://insights.sbomify.com/CVE-2021-29641/): File upload in n/a (high 8.8)
- [CVE-2021-26594](https://insights.sbomify.com/CVE-2021-26594/): Privilege escalation in n/a (high 8.8)
- [CVE-2023-27474](https://insights.sbomify.com/CVE-2023-27474/): HTML Injection in Password Reset email to custom Reset URL in directus (high 8.0)
- [CVE-2021-26593](https://insights.sbomify.com/CVE-2021-26593/): Information disclosure in n/a (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-24814 and fix it if it is affected.

What it is: CVE-2022-24814 is a high-severity cross-site scripting vulnerability in directus, published on 4 Apr 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-24814 in the wild and no public exploit code.

Affected packages and fixed versions:
- directus (npm): affected all versions; fixed in 9.7.0
- directus (npm): affected all versions; fixed in 9.7.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-24814/ (Markdown: https://insights.sbomify.com/CVE-2022-24814/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-24814
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-24814
- OSV: https://osv.dev/vulnerability/CVE-2022-24814

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-24814/
Summaries are generated and may contain mistakes; the official description above is the record.
