CVE-2022-31531

9.3 CRITICAL

📋 TL;DR

This vulnerability allows attackers to read arbitrary files on the server through absolute path traversal in the dainst/cilantro repository. It affects users running vulnerable versions of this software, particularly those exposing it to untrusted networks. The flaw exists because Flask's send_file function is used without proper path validation.

💻 Affected Systems

Products:
  • dainst/cilantro
Versions: through 0.0.4
Operating Systems: All operating systems running Python/Flask
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any deployment using the vulnerable code path with Flask's send_file function.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise through reading sensitive files like /etc/passwd, SSH keys, configuration files, or database credentials, potentially leading to full system takeover.

🟠

Likely Case

Unauthorized access to sensitive server files containing credentials, configuration data, or user information, enabling further attacks.

🟢

If Mitigated

Limited impact if proper network segmentation, file permissions, and input validation are in place, though the vulnerability still exists.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Path traversal vulnerabilities are easily exploitable with simple HTTP requests. Public GitHub issues demonstrate the vulnerability.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after 0.0.4

Vendor Advisory: https://github.com/dainst/cilantro/security/advisories

Restart Required: Yes

Instructions:

1. Update to the latest version of dainst/cilantro. 2. Verify the fix implements proper path validation. 3. Restart the application service.

🔧 Temporary Workarounds

Input Validation Middleware

all

Add middleware to validate and sanitize file paths before they reach send_file function

Implement custom Flask middleware that checks for path traversal patterns like '../', '..\\', absolute paths

Web Application Firewall Rules

all

Configure WAF to block path traversal patterns in requests

Add WAF rules to detect and block patterns like '/etc/', '/proc/', '../', absolute paths

🧯 If You Can't Patch

  • Implement strict file system permissions to limit what files the application user can access
  • Deploy behind reverse proxy with strict URL filtering and input validation

🔍 How to Verify

Check if Vulnerable:

Check if running cilantro version 0.0.4 or earlier and if the application uses Flask's send_file without proper path validation

Check Version:

pip show cilantro | grep Version

Verify Fix Applied:

Test that path traversal attempts (e.g., requests for '/etc/passwd' or '../../etc/passwd') are properly blocked

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests containing path traversal patterns like '../', '..\\', '/etc/', absolute paths
  • Failed file access attempts to sensitive system paths

Network Indicators:

  • HTTP requests with unusual file paths or directory traversal sequences
  • Responses containing sensitive file contents

SIEM Query:

source="web_logs" AND (uri="*../*" OR uri="*/etc/*" OR uri="*/proc/*" OR uri="*/root/*")

🔗 References

📤 Share & Export