Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify Piwigo on PHP 8+ with pending DB upgrade
-
DeliverySend crafted username to upgrade auth endpoint
-
ExploitInjected SQL manipulates auth query result
-
ExecutionSatisfy status/password checks, set PHPWG_IN_UPGRADE
-
ImpactAuthorize upgrade, alter database and disrupt service
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Two concrete prerequisites must both hold: (1) the Piwigo instance runs on PHP 8.0 or later, where the get_magic_quotes_gpc function no longer exists so the conditional addslashes escaping in check_upgrade_access_rights() is skipped; and (2) the instance is in a pending-database-upgrade state, making the upgrade authentication path reachable. The attacker must also craft a SQL-injected username whose query result satisfies both the status and password checks to set PHPWG_IN_UPGRADE. Limiting factors: exploitation is only possible during the transient upgrade-pending window (typically right after code is updated but before the DB migration runs), which is why CVSS assigns AC:H; no authentication or user interaction is required (PR:N/UI:N). Affected: all Piwigo versions prior to 16.4.0. |
| Impact | The CVSS 3.1 vector (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H, base 8.1) frames this as a network-reachable, unauthenticated SQL injection with high impact, but AC:H is the honest and decisive signal: exploitation is gated on a specific transient state - the Piwigo instance must have pending database upgrades so the install/upgrade authentication path in check_upgrade_access_rights() is reachable, and the attacker must craft a query result that satisfies both the status and password checks to set PHPWG_IN_UPGRADE. The root cause is real and clean: the escaping of the submitted username was conditioned on the get_magic_quotes_gpc function, which was removed in PHP 8, so on any PHP 8+ deployment the username is concatenated directly into the auth SQL query (CWE-89). There is no EPSS score, no CISA KEV listing, and no public exploit in the provided intelligence, so this is 'no public exploit identified at time of analysis' - not confirmed exploitation. Net: a genuine unauthenticated auth-bypass/SQLi that deserves patching, but the pending-upgrade window and the PHP-8+ condition make it opportunistic and time-bounded rather than a broadly wormable mass-exploitation target. The 8.1 rating is defensible on impact but the practical real-world risk is moderated by the narrow trigger window. |
| Exploit ScenarioDerived | An attacker who discovers a Piwigo site running on PHP 8+ that has been code-updated but not yet database-migrated (upgrade pending) sends crafted input to the upgrade authentication endpoint, injecting SQL into the username that is concatenated unescaped into the auth query. By shaping the query result to satisfy the status and password checks, the attacker sets PHPWG_IN_UPGRADE and authorizes upgrade execution without valid administrator credentials, leading to unauthorized database changes and service disruption. No public proof-of-concept is referenced in the available data. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 25, 2026
Unauthenticated SQL injection in Piwigo's pending-database-upgrade authentication path lets a remote attacker bypass administrator credentials and trigger the upgrade routine on affected galleries. The flaw lives in check_upgrade_access_rights() (admin/include/functions_upgrade.php), which only applies addslashes() escaping when the legacy get_magic_quotes_gpc function exists; because that function was removed in PHP 8.0, any Piwigo instance prior to 16.4.0 running PHP 8 concatenates the submitted username straight into the upgrade authentication query. Exploitation is gated on a transient state - the instance must have a pending database upgrade so this code path is reachable - and requires a crafted query result that satisfies both the status and password checks to set PHPWG_IN_UPGRADE, which is why the assessed vector carries AC:H. There is no public exploit code and no confirmed active exploitation (CISA KEV) at time of analysis, and an upstream fix is available in Piwigo 16.4.0.
RemediationAI
Vendor-released patch: upgrade to Piwigo 16.4.0 (https://github.com/Piwigo/Piwigo/releases/tag/16.4.0), which restores the correct addslashes() guard condition and refactors the installer's request sanitization; the two upstream commits are 1ff9d04534feb5f8f3cc2d3613c0fe8b51a1c0ba and 2cfa7a3d194c8b95edde43038d8f5be5a359e785 and the security advisory is GHSA-6wj3-7fhw-gfpm. If an immediate upgrade is not possible, the highest-value action is to shrink the exposure window: complete any pending database upgrade as soon as code is deployed so the check_upgrade_access_rights() path is no longer reachable, since exploitation is impossible outside that transient state. Trade-off: this requires a maintenance window and briefly leaves the site in the exact state the attacker targets, so the migration should be run over a trusted connection or from an IP allowlist and confirmed complete immediately. Additionally, restrict network access to /install.php and the admin upgrade endpoints with web-server or reverse-proxy rules (deny all except known administrator IPs), which removes remote reachability to the vulnerable routine; the trade-off is that legitimate administrators must use the allowlisted network or an out-of-band path during upgrades, and the rule must be kept in sync with real admin addresses. A WAF or reverse-proxy rule blocking SQL metacharacters in the username/upgrade parameters of install.php is a weaker compensating control that reduces exploitability but can be bypassed and may interfere with legitimate non-ASCII usernames. Note that simply running an older PHP version is not an acceptable mitigation, as it re-exposes the instance to other unsupported-runtime risks. No vendor workaround substitutes for the 16.4.0 patch, and no public exploit code or confirmed active exploitation was identified at the time of this analysis.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The root cause is CWE-89 (SQL injection) arising from an environment-dependent sanitization guard rather than from a missing abstraction. In the vulnerable code, escaping of request input was conditioned on if(function_exists('get_magic_quotes_gpc') && !@get_magic_quotes_gpc()). This was historically correct: on PHP 5.x/7.x with magic_quotes_gpc disabled, the branch executed and addslashes() protected the query; when magic quotes were enabled, PHP itself escaped input. PHP 8.0 removed get_magic_quotes_gpc entirely, so function_exists() returns false, the whole condition short-circuits to false, and no escaping occurs at all - silently converting a legacy defensive shim into an injection point. The upstream fix inverts and broadens the guard to !function_exists('get_magic_quotes_gpc') or !@get_magic_quotes_gpc(), restoring addslashes() on modern PHP, and additionally refactors install.php to use array_walk_recursive() with a sanitize_mysql_kv() callback over $_GET, $_POST and $_COOKIE so the same PHP 8 blind spot cannot recur elsewhere in the installer/bootstrap. The affected component is the upgrade authorization routine: an attacker-supplied username flows into the SQL query used to verify upgrade privileges, and a carefully crafted result can satisfy the status and password checks, set PHPWG_IN_UPGRADE, and authorize execution of the pending schema migration. The CPE cpe:2.3:a:piwigo:piwigo:*:*:*:*:*:*:*:* denotes all Piwigo releases below 16.4.0; effective exposure additionally requires PHP >= 8.0 and a pending database upgrade. The reported CVSS 3.1 base is 8.1 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H), while this independent assessment scores the same reachability with confidentiality Low (C:L/I:H/A:H), reflecting that the injection targets authentication and upgrade state rather than a broad data-disclosure primitive; both agree the attack is network-reachable and unauthenticated (PR:N/UI:N) and that AC:H is the decisive modifier.
Know when Piwigo gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Network unauthenticated (AV:N/PR:N) but AC:H due to required PHP-8+ plus pending-upgrade window; primary impact is auth-bypass driving DB integrity changes and service disruption (I:H/A:H), confidentiality via blind SQLi is secondary (C:L).
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
Piwigo is a full featured open source photo gallery application for the web. Prior to 16.4.0, check_upgrade_access_rights() in admin/include/functions_upgrade.php conditionally escapes the submitted username only when the removed get_magic_quotes_gpc function exists, so PHP 8 and later concatenate an unauthenticated username directly into the upgrade authentication SQL query. When database upgrades are pending, a crafted query result can satisfy the status and password checks, set PHPWG_IN_UPGRADE, and authorize upgrade execution without valid administrator credentials. This can cause unauthorized database integrity changes and service disruption. This vulnerability is fixed in 16.4.0.
Technical POC Analysis
CWE-89 (SQL injection).
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
A credential-bypass flaw in Piwigo photo gallery software could give an outside attacker administrator-level control of any gallery running PHP 8 on versions prior to 16.4.0 while it is mid-way through a database upgrade, allowing content to be exposed, altered, or used as a foothold into the hosting environment. The affected population is the teams and business units operating internet-facing Piwigo galleries, and the exposure persists because those instances cannot yet be remediated with a vendor patch in our current data. Leadership should care because a public-facing admin compromise carries reputational, data-protection, and downstream lateral-movement consequences disproportionate to the modest effort required to reach the vulnerable code path.
Apply vendor patch (Piwigo 16.4.0 per the upstream fix); where upgrade is not yet possible, complete any pending database upgrades to eliminate the transient precondition, restrict access to the admin and upgrade paths to trusted networks, and filter SQL injection attempts against those endpoints at the WAF. No public exploit code or confirmed active exploitation (CISA KEV) was identified at time of analysis, and the vulnerable code path is only reachable while a database upgrade is pending.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
Directory traversal vulnerability in install.php in Piwigo before 2.4.7 allows remote attackers to read and delete arbit
Cross-site request forgery (CSRF) vulnerability in the LocalFiles Editor plugin in Piwigo before 2.4.7 allows remote att
SQL injection vulnerability in the administrative backend in Piwigo through 2.9.1 allows remote users to execute arbitra
Piwigo 13.6.0 is vulnerable to SQL Injection via in the "profile" function. Rated critical severity (CVSS 9.8), this vul
Piwigo 13.6.0 is vulnerable to SQL Injection via /admin/permalinks.php. Rated critical severity (CVSS 9.8), this vulnera
Piwigo 11.4.0 allows admin/user_list_backend.php order[0][dir] SQL Injection. Rated critical severity (CVSS 9.8), this v
admin.php?page=account_billing in Piwigo 2.9.5 has XSS via the vat_number, billing_name, company, or billing_
admin.php?page=notification_by_mail in Piwigo 2.9.5 has XSS via the nbm_send_html_mail, nbm_send_mai
Cross-site request forgery (CSRF) vulnerability in Piwigo through 2.9.1 allows remote attackers to hijack the authentica
Cross-site request forgery (CSRF) vulnerability in Piwigo through 2.9.1 allows remote attackers to hijack the authentica
Cross-site request forgery (CSRF) vulnerability in Piwigo through 2.9.1 allows remote attackers to hijack the authentica
admin/configuration.php in Piwigo 2.9.2 has CSRF. Rated high severity (CVSS 8.8), this vulnerability is remotely exploit
EUVD-2026-87137
NVD
CVE.org
EPSS
Vulnrichment
GitHub
Exploit-DB