GHSA-4JW7-6MQJ-VRHQ
Server-side request forgery in AI chat file downloads bypasses the outbound IP deny-list
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 12.2.0 | directus · -22 d desde divulgación | |
| Divulgación | Publicada | GHSA-4JW7-6MQJ-VRHQ divulgada · CVSS 7.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The AI chat endpoint (`POST /ai/chat`) fetches user-supplied URLs server-side without the IP validation Directus applies
to its other outbound requests. A chat message may include a file part, and the URL carried by that part is passed to
the AI SDK, which downloads any file the target model cannot handle natively using a plain `fetch`. That download does
not go through Directus's IP-validated HTTP agent, so the `IMPORT_IP_DENY_LIST` control does not apply to it.
The AI SDK has its own download guard, but it only rejects literal private IP addresses and the `localhost` family and
performs no DNS resolution. A public hostname that resolves to a private address (for example a name pointing at
`127.0.0.1` or `169.254.169.254`) therefore passes the check and is fetched.
Any authenticated user with app access can use this to make the Directus server issue requests to internal-only
destinations. Administrator rights are not required.
Details
Directus passes client-supplied chat messages to the AI SDK's `streamText` after converting them to model messages. For
any file or image part whose URL the configured model does not support natively, the SDK downloads the content itself
using the default download function, which calls global `fetch` directly. Every other server-side fetch in Directus goes
through `agentWithIpValidation` (`api/src/request/agent-with-ip-validation.ts`), which resolves the target host and
rejects denied addresses; the AI SDK download path did not, so the deny-list was not enforced there.
The URL used for that download is attacker-controlled:
- From 11.16.0 onward, `api/src/ai/chat/lib/transform-file-parts.ts` rewrites each file part's `url` with the value of
- In 11.14.0 through 11.15.x, before that rewrite existed, the file part's `url` field itself was passed through
The SDK's `validateDownloadUrl` guard blocks literal private IP addresses and the `localhost`, `.local`, and
`.localhost` hostnames. Because it does not resolve DNS, a public hostname whose A record points into private space is
accepted, and the request is then made from the Directus process. The response body is read (subject to the SDK's size
limit) and forwarded to the configured LLM provider as file content, where it can surface in the model's reply to the
caller.
Affected endpoint: `POST /ai/chat`.
Preconditions:
- `AI_ENABLED` is true (the default). In 11.14.x the AI router was mounted unconditionally.
- An administrator has configured an LLM provider with an API key, which is the normal state for the feature to be
- The caller is any authenticated user with app access. The handler only checks `req.accountability.app`, so
Impact
Any user with app access can cause the server to issue HTTP requests to destinations that are not reachable from the
network the user is on, including loopback services, RFC1918 hosts, and cloud instance metadata endpoints. This bypasses
the `IMPORT_IP_DENY_LIST` control that protects the rest of Directus's outbound requests.
Because the fetched response body is read and forwarded to the configured LLM provider as file content, the contents of
internal responses (credentials returned by a metadata service, for example) can be exfiltrated to that provider and
surfaced through the model's reply, making this a read-capable SSRF rather than a blind one.
Workarounds
For deployments that cannot upgrade, set `AI_ENABLED=false`, or leave every LLM provider unconfigured (no API key),
which prevents the request from reaching the download path. Restricting app access does not mitigate this, since
ordinary non-admin app users can trigger it.
Credits
Reported by @colinthebomb1
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmdirectus |
Corregida | 12.2.0 | -22 d | 12.6.1 no afectada |
12.2.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/directus/directus/security/advisories/GHSA-4jw7-6mqj-vrhqLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
