CVE-2022-31557

9.3 CRITICAL

📋 TL;DR

This vulnerability allows attackers to perform absolute path traversal attacks in the seveas/golem repository, enabling unauthorized file access. It affects systems running vulnerable versions of this software that use Flask's send_file function unsafely. The high CVSS score indicates severe impact potential.

💻 Affected Systems

Products:
  • seveas/golem
Versions: All versions through 2016-05-17
Operating Systems: Any OS running Python/Flask
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects deployments using the vulnerable Flask send_file implementation in the golem repository.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through arbitrary file read/write, potentially leading to sensitive data exposure, privilege escalation, or remote code execution.

🟠

Likely Case

Unauthorized access to sensitive files on the server, including configuration files, credentials, or application source code.

🟢

If Mitigated

Limited impact with proper file system permissions and network segmentation, potentially only exposing non-sensitive files.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Path traversal vulnerabilities are well-understood and easily exploitable with minimal technical skill.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A

Vendor Advisory: https://github.com/github/securitylab/issues/669

Restart Required: Yes

Instructions:

1. Upgrade to a version after 2016-05-17 if available
2. Implement proper input validation for file paths
3. Use Flask's safe file handling functions
4. Restart the application service

🔧 Temporary Workarounds

Implement Input Validation

all

Add strict validation for file path parameters to prevent directory traversal sequences

# Add validation in Flask route handlers
# Example: validate_path = re.compile(r'^[a-zA-Z0-9_\-\.]+$')

Use Flask Safe Functions

all

Replace unsafe send_file usage with secure alternatives that validate paths

# Replace: send_file(requested_path)
# With: send_file(safe_path, as_attachment=True)

🧯 If You Can't Patch

  • Implement strict network access controls to limit exposure
  • Deploy web application firewall with path traversal protection rules

🔍 How to Verify

Check if Vulnerable:

Review Flask route handlers for unsafe send_file usage with user-controlled paths

Check Version:

Check repository commit history or version metadata for dates before 2016-05-17

Verify Fix Applied:

Test path traversal attempts (e.g., '../../etc/passwd') and verify they are blocked

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed file access attempts with traversal sequences
  • Unusual file access patterns outside expected directories

Network Indicators:

  • HTTP requests containing '../' sequences in file parameters
  • Unusual file extensions or paths in URLs

SIEM Query:

web.url:*../* AND (response.status:403 OR response.status:404)

🔗 References

📤 Share & Export