<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>FacturaScripts - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/facturascripts/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 14 Jul 2026 19:17:37 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/facturascripts/feed.xml" rel="self" type="application/rss+xml"/><item><title>FacturaScripts Authenticated SQL Injection via Parenthesis Bypass</title><link>https://feed.craftedsignal.io/briefs/2026-07-facturascripts-sql-injection/</link><pubDate>Tue, 14 Jul 2026 19:17:37 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-facturascripts-sql-injection/</guid><description>An authenticated SQL injection vulnerability exists in the FacturaScripts REST API, specifically in the `filter` parameter of endpoints like `/api/3/clientes` and `/api/3/attachedfiles`. This flaw arises because the `Where::sqlColumn()` function bypasses identifier escaping for strings containing both parentheses, allowing an attacker to inject arbitrary SQL, which enables an attacker with a low-privileged API key to extract sensitive data like admin password hashes and session cookies (`logkey`) from any database table, leading to full account takeover and administrative access.</description><content:encoded><![CDATA[<p>A critical authenticated SQL injection vulnerability (GHSA-5qmh-x653-g8qj) has been discovered in FacturaScripts, a popular ERP/CRM system, specifically impacting its REST API endpoints such as <code>/api/3/clientes</code> and <code>/api/3/attachedfiles</code>. This flaw stems from an insecure design in the <code>Where::sqlColumn()</code> function which fails to escape SQL identifiers that contain both opening and closing parentheses, allowing an attacker to inject arbitrary SQL into the <code>filter</code> parameter of API requests. An attacker with a legitimate, even low-privileged, API key (e.g., read-only access to a single resource) can leverage this vulnerability to bypass intended access controls. The exploit was verified on 2026-04-30 against a stock FacturaScripts master instance, demonstrating the ability to leak sensitive information such as admin password hashes and session cookies (<code>logkey</code>), ultimately leading to full administrative account takeover without requiring CSRF protection or two-factor authentication bypasses. This vulnerability poses a significant risk to the confidentiality and integrity of FacturaScripts deployments.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li><strong>Initial Access with Low-Privilege API Key:</strong> An attacker obtains a valid, low-privileged API key, for example, a token with <code>allowget=1</code> on the <code>clientes</code> resource and <code>fullaccess=0</code>, typically intended for integrations or limited data retrieval.</li>
<li><strong>Crafted SQL Injection Request:</strong> The attacker sends a GET request to a vulnerable API endpoint, such as <code>/api/3/clientes</code>, including a maliciously crafted <code>filter</code> parameter. The payload within the <code>filter</code> parameter contains SQL injection syntax, specifically leveraging parentheses to bypass the <code>Where::sqlColumn()</code> escaping mechanism (e.g., <code>filter[(0)UNION SELECT ...]=</code>).</li>
<li><strong>Database Query Manipulation:</strong> The FacturaScripts backend processes the request, and due to the <code>Where::sqlColumn()</code> bypass, the attacker's SQL payload is concatenated directly into the database query, allowing for arbitrary SQL execution.</li>
<li><strong>Information Leakage (Password Hash):</strong> The injected SQL query (e.g., <code>UNION SELECT IFNULL(password,2),... FROM users WHERE(nick='admin')</code>) extracts sensitive data like the admin user's bcrypt password hash from the <code>users</code> table.</li>
<li><strong>Information Leakage (Session Cookie):</strong> The attacker repeats the process with a modified SQL injection payload to extract the admin user's <code>logkey</code> (web session cookie value).</li>
<li><strong>Session Hijacking:</strong> With the leaked <code>logkey</code>, the attacker creates a forged session cookie for the admin user.</li>
<li><strong>Account Takeover:</strong> The attacker uses the forged session cookie to access administrative interfaces (e.g., <code>/AdminPlugins</code>) of the FacturaScripts application, achieving full administrative account takeover.</li>
<li><strong>Arbitrary Command Execution (Optional):</strong> Time-based blind SQL injection techniques (e.g., <code>(SELECT(SLEEP(2)))</code>) can also be employed to confirm the vulnerability in scenarios where <code>UNION SELECT</code> isn't feasible due to column count mismatches.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The successful exploitation of this vulnerability leads to a severe cross-resource confidentiality breach and complete account takeover. An attacker starting with only a read-only API key for a single resource can escalate privileges to full administrator access. This allows them to read any data from any database table, including user credentials (password hashes), API keys, and sensitive business information. The attacker gains the ability to hijack administrator web sessions, granting them unfettered control over the FacturaScripts instance, including the installation of plugins, modification of settings, and potential data exfiltration or manipulation. The attack bypasses existing serialization protections for sensitive fields and API key scoping, making it a critical threat to data security and system integrity.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Detect FacturaScripts Authenticated SQL Injection Attempt</code> to your webserver logs to identify attempts at this exploitation.</li>
<li>Review webserver access logs for requests containing patterns like <code>filter%5B%28</code> combined with <code>UNION%20SELECT</code> or <code>SLEEP%28</code> in <code>cs-uri-query</code>.</li>
<li>Patch FacturaScripts installations immediately to address GHSA-5qmh-x653-g8qj once a fix is available, prioritizing internet-facing instances.</li>
<li>Implement stringent API key management, including regular rotation and least-privilege principles, though this vulnerability demonstrates how such controls can be bypassed.</li>
<li>Monitor for unusual administrator logins or activities originating from new or unexpected IP addresses, especially after suspicious API requests.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>sql-injection</category><category>web-application</category><category>facturascripts</category><category>account-takeover</category><category>credential-access</category><category>privilege-escalation</category></item></channel></rss>