# CVE-2023-27474: HTML Injection in Password Reset email to custom Reset URL in directus

> Attackers can inject HTML into password reset emails via custom reset URLs, potentially leading to XSS and account takeover in Directus instances.

- **Severity:** High 8.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N`)
- **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:** 6 Mar 2023
- **Updated:** 25 Feb 2025
- **Also known as:** GHSA-4hmq-ggrm-qfc6

## What is CVE-2023-27474?

CVE-2023-27474 is a high-severity cross-site scripting vulnerability in directus, published on 6 Mar 2023. 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. Instances relying on an allow-listed reset URL are vulnerable to an HTML injection attack through the use of query parameters in the reset URL. An attacker could exploit this to email users urls to the servers domain but which may contain malicious code. The problem has been resolved and released under version 9.23.0. People relying on a custom password reset URL should upgrade to 9.23.0 or later, or remove the custom reset url from the configured allow list. Users are advised to upgrade. Users unable to upgrade may disable the custom reset URL allow list as a workaround.

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

## Which versions are affected by CVE-2023-27474?

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


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

Products: Rangerstudio Directus.

## How do I fix CVE-2023-27474?

Upgrade directus to 9.23.0 or later.

## Is CVE-2023-27474 being exploited?

There is no known exploitation of CVE-2023-27474 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-2022-24814](https://insights.sbomify.com/CVE-2022-24814/): Cross-site Scripting in Directus (high 8.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-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-2023-27474 and fix it if it is affected.

What it is: CVE-2023-27474 is a high-severity cross-site scripting vulnerability in directus, published on 6 Mar 2023. 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-2023-27474 in the wild and no public exploit code.

Affected packages and fixed versions:
- directus (npm): affected all versions; fixed in 9.23.0
- directus (npm): affected all versions; fixed in 9.23.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-2023-27474/ (Markdown: https://insights.sbomify.com/CVE-2023-27474/index.md)
```

## Sources

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

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