CVE-2024-42367

4.8 MEDIUM

📋 TL;DR

This vulnerability in aiohttp allows attackers to perform path traversal attacks when static routes contain compressed file variants (.gz or .br) that are symbolic links. It affects aiohttp servers using static file serving with compressed variants, potentially allowing unauthorized file access outside the designated root directory. Users running aiohttp 3.10.x versions before 3.10.2 are affected.

💻 Affected Systems

Products:
  • aiohttp
Versions: 3.10.0 through 3.10.1
Operating Systems: All operating systems running Python
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using static file serving with compressed variants (.gz or .br) that are symbolic links. The default follow_symlinks=False setting provides partial protection.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could read sensitive files outside the web root directory, potentially accessing configuration files, credentials, or other sensitive system data.

🟠

Likely Case

Limited file disclosure from directories adjacent to the web root, depending on server configuration and symbolic link placement.

🟢

If Mitigated

No impact if follow_symlinks=False (default) and no compressed variant symbolic links exist in static directories.

🌐 Internet-Facing: MEDIUM - Requires specific conditions (compressed variant symbolic links) and path traversal attempts, but could lead to data exposure.
🏢 Internal Only: LOW - Internal servers typically have more controlled environments and fewer symbolic links in web directories.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires specific server configuration with symbolic links to compressed variants and knowledge of path traversal techniques.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.10.2

Vendor Advisory: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-jwhx-xcg6-8xhj

Restart Required: Yes

Instructions:

1. Upgrade aiohttp to version 3.10.2 or later using pip: pip install --upgrade aiohttp==3.10.2
2. Restart all aiohttp server processes
3. Verify the upgrade with: python -c "import aiohttp; print(aiohttp.__version__)"

🔧 Temporary Workarounds

Disable compressed variant support

linux

Remove or disable .gz and .br compressed files from static directories to prevent exploitation.

find /path/to/static -name "*.gz" -type l -delete
find /path/to/static -name "*.br" -type l -delete

Set follow_symlinks=False explicitly

all

Ensure static routes are configured with follow_symlinks=False (already default but can be enforced).

# In aiohttp app setup: app.router.add_static('/static', 'path/to/static', follow_symlinks=False)

🧯 If You Can't Patch

  • Remove all symbolic links from static directories serving compressed variants
  • Implement web application firewall rules to block path traversal patterns in URLs

🔍 How to Verify

Check if Vulnerable:

Check aiohttp version and inspect static directories for symbolic links to .gz or .br files

Check Version:

python -c "import aiohttp; print(aiohttp.__version__)"

Verify Fix Applied:

Verify aiohttp version is 3.10.2 or higher and test path traversal attempts return appropriate errors

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests with ../ patterns targeting .gz or .br files
  • 404 errors for compressed files outside normal paths
  • Unusual file access patterns in static directories

Network Indicators:

  • HTTP requests containing path traversal sequences with .gz or .br extensions
  • Unusual file downloads from static routes

SIEM Query:

web_access_logs WHERE url CONTAINS '../' AND (url ENDS WITH '.gz' OR url ENDS WITH '.br')

🔗 References

📤 Share & Export