CVE-2022-31543

9.3 CRITICAL

📋 TL;DR

This vulnerability allows attackers to read arbitrary files on the server through absolute path traversal in the SetupBox repository. It affects any system running SetupBox version 1.0 or earlier that exposes the vulnerable Flask endpoint. The vulnerability occurs because the Flask send_file function is used without proper path validation.

💻 Affected Systems

Products:
  • maxtortime/SetupBox
Versions: through 1.0
Operating Systems: All operating systems running Python/Flask
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any deployment using the vulnerable Flask endpoint without additional path validation.

📦 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 remote code execution.

🟠

Likely Case

Information disclosure of sensitive server files, potentially exposing credentials, configuration data, or other confidential information.

🟢

If Mitigated

Limited impact with proper file system permissions and network segmentation, though information disclosure risk remains.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires only HTTP requests with crafted paths to the vulnerable endpoint.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Not available

Vendor Advisory: https://github.com/github/securitylab/issues/669#issuecomment-1117265726

Restart Required: Yes

Instructions:

1. Remove or disable the SetupBox application. 2. Implement proper path validation if continuing to use the codebase. 3. Consider using alternative software with proper security controls.

🔧 Temporary Workarounds

Implement Path Validation

all

Add input validation to sanitize file paths before passing to send_file function

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

# Validate path is within allowed directory
base_dir = '/safe/directory'
requested_path = os.path.join(base_dir, filename)
if not requested_path.startswith(base_dir):
    abort(403)

Network Access Control

linux

Restrict network access to the vulnerable endpoint

# Using iptables to restrict access:
iptables -A INPUT -p tcp --dport [PORT] -s [TRUSTED_IP] -j ACCEPT
iptables -A INPUT -p tcp --dport [PORT] -j DROP

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate the vulnerable system
  • Deploy a WAF with path traversal protection rules

🔍 How to Verify

Check if Vulnerable:

Test if the Flask endpoint accepts absolute paths like /../../etc/passwd or full paths like /etc/passwd

Check Version:

Check the repository version or application configuration for SetupBox version

Verify Fix Applied:

Verify that path traversal attempts return error responses instead of file contents

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests containing path traversal patterns (../, /etc/, /root/)
  • Unusual file access patterns from web endpoints

Network Indicators:

  • HTTP requests with suspicious path parameters
  • Traffic to sensitive file paths from external sources

SIEM Query:

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

🔗 References

📤 Share & Export