# GHSA-22rr-f3p8-5gf8: Directus affected by VM2 sandbox escape vulnerability

> Attackers can escape the VM2 sandbox in Directus flows to execute arbitrary code in the main Node.js context.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Sep 2023

## What is GHSA-22rr-f3p8-5gf8?

GHSA-22rr-f3p8-5gf8 is a code injection vulnerability in directus, published on 15 Sep 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact
In vm2 for versions up to 3.9.19, Promise handler sanitization can be bypassed, allowing attackers to escape the sandbox and run arbitrary code. Within Directus this applies to the "Run Script" operation in flows being able to escape the sandbox running code in the main nodejs context.

### Patches
Patched in v10.6.0 by replacing `vm2` with `isolated-vm`

### Workarounds
None

### References
https://github.com/patriksimek/vm2/security/advisories/GHSA-cchq-frgv-rjh5

## Which versions are affected by GHSA-22rr-f3p8-5gf8?

2 open source packages ship an affected version, including directus.


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

## How do I fix GHSA-22rr-f3p8-5gf8?

Upgrade directus to 10.6.0 or later.

## Is GHSA-22rr-f3p8-5gf8 being exploited?

There is no known exploitation of GHSA-22rr-f3p8-5gf8 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-22rr-f3p8-5gf8 and fix it if it is affected.

What it is: GHSA-22rr-f3p8-5gf8 is a code injection vulnerability in directus, published on 15 Sep 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-22rr-f3p8-5gf8 in the wild and no public exploit code.

Affected packages and fixed versions:
- directus (npm): affected all versions; fixed in 10.6.0
- directus (npm): affected all versions; fixed in 10.6.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/GHSA-22rr-f3p8-5gf8/ (Markdown: https://insights.sbomify.com/GHSA-22rr-f3p8-5gf8/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-22rr-f3p8-5gf8

---
From sbomify Insights: https://insights.sbomify.com/GHSA-22rr-f3p8-5gf8/
Summaries are generated and may contain mistakes; the official description above is the record.
