CVE-2023-39001

9.8 CRITICAL

📋 TL;DR

This CVE describes a command injection vulnerability in OPNsense's diag_backup.php component that allows attackers to execute arbitrary commands by uploading a malicious backup configuration file. Attackers can achieve remote code execution with high privileges. Affected users include all OPNsense Community Edition users before version 23.7 and Business Edition users before version 23.4.2.

💻 Affected Systems

Products:
  • OPNsense Community Edition
  • OPNsense Business Edition
Versions: Community Edition < 23.7, Business Edition < 23.4.2
Operating Systems: OPNsense (FreeBSD-based)
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the backup functionality which is typically accessible to authenticated users with appropriate permissions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with root-level access, allowing attackers to install persistent backdoors, exfiltrate sensitive data, pivot to internal networks, or disrupt network operations.

🟠

Likely Case

Remote code execution leading to network device compromise, credential theft, and potential lateral movement within the network infrastructure.

🟢

If Mitigated

Limited impact if proper network segmentation, file upload restrictions, and least privilege principles are implemented.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

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

Exploitation requires authenticated access to the backup functionality. The vulnerability is well-documented with public proof-of-concept details available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Community Edition 23.7+, Business Edition 23.4.2+

Vendor Advisory: https://github.com/opnsense/core/commit/e800097d0c287bb665f0751a98a67c75ef7b45e5

Restart Required: No

Instructions:

1. Log into OPNsense web interface. 2. Navigate to System > Firmware > Updates. 3. Check for and apply available updates. 4. Verify version is updated to Community Edition 23.7+ or Business Edition 23.4.2+.

🔧 Temporary Workarounds

Disable backup functionality

all

Temporarily disable the backup functionality until patching can be completed

Restrict backup file uploads

all

Implement strict file upload validation and sanitization for backup files

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate OPNsense devices from critical internal networks
  • Apply strict access controls to limit which users can access the backup functionality

🔍 How to Verify

Check if Vulnerable:

Check OPNsense version via web interface (System > Firmware > Status) or CLI: 'opnsense-version'

Check Version:

opnsense-version

Verify Fix Applied:

Verify version is Community Edition 23.7+ or Business Edition 23.4.2+ using same methods

📡 Detection & Monitoring

Log Indicators:

  • Unusual backup file uploads
  • Suspicious commands executed via backup process
  • Unexpected system modifications following backup operations

Network Indicators:

  • Unusual outbound connections from OPNsense device
  • Suspicious traffic patterns from firewall management interface

SIEM Query:

source="opnsense" AND (event="backup_upload" OR event="diag_backup") AND (command="*" OR process="*sh" OR process="*bash")

🔗 References

📤 Share & Export