CVE-2022-31513

9.3 CRITICAL

📋 TL;DR

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

💻 Affected Systems

Products:
  • BolunHan/Krypton repository
Versions: All versions through 2021-06-03
Operating Systems: Any OS running Python/Flask
Default Config Vulnerable: ⚠️ Yes
Notes: Affects deployments using the vulnerable Flask send_file implementation without proper path validation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

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

🟠

Likely Case

Unauthorized access to sensitive files on the server, including configuration files, credentials, and application data.

🟢

If Mitigated

Limited impact with proper input validation, file access restrictions, and security controls in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Path traversal vulnerabilities are commonly exploited and require minimal technical skill.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after 2021-06-03 with proper path validation

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

Restart Required: Yes

Instructions:

1. Update to latest version of Krypton repository. 2. Ensure Flask send_file calls include proper path validation. 3. Restart the application service.

🔧 Temporary Workarounds

Input Validation Middleware

all

Add middleware to validate and sanitize file paths before processing

# Add path validation in Flask routes
from werkzeug.utils import secure_filename
secure_path = secure_filename(requested_path)

File Access Restrictions

linux

Implement chroot jail or containerization to limit file system access

# Run application in restricted environment
sudo chroot /safe/path /app/start.sh

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block path traversal patterns
  • Restrict network access to vulnerable systems and implement strict file permissions

🔍 How to Verify

Check if Vulnerable:

Review Flask route handlers for unsafe send_file usage without path validation

Check Version:

Check repository commit date or version metadata

Verify Fix Applied:

Test with path traversal payloads (e.g., ../../../etc/passwd) to confirm blocked access

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns
  • Requests containing ../ sequences
  • Access to sensitive system files

Network Indicators:

  • HTTP requests with path traversal payloads
  • Unusual file download patterns

SIEM Query:

source="web_logs" AND (uri="*../*" OR uri="*..\\*" OR status=403 OR status=404)

🔗 References

📤 Share & Export