CVE-2023-52333
Executive Summary
CVE-2023-52333 is a critical directory traversal vulnerability in Allegra’s saveFile method, allowing authenticated remote attackers to write arbitrary files and achieve remote code execution (RCE) in the context of LOCAL SERVICE. The flaw stems from insufficient validation of user-supplied paths before file operations. Although authentication is required, Allegra’s built-in registration mechanism enables attackers to create accounts with sufficient privileges, making exploitation feasible for unauthenticated actors in practice. The CVSS score is 9.8 (Critical), and no official patch has been released. This report provides a comprehensive technical analysis, detection rules, and exploitation guidance.
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
This vulnerability is not related to NPM, PyPI, Go, or Ruby ecosystems. It affects the Allegra application directly, which is a proprietary software product. No open-source package or dependency is involved.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Base Score: 9.8 (Critical)
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (but registration mechanism reduces barrier)
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High
The threat level is critical due to the ease of exploitation, high impact, and lack of a patch. Attackers can gain full control over the affected system.
Deep Dive & Mechanics
The vulnerability exists in the saveFile method of Allegra. The application fails to properly sanitize user-supplied file paths, allowing directory traversal sequences (e.g., ../) to escape the intended upload directory. An authenticated attacker can craft a request to write arbitrary files to any location on the filesystem, including executable files (e.g., ASPX, PHP, JSP) in web-accessible directories. This leads to remote code execution under the LOCAL SERVICE account, which has elevated privileges on Windows systems.
The registration mechanism is a key enabler: attackers can create a user account with sufficient privileges (e.g., "Contributor" or "Editor") without needing prior credentials. Once authenticated, they can exploit the saveFile endpoint.
Vulnerable vs. Patched Code
Since no official patch is available, the vulnerable code pattern is described generically:
Vulnerable Code (Conceptual):
public void saveFile(string fileName, byte[] fileData) {
string path = Path.Combine(uploadDirectory, fileName);
File.WriteAllBytes(path, fileData);
}
The fileName parameter is not validated, allowing ../../Windows/System32/evil.exe.
Patched Code (Expected):
public void saveFile(string fileName, byte[] fileData) {
string safeFileName = Path.GetFileName(fileName); // strips path
string path = Path.Combine(uploadDirectory, safeFileName);
if (!path.StartsWith(uploadDirectory)) throw new SecurityException();
File.WriteAllBytes(path, fileData);
}
The fix should use Path.GetFileName to remove directory traversal and verify the final path is within the intended directory.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to Allegra instance with registration enabled.
- Ability to create a user account (e.g., via
/registerendpoint).
Exploitation Steps:
- Register a new user with sufficient privileges (e.g., role "Contributor").
- Authenticate and obtain a session token.
- Craft a POST request to the
saveFileendpoint with a malicious filename:../../inetpub/wwwroot/evil.aspx - Upload a web shell (e.g., ASPX file) as the file content.
- Access the uploaded shell via browser:
http://target/evil.aspx - Execute commands as LOCAL SERVICE.
Example Request (cURL):
curl -X POST https://target/allegra/api/saveFile \
-H "Authorization: Bearer <token>" \
-F "file=@evil.aspx;filename=../../inetpub/wwwroot/evil.aspx"
Lab Setup:
- Use a Windows VM with Allegra installed (trial version).
- Enable registration and create a test user.
- Monitor file system changes with ProcMon.
Blue Team
Detection:
- Monitor for file writes outside expected upload directories (e.g.,
C:\ProgramData\Allegra\uploads\). - Alert on filenames containing
..or absolute paths. - Review IIS logs for unusual POST requests to
saveFilewith path traversal patterns.
Hunting:
- Search for files created in web directories (e.g.,
wwwroot,inetpub) with recent timestamps. - Check for unexpected ASPX/PHP files in non-standard locations.
- Correlate user registration events with subsequent file uploads.
Indicators of Compromise (IOCs)
- File Paths:
C:\inetpub\wwwroot\*.aspx(unexpected)C:\Windows\Temp\*.exeC:\ProgramData\Allegra\uploads\..\..\*
- Network Patterns:
- POST requests to
/allegra/api/saveFilewithfilenameparameter containing../ - User-agent strings from automated tools (e.g.,
curl,python-requests)
- POST requests to
- Registry Keys:
HKLM\SYSTEM\CurrentControlSet\Services\AllegraService(modified)
- Processes:
w3wp.exespawningcmd.exeorpowershell.exe
- Logs:
- Windows Event ID 4663 (file write) with path containing
.. - IIS logs with
200status forsaveFileand subsequentevil.aspxaccess
- Windows Event ID 4663 (file write) with path containing
Detection Engineering
YARA Rule
rule CVE_2023_52333_Allegra_Traversal {
meta:
description = "Detects directory traversal attempts in Allegra saveFile requests"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-52333"
strings:
$traversal = /\.\.\/|\.\.\\/
$savefile = "saveFile" nocase
condition:
$savefile and $traversal
}
Sigma Rule
title: Allegra Directory Traversal via saveFile
id: 8f4b3c2a-1e5d-4f7b-9a0c-3d6e8f2b1a4c
status: experimental
description: Detects path traversal attempts in Allegra saveFile endpoint
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: iis
detection:
selection:
cs-uri-query|contains:
- 'saveFile'
- '../'
- '..\\'
condition: selection
falsepositives:
- Legitimate use of relative paths in other contexts
level: high
Suricata Rule
alert http any any -> any any (
msg:"CVE-2023-52333 Allegra Directory Traversal in saveFile";
flow:to_server,established;
content:"saveFile"; http_uri; nocase;
content:"../"; http_uri; distance:0;
sid:1000001;
rev:1;
reference:cve,2023-52333;
classtype:attempted-admin;
)
Remediation & Mitigation
Immediate Actions:
- Disable user registration if not required.
- Restrict access to the
saveFileendpoint via firewall or web application firewall (WAF) rules blocking../patterns. - Monitor for anomalous file writes and user registrations.
Long-term Fix:
- Apply input validation to the
saveFilemethod: strip directory traversal sequences and ensure the final path is within the intended upload directory. - Implement a whitelist of allowed file extensions.
- Run the application service with least privileges (not LOCAL SERVICE if possible).
- Contact Allegra vendor for an official patch.
Workaround:
- Use a reverse proxy to block requests containing
../in thefilenameparameter. - Example Nginx rule:
location /allegra/api/saveFile { if ($arg_filename ~* "\.\.") { return 403; } }
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.