CVE-2022-23868

7.8 HIGH

📋 TL;DR

RuoYi v4.7.2 contains a CSV injection vulnerability in the admin module that allows attackers to embed malicious formulas in exported Excel log files. When victims open these .xlsx files in spreadsheet applications like Microsoft Excel, the formulas can execute arbitrary commands on the victim's system. This affects administrators and users who download and open log files from vulnerable RuoYi installations.

💻 Affected Systems

Products:
  • RuoYi
Versions: v4.7.2 and possibly earlier versions
Operating Systems: Any OS running RuoYi (typically Linux/Windows servers)
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the admin module's log export functionality. Only affects systems where log export feature is enabled and accessible.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution on victim's workstation when malicious Excel file is opened, potentially leading to full system compromise, data theft, or lateral movement within the network.

🟠

Likely Case

Local command execution on the victim's machine when Excel automatically executes embedded formulas, allowing attackers to steal credentials, install malware, or access sensitive files.

🟢

If Mitigated

Limited impact if Excel security settings block automatic formula execution or if users are trained not to open untrusted Excel files.

🌐 Internet-Facing: MEDIUM - Attackers could craft malicious log exports if they can access the admin interface, but exploitation requires user interaction (opening the file).
🏢 Internal Only: HIGH - Internal attackers or compromised accounts could target administrators with malicious log exports, potentially gaining access to administrative workstations.

🎯 Exploit Status

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

Exploitation requires access to the admin interface to generate malicious log exports. The vulnerability is well-documented in public issue trackers with technical details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after v4.7.2

Vendor Advisory: https://gitee.com/y_project/RuoYi/issues/I4RBBD

Restart Required: Yes

Instructions:

1. Upgrade RuoYi to the latest version. 2. Verify the fix by checking that CSV/Excel exports properly sanitize formula characters. 3. Restart the application server.

🔧 Temporary Workarounds

Disable log export functionality

all

Temporarily disable the log export feature in the admin interface to prevent generation of malicious Excel files.

Modify application configuration to remove log export endpoints or disable the feature in admin panel

Implement output sanitization

all

Add input validation to sanitize formula characters (=, +, -, @) in log data before Excel export.

Implement CSV injection protection by prefixing formula characters with single quote (') or escaping them

🧯 If You Can't Patch

  • Restrict access to admin interface to trusted users only using network segmentation and strong authentication
  • Educate users to never open Excel files from untrusted sources and configure Excel to disable automatic formula execution

🔍 How to Verify

Check if Vulnerable:

Check if RuoYi version is 4.7.2 or earlier and test if log export generates Excel files with unsanitized formula characters.

Check Version:

Check application.properties or version file in RuoYi installation directory

Verify Fix Applied:

After patching, test log export functionality to ensure formula characters are properly escaped or prefixed with single quotes.

📡 Detection & Monitoring

Log Indicators:

  • Unusual log export requests, especially with crafted log entries containing formula characters

Network Indicators:

  • Large number of log export requests from single IP, unusual patterns in admin interface access

SIEM Query:

source="ruoyi-admin" AND (event="log_export" OR url_path="/admin/log/export")

🔗 References

📤 Share & Export