CVE-2024-42367: Aiohttp Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-jwhx-xcg6-8xhj
CVSS 4.8
CWE-61
Published
Advisory Summary

CVE-2024-42367 is a MODERATE (CVSS 4.8) path traversal vulnerability (CWE-61: UNIX Symbolic Link (Symlink) Following) affecting Aiohttp libraries in the PyPI ecosystem. The issue involves in aiohttp, compressed files as symlinks are not protected from path traversal. Remediation is available by upgrading affected packages to version 3.10.2.

CVE-2024-42367 at a Glance

CVE Identifier CVE-2024-42367
GHSA Identifier GHSA-jwhx-xcg6-8xhj
Severity MODERATE
CVSS v3.1 Base Score 4.8
CWE Classification CWE-61: UNIX Symbolic Link (Symlink) Following
Affected Product Aiohttp
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-42367

To remediate this vulnerability, upgrade all affected Aiohttp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aiohttp fixed: 3.10.2
pip install aiohttp>=3.10.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show aiohttp

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-42367, inspect your installed packages using pip:

pip show aiohttp

Analyze the terminal output to locate any version of Aiohttp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.10.2), your application is affected.

Note: The pip show aiohttp command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-61: UNIX Symbolic Link (Symlink) Following, where the product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. this could allow an attacker to cause the product to operate on unauthorized files. In Aiohttp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Static routes which contain files with compressed variants (`.gz` or `.br` extension) were vulnerable to path traversal outside the root directory if those variants are symbolic links. ### Details The server protects static routes from path traversal outside the root directory when `follow_symlinks=False` (default). It does this by resolving the requested URL to an absolute path and then checking that path relative to the root. However, these checks are not performed when looking for compressed variants in the `FileResponse` class, and symbolic links are then automatically followed when performing `Path.stat()` and `Path.open()` to send the file. ### Impact Servers with static routes that contain compressed variants as symbolic links, pointing outside the root directory, or that permit users to upload or create such links, are impacted. ---- Patch: https://github.com/aio-libs/aiohttp/pull/8653/files

CVE-2024-42367 Affected Aiohttp Versions

1 component(s)
Fixed Versions:
3.10.2
Product / Package Ecosystem Affected Versions Fixed Version
aiohttp
PyPI
≥ 3.10.0b1
< 3.10.2
3.10.2

References

Frequently Asked Questions

What is CVE-2024-42367?
CVE-2024-42367 is a security vulnerability in Aiohttp involving In aiohttp, compressed files as symlinks are not protected from path traversal under CWE-61: UNIX Symbolic Link (Symlink) Following.
Which Aiohttp versions are affected?
Affected versions include releases prior to 3.10.2 across affected packages: aiohttp.
What version fixes CVE-2024-42367?
Upgrading to 3.10.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aiohttp affected?
Yes, aiohttp is affected in releases prior to 3.10.2. Upgrade your dependency to 3.10.2 or later.
What is the CVSS score of CVE-2024-42367?
CVE-2024-42367 has a CVSS v3.1 base score of 4.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2024-42367?
CVE-2024-42367 is classified under CWE-61: UNIX Symbolic Link (Symlink) Following (The product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. This could allow an attacker to cause the product to operate on unauthorized files.).
How can I check PyPI dependencies for CVE-2024-42367?
Run the dependency tree command: 'pip show aiohttp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jwhx-xcg6-8xhj",
  "modified" : "2025-06-09T12:17:20Z",
  "published" : "2024-08-09T16:49:58Z",
  "aliases" : [ "CVE-2024-42367" ],
  "summary" : "In aiohttp, compressed files as symlinks are not protected from path traversal",
  "details" : "### Summary\nStatic routes which contain files with compressed variants (`.gz` or `.br` extension) were vulnerable to path traversal outside the root directory if those variants are symbolic links.\n\n### Details\nThe server protects static routes from path traversal outside the root directory when `follow_symlinks=False` (default).  It does this by resolving the requested URL to an absolute path and then checking that path relative to the root.  However, these checks are not performed when looking for compressed variants in the `FileResponse` class, and symbolic links are then automatically followed when performing `Path.stat()` and `Path.open()` to send the file.\n\n### Impact\nServers with static routes that contain compressed variants as symbolic links, pointing outside the root directory, or that permit users to upload or create such links, are impacted.\n\n----\n\nPatch: https://github.com/aio-libs/aiohttp/pull/8653/files",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "aiohttp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.10.0b1"
      }, {
        "fixed" : "3.10.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aio-libs/aiohttp/security/advisories/GHSA-jwhx-xcg6-8xhj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-42367"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aio-libs/aiohttp/pull/8653"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aio-libs/aiohttp/commit/ce2e9758814527589b10759a20783fb03b98339f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aio-libs/aiohttp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aio-libs/aiohttp/blob/e0ff5246e1d29b7710ab1a2bbc972b48169f1c05/aiohttp/web_fileresponse.py#L177"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aio-libs/aiohttp/blob/e0ff5246e1d29b7710ab1a2bbc972b48169f1c05/aiohttp/web_urldispatcher.py#L674"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-61" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-09T16:49:58Z",
    "nvd_published_at" : "2024-08-12T13:38:34Z"
  }
}