CVE-2026-45262: 
PHP vulnerability analysis and mitigation

Overview

CVE-2026-45262 is a critical authenticated SQL injection vulnerability in the FacturaScripts REST API, exploitable via a parenthesis bypass in Core/Where.php::sqlColumn(). It affects FacturaScripts versions <= 2026.1 (Composer package facturascripts/facturascripts and neorazorx/facturascripts). A live proof-of-concept was verified on 2026-04-30, and the advisory was published on July 14, 2026. As of the advisory date, no patched version is available. The vulnerability carries a CVSS v3.1 base score of 9.9 (Critical) (GitHub Advisory, FacturaScripts Advisory).

Technical details

The root cause is CWE-89 (SQL Injection) in Core/Where.php::sqlColumn(), which skips identifier escaping for any field name containing both ( and ) characters — a shortcut intended to support expression columns like LOWER(col). The two API filter builders, APIModel::getWhereValues and ApiAttachedFiles::getWhereValues, pass the raw HTTP request key ($_GET['filter'][$key]) directly into new DataBaseWhere($key, $value, '=', ...) without any allow-list validation or regex check on the field name. When the query pipeline reaches Where::multiSqlLegacy -> Where::sql() -> Where::sqlColumn(), the parenthesis branch returns the attacker-controlled string unmodified and concatenates it into the SQL WHERE clause, enabling a UNION-based injection such as WHERE (0)UNION SELECT ... FROM users WHERE(nick='admin')-- = ''. The identical flaw exists in both /api/3/ (via APIModel) and /api/3/attachedfiles (via ApiAttachedFiles), and the existing getApiFieldsToHide() deny-list defense is bypassed because injected data is serialized through the target model's (e.g., clientes) serializer, not the users model serializer (GitHub Advisory).

Impact

A low-privileged API key scoped to read-only access on a single resource (e.g., clientes) can exfiltrate any column from any database table, including users.password (bcrypt hashes), users.logkey (session tokens), users.two_factor_secret_key, api_keys.apikey, and sensitive financial data. The leaked logkey session token can be injected directly into a browser cookie to hijack the admin's web session, granting full access to admin endpoints including /AdminPlugins (arbitrary plugin installation), /EditUser (password rotation), and /Cron (server-side code execution). On MySQL instances with FILE privilege, the injection primitive can also be used to write a webshell to the docroot via SELECT ... INTO OUTFILE. Successful UNION queries produce no FacturaScripts log entries, making exploitation stealthy (GitHub Advisory, FacturaScripts Advisory).

Exploitability

A fully functional, end-to-end PoC was verified on 2026-04-30 and is publicly documented in the GitHub advisory, demonstrating credential and session token extraction in a single HTTP GET request. The exploit requires only a low-privilege API key with allowget=1 on any one resource — the exact configuration recommended by FacturaScripts for third-party integrations. No CSRF token, second factor, or rate-limit bypass is needed beyond the default 5-incident IP throttle. The CVE status is listed as "Reserved" with no patch available as of the advisory date (July 14, 2026). No EPSS score or CISA KEV catalog entry is currently available for this CVE (GitHub Advisory).

Exploitation steps

  1. Obtain a scoped API key: Acquire or be issued a FacturaScripts API key with fullaccess=0 and allowget=1 on at least one resource (e.g., clientes). This is the standard integration credential recommended by the vendor.

  2. Confirm scope enforcement: Verify the token is restricted — GET /api/3/users with the token should return {"status":"error","message":"forbidden"}.

  3. Leak the admin password hash via UNION injection: Send a crafted GET request to the permitted resource endpoint with a SQL UNION payload in the filter key:

GET /api/3/clientes?filter%5B%280%29UNION%20SELECT%20IFNULL%28password%2C2%29%2C2%2C3%2C...%2C32%20FROM%20users%20WHERE%28nick%3D%27admin%27%29--%20%5D=
Token: <scoped-api-key>

