CVE-2022-31541

9.3 CRITICAL

📋 TL;DR

This vulnerability allows attackers to read arbitrary files on the server through absolute path traversal in the Barry Voice Assistant Flask application. It affects anyone running the vulnerable version of this open-source voice assistant software. The flaw exists in how the Flask send_file function is implemented without proper path validation.

💻 Affected Systems

Products:
  • Barry Voice Assistant
Versions: All versions through 2021-01-18
Operating Systems: Linux, Windows, macOS
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any deployment using the vulnerable Flask send_file implementation. The repository appears to be abandoned with no official fixes.

📦 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.

🟢

If Mitigated

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

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

The vulnerability is simple to exploit with basic HTTP requests. Public GitHub discussions demonstrate the exploit technique.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: None available

Vendor Advisory: None available

Restart Required: No

Instructions:

No official patch exists. The repository appears abandoned. Consider migrating to alternative voice assistant software or implementing the workarounds below.

🔧 Temporary Workarounds

Implement Path Validation

all

Add proper path validation before calling send_file to prevent directory traversal

# Modify the Flask route to validate file paths
# Example Python code:
import os
from flask import send_file, abort

@app.route('/file/<path:filename>')
def get_file(filename):
    # Normalize and validate path
    safe_path = os.path.normpath(filename)
    if '..' in safe_path or safe_path.startswith('/'):
        abort(403)
    # Restrict to specific directory
    base_dir = '/var/www/files'
    full_path = os.path.join(base_dir, safe_path)
    if not full_path.startswith(base_dir):
        abort(403)
    return send_file(full_path)

Use Flask Safe Path Functions

all

Implement Flask's safe path handling utilities

# Use werkzeug's secure_filename
from werkzeug.utils import secure_filename

@app.route('/file/<filename>')
def get_file(filename):
    safe_name = secure_filename(filename)
    if safe_name != filename:
        abort(403)
    return send_file(os.path.join('/safe/directory', safe_name))

🧯 If You Can't Patch

  • Remove or disable the vulnerable Barry Voice Assistant software entirely
  • Implement strict network access controls to limit who can access the service

🔍 How to Verify

Check if Vulnerable:

Test if you can access files outside the intended directory by making HTTP requests with path traversal sequences like /../../etc/passwd

Check Version:

Check the repository commit date or version information in the application

Verify Fix Applied:

Attempt the same path traversal attacks and verify they return 403 Forbidden or similar error instead of file contents

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests containing '..' sequences or absolute paths
  • 403 Forbidden errors for path traversal attempts
  • Unusual file access patterns

Network Indicators:

  • HTTP requests with path traversal patterns
  • Requests for sensitive system files from web endpoints

SIEM Query:

web_access_logs | where url contains ".." or url contains "/etc/" or url contains "/proc/"

🔗 References

📤 Share & Export