Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-45262 — facturascripts

🔴 CVSS 9.5 — Critical ✅ No Known Exploit CWE-89 OSV
9.5
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

FacturaScripts: Authenticated SQL injection in the FacturaScripts REST API filter parameter via parenthesis bypass in Where::sqlColumn

Summary

> Live PoC verified 2026-04-30 against a stock FacturaScripts master at 127.0.0.1:8081. A scoped ApiKey with fullaccess=0 and an ApiAccess row granting allowget=1 on the clientes resource only (no other rights, no UI session, no admin) issued one GET /api/3/clientes?filter[(0)UNION%20SELECT%20...]= request and the response body contained the raw bcrypt hash of the admin user's password ($2y$12$sLfA/XCqnjqLmYJwK.2V7eUHrHTHcQfkTYYfs1.lxX3OHrsmmkMGO) and the admin's logkey cookie value. The leaked logkey was injected into a fresh cookie jar and GET /AdminPlugins returned 200 with the admin plugin management UI. End-to-end account takeover from a read-only token with no CSRF, no second factor, no rate-limit interaction beyond the default 5-incident IP throttle.

Core/Where.php::sqlColumn() exempts any field name that contains both ( and ) from identifier escaping. The two API filter builders (APIModel::getWhereValues and ApiAttachedFiles::getWhereValues) feed the raw request key ($_GET['filter'][$key]) straight into new DataBaseWhere($key, $value, '=', ...). When the model's all() reaches Where::multiSqlLegacy -> Where::sql() -> Where::sqlColumn($key), the parenthesis branch returns the attacker-controlled string unmodified. The string is concatenated into WHERE <attacker> = '<value>', which an attacker can pivot to WHERE (0)UNION SELECT ... FROM users WHERE(nick='admin')-- = 'value', leaking arbitrary columns from any table.

Details

the API filter pipeline never validates filter keys

Core/Lib/API/APIModel.php:300-322 (listAll):

```php

protected function listAll(): bool

{

$filter = $this->request->query->getArray('filter');

$limit = $this->request->query->getInt('limit', 50);

$offset = $this->request->query->getInt('offset', 0);

$operation = $this->request->query->getArray('operation');

$order = $this->request->query->getArray('sort');

// obtenemos los registros

$data = [];

$hidden = $this->model->getApiFieldsToHide();

$where = $this->getWhereValues($filter, $operation);

foreach ($this->model->all($where, $order, $offset, $limit) as $item) {

$data[] = $this->filterHidden($item->toArray(true), $hidden);

}

...

```

Core/Lib/API/APIModel.php:231-298 (getWhereValues):

```php

private function getWhereValues($filter, $operation, $defaultOperation = 'AND'): array

{

$where = [];

foreach ($filter as $key => $value) {

$field = $key; // (1) raw request key

$operator = '=';

switch (substr($key, -3)) { // suffix routing only

case '_gt': $field = substr($key, 0, -3); $operator = '>'; break;

case '_is': $field = substr($key, 0, -3); $operator = 'IS'; break;

case '_lt': $field = substr($key, 0, -3); $operator = '<'; break;

}

...

if (!isset($operation[$key])) {

$operation[$key] = $defaultOperation;

}

$where[] = new DataBaseWhere($field, $value, $operator, $operation[$key]); // (2)

}

return $where;

}

```

The function only ever reads the suffix to decide an operator. The remaining identifier - up to 252 characters in MariaDB and unrestricted by the framework - is preserved verbatim and handed to DataBaseWhere. There is no allow-list of legal column names, no preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/') like the autocomplete hardening in BaseController::autocompleteAction (commit b8aa78b), and no plug-in hook through which the operator could intervene.

The exact same code (line-for-line, plus a files parameter) lives in Core/Controller/ApiAttachedFiles.php::getWhereValues (lines 172-239), so the bug is present on both the generic /api/3/<resource> route and the dedicated /api/3/attachedfiles route.

DataBaseWhere::getSQLWhere now delegates to Where::multiSqlLegacy

Core/Base/DataBase/DataBaseWhere.php is marked @deprecated and the active code path runs through Core/Where.php::multiSqlLegacy (lines 151-199), which converts each legacy DataBaseWhere instance to a Where:

```php

if ($item instanceof DataBaseWhere) {

$dbWhere = new self($item->fields, $item->value, $item->operator, $item->operation, $item->useField ?? false);

...

$sql .= $dbWhere->sql();

...

}

```

Where::sql() (lines 316-403) finally calls self::sqlColumn($field) for the identifier in every operator branch, including the = branch the attacker reaches.

Where::sqlColumn returns parenthesised inputs untouched

Core/Where.php:407-425:

```php

private static function sqlColumn(string $field): string

{

// si lleva paréntesis, no escapamos

if (strpos($field, '(') !== false && strpos($field, ')') !== false) {

return $field;

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality high, integrity high, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: Low — an ordinary user account is enough.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Changed — a successful attack reaches components beyond the vulnerable one.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-45262 is classified as CWE-89: SQL Injection. Untrusted input is concatenated into an SQL statement, letting an attacker change the query and reach data the request should not return.

Affected software

CVE-2026-45262 is recorded against 1 package.

  • facturascripts/facturascripts

Timeline and source

Published on 14 July 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

github.com (Web)
github.com (Package)

Other advisories for this package

facturascripts/facturascripts has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-89: SQL Injection) in other software:

Details

Severity CRITICAL
CVSS Score 9.5
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
CWE CWE-89
Public Exploit ✅ No
Source OSV
Published 2026-07-14
Updated 2026-08-20
Modified 2026-07-14
Fix URL N/A

Affected Packages

Software From version Fixed in
facturascripts/facturascripts

Similar Threats

Exploit Protection

Are you running facturascripts?

CVE-2026-45262 carries CVSS 9.5 Critical rating. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-45262 →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026