The response JSON will contain the admin's bcrypt password hash in the cifnif field.

  1. Leak the admin session token (logkey): Repeat the request substituting logkey for password in the UNION payload. The response returns the admin's active fsLogkey cookie value.

  2. Hijack the admin web session: Construct a cookie jar with fsNick=admin and fsLogkey=<leaked_value>, then issue GET /AdminPlugins. A 200 response with the plugin management UI confirms full admin session takeover.

  3. Escalate further (optional): Use /AdminPlugins to install a malicious plugin for remote code execution, use /EditUser?code=admin to rotate the admin password, or (on MySQL with FILE privilege) use SELECT ... INTO OUTFILE via the same injection to write a webshell to the docroot (GitHub Advisory).

Indicators of compromise

  • Network: HTTP GET requests to /api/3/clientes or /api/3/attachedfiles with URL-encoded filter parameters containing %28, %29, UNION, SELECT, or FROM in the query key portion; outbound connections from the FacturaScripts server to unexpected hosts following API requests.
  • Logs: Web server access logs showing requests to /api/3/ endpoints with filter%5B%28 or filter[( patterns in the query string; MySQL/MariaDB general query log entries showing UNION SELECT or SLEEP() expressions in WHERE clauses against clientes or attachedfiles tables; notably, no FacturaScripts application-level error log entries are generated by successful UNION queries.
  • File System: Unexpected PHP files or webshells in the FacturaScripts docroot (if SELECT ... INTO OUTFILE was used); new or modified plugin archives in the plugins directory following admin session activity.
  • Authentication/Session: Admin web UI sessions (fsNick=admin) originating from IP addresses not associated with normal admin activity; api_keys table lastactivitydate updates for scoped (non-fullaccess) tokens at unusual times or frequencies (GitHub Advisory).

Mitigation and workarounds

As of the advisory date (July 14, 2026), no patched version of FacturaScripts is available — all versions <= 2026.1 are affected. Operators should immediately disable the REST API if it is not strictly required (via the admin UI: Default → Disable API, or by unsetting FS_API_KEY). If the API must remain enabled, restrict network access to the API endpoints at the firewall or reverse proxy level to trusted IP ranges only. All existing API keys should be audited and revoked where not essential. Operators should assume that any user credentials (passwords, logkeys, 2FA secrets) and API keys stored in the database may have been exfiltrated, and should rotate all user passwords and session tokens immediately. The recommended code fix is to replace the parenthesis-presence check in Core/Where.php::sqlColumn() with a strict structural allow-list (bare identifiers, LOWER(), UPPER(), CAST()) mirroring the existing DbQuery::orderBy hardening, and to add field-name regex validation at the API ingress in both APIModel::getWhereValues and ApiAttachedFiles::getWhereValues (GitHub Advisory, FacturaScripts Advisory).

Community reactions

The advisory was published by NeoRazorX (the FacturaScripts maintainer) directly to the GitHub Advisory Database on July 14, 2026, indicating the researcher disclosed through the project's own security advisory process. The advisory notes that no patch is available and explicitly advises operators who have shipped this version with the API enabled to rotate all user passwords and assume database credentials have been read. Qualys has added detection for this vulnerability (detection ID 5015386). No significant broader media coverage or social media commentary has been identified beyond the GitHub advisory itself (GitHub Advisory).

Additional resources


Source: This report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-45262CRITICAL9.9
  • PHP logoPHP
  • facturascripts/facturascripts
NoYesDec 04, 2026
CVE-2026-47677CRITICAL9.3
  • PHP logoPHP
  • facturascripts/facturascripts
NoYesDec 04, 2026
CVE-2026-45263HIGH8
  • PHP logoPHP
  • facturascripts/facturascripts
NoYesDec 04, 2026
CVE-2026-45693HIGH7.5
  • PHP logoPHP
  • facturascripts/facturascripts
NoNoDec 04, 2026
GHSA-j3w3-jvjp-wgcfMEDIUM4.8
  • PHP logoPHP
  • laminas/laminas-diactoros
NoNoDec 04, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management