CVE-2022-31549

9.3 CRITICAL

📋 TL;DR

This vulnerability allows attackers to read arbitrary files on the server through absolute path traversal in the olmax99/helm-flask-celery repository. It affects users running vulnerable versions of this Flask-based application before May 25, 2022. The unsafe use of Flask's send_file function enables directory traversal attacks.

💻 Affected Systems

Products:
  • olmax99/helm-flask-celery repository
Versions: All versions before commit 28c985d712d7ac26893433e8035e2e3678fcae9f (2022-05-25)
Operating Systems: All operating systems running Python/Flask
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any deployment using the vulnerable Flask endpoint with send_file function.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise through reading sensitive files like SSH keys, configuration files, or database credentials, potentially leading to remote code execution.

🟠

Likely Case

Unauthorized access to sensitive server files including application source code, configuration files, and system files containing credentials.

🟢

If Mitigated

Limited impact with proper file system permissions and network segmentation preventing access to critical system files.

🌐 Internet-Facing: HIGH - Web applications exposed to the internet are directly vulnerable to exploitation.
🏢 Internal Only: MEDIUM - Internal applications still vulnerable but with reduced attack surface from external actors.

🎯 Exploit Status

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

Path traversal vulnerabilities are well-understood and easily exploitable with simple HTTP requests.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Commit 28c985d712d7ac26893433e8035e2e3678fcae9f

Vendor Advisory: https://github.com/olmax99/helm-flask-celery/commit/28c985d712d7ac26893433e8035e2e3678fcae9f

Restart Required: Yes

Instructions:

1. Update to the patched version from GitHub. 2. Replace unsafe send_file usage with secure alternatives. 3. Restart the Flask application. 4. Verify the fix by testing path traversal attempts.

🔧 Temporary Workarounds

Input Validation Workaround

all

Implement strict input validation to reject path traversal sequences

# In Flask route handler, add validation:
import os
from flask import abort

# Validate file path before send_file
requested_path = request.args.get('file')
if '..' in requested_path or requested_path.startswith('/'):
    abort(400, 'Invalid file path')

Web Application Firewall

linux

Deploy WAF rules to block path traversal patterns

# Example ModSecurity rule:
SecRule ARGS "@contains .." "id:1001,phase:2,deny,msg:'Path Traversal Attempt'"
# Example nginx rule:
location ~* \.\. { deny all; }

🧯 If You Can't Patch

  • Implement strict file system permissions to limit accessible directories
  • Deploy network segmentation to isolate vulnerable application from sensitive systems

🔍 How to Verify

Check if Vulnerable:

Test if the application allows accessing files with '../' sequences or absolute paths in file parameters

Check Version:

git log --oneline -1 # Check last commit hash matches patched version

Verify Fix Applied:

Attempt path traversal attacks after patching; they should return 400/403 errors instead of file contents

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests containing '../' sequences
  • Multiple 403/400 errors from file access attempts
  • Unusual file access patterns in application logs

Network Indicators:

  • HTTP requests with path traversal payloads in parameters
  • Abnormal file download patterns

SIEM Query:

source="web_logs" AND (uri="*..*" OR params="*..*")

🔗 References

📤 Share & Export