CVE-2026-46359
phpMyFAQ - SQL Injection in CurrentUser::setTokenData via Unescaped OAuth Token Fields
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Passive
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
7.7
phpMyFAQ - SQL Injection in CurrentUser::setTokenData via Unescaped OAuth Token Fields
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
CVE-2026-46359- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-08
EUVDEUVD-2026-30594
7.7
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
EUVD-2026-30594- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Updated
- 2026-11-08
GitHub AdvisoriesGHSA-p9wc-4pjv-rg82
7.7
Duplicate Advisory: phpMyFAQ has SQL Injection in CurrentUser::setTokenData through unescaped OAuth token fields
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-pm8c-3qq3-72w7. This link is maintained to preserve external references.
Original Description
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
GHSA-p9wc-4pjv-rg82- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-02
GitHub AdvisoriesGHSA-pm8c-3qq3-72w7
7.5
phpMyFAQ has SQL Injection in CurrentUser::setTokenData through unescaped OAuth token fields
Summary
CurrentUser::setTokenData() in phpmyfaq/src/phpMyFAQ/User/CurrentUser.php at lines 515-534 builds a SQL UPDATE statement with sprintf and interpolates OAuth token fields (refresh_token, access_token, code_verifier, and json_encode($token['jwt'])) without calling $db->escape(). Sibling methods setAuthSource() and setRememberMe() in the same file do call $db->escape() on user-controlled values, so the omission is local to this method. An attacker (Bob) whose Azure AD display name contains a single quote (for example O'Brien, or a deliberate SQL payload) breaks out of the string literal and injects arbitrary SQL against the phpMyFAQ database.
Details
Vulnerable code (phpmyfaq/src/phpMyFAQ/User/CurrentUser.php, lines 513-534):
public function setTokenData(#[\SensitiveParameter] array $token): bool
{
$update = sprintf(
"
UPDATE
%sfaquser
SET
refresh_token = '%s',
access_token = '%s',
code_verifier = '%s',
jwt = '%s'
WHERE
user_id = %d",
Database::getTablePrefix(),
$token['refresh_token'],
$token['access_token'],
$token['code_verifier'],
json_encode($token['jwt'], JSON_THROW_ON_ERROR),
$this->getUserId(),
);
return (bool) $this->configuration->getDb()->query($update);
}
json_encode() does NOT escape single quotes. A JWT claim such as {"preferred_username": "O'Malley"} produces {"preferred_username":"O'Malley"} after json_encode, which terminates the SQL string literal at the apostrophe.
Correct pattern in the same file (setAuthSource, line 458-461):
$update = sprintf(
"UPDATE %sfaquser SET auth_source = '%s' WHERE user_id = %d",
Database::getTablePrefix(),
$this->configuration->getDb()->escape($authSource),
$this->getUserId(),
);
setRememberMe() (line 471-478) follows the same safe pattern with $db->escape().
Reachability: The phpMyFAQ Azure AD (Entra ID) OAuth flow calls setTokenData() after token exchange. The token response includes an id_token whose payload originates from the identity provider. An attacker registers a Microsoft account with a display name or custom claim containing SQL metacharacters. When that user logs into a phpMyFAQ instance with Azure AD auth enabled, the malicious claim flows into the UPDATE without sanitization.
Proof of Concept
Prerequisites: phpMyFAQ instance with Azure AD / Entra ID authentication enabled.
-
Bob registers an Azure AD account with display name
x]","email":"x',(SELECT SLEEP(5)))-- -. -
Bob initiates the OAuth login flow on the target phpMyFAQ.
-
After authorization, the token endpoint returns a JWT with the crafted claim.
-
phpMyFAQ calls
setTokenData()with the unsanitized token array. The resulting SQL becomes:
UPDATE faquser
SET
refresh_token = '<valid>',
access_token = '<valid>',
code_verifier = '<valid>',
jwt = '{"preferred_username":"x',(SELECT SLEEP(5)))-- -"}'
WHERE
user_id = 42
The single quote after x closes the jwt string literal. Everything after it executes as attacker-controlled SQL.
- To confirm time-based blind injection locally (requires modifying the OAuth token response in a proxy):
import requests
# Simulates what happens when the crafted JWT claim reaches the DB
# In production, this happens automatically through the OAuth flow
payload = "x'||(SELECT SLEEP(5))||'"
# The interpolated query will pause for 5 seconds, confirming injection
print(f"Injected jwt value: {payload}")
print("If the login takes 5+ seconds longer than normal, injection succeeded.")
Impact
An attacker who can authenticate via Azure AD with a crafted claim achieves arbitrary SQL execution on the phpMyFAQ database. This permits reading all FAQ data (including restricted entries), modifying or deleting content, and extracting password hashes and…
- Record
GHSA-pm8c-3qq3-72w7- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-02
NVD
7.7
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
CVE-2026-46359- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-02
OSV
7.7
phpMyFAQ - SQL Injection in CurrentUser::setTokenData via Unescaped OAuth Token Fields
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
CVE-2026-46359- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVGHSA-p9wc-4pjv-rg82
7.7
Duplicate Advisory: phpMyFAQ has SQL Injection in CurrentUser::setTokenData through unescaped OAuth token fields
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-pm8c-3qq3-72w7. This link is maintained to preserve external references.
Original Description
phpMyFAQ before 4.1.2 contains a sql injection vulnerability in CurrentUser::setTokenData that allows authenticated attackers to execute arbitrary SQL by injecting malicious OAuth token claims. Attackers with Azure AD accounts containing SQL metacharacters in display names or JWT claims can break out of string literals and execute arbitrary database queries.
- Record
GHSA-p9wc-4pjv-rg82- CVSS 4.0
- 7.7 High
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVGHSA-pm8c-3qq3-72w7
7.5
phpMyFAQ has SQL Injection in CurrentUser::setTokenData through unescaped OAuth token fields
Summary
CurrentUser::setTokenData() in phpmyfaq/src/phpMyFAQ/User/CurrentUser.php at lines 515-534 builds a SQL UPDATE statement with sprintf and interpolates OAuth token fields (refresh_token, access_token, code_verifier, and json_encode($token['jwt'])) without calling $db->escape(). Sibling methods setAuthSource() and setRememberMe() in the same file do call $db->escape() on user-controlled values, so the omission is local to this method. An attacker (Bob) whose Azure AD display name contains a single quote (for example O'Brien, or a deliberate SQL payload) breaks out of the string literal and injects arbitrary SQL against the phpMyFAQ database.
Details
Vulnerable code (phpmyfaq/src/phpMyFAQ/User/CurrentUser.php, lines 513-534):
public function setTokenData(#[\SensitiveParameter] array $token): bool
{
$update = sprintf(
"
UPDATE
%sfaquser
SET
refresh_token = '%s',
access_token = '%s',
code_verifier = '%s',
jwt = '%s'
WHERE
user_id = %d",
Database::getTablePrefix(),
$token['refresh_token'],
$token['access_token'],
$token['code_verifier'],
json_encode($token['jwt'], JSON_THROW_ON_ERROR),
$this->getUserId(),
);
return (bool) $this->configuration->getDb()->query($update);
}
json_encode() does NOT escape single quotes. A JWT claim such as {"preferred_username": "O'Malley"} produces {"preferred_username":"O'Malley"} after json_encode, which terminates the SQL string literal at the apostrophe.
Correct pattern in the same file (setAuthSource, line 458-461):
$update = sprintf(
"UPDATE %sfaquser SET auth_source = '%s' WHERE user_id = %d",
Database::getTablePrefix(),
$this->configuration->getDb()->escape($authSource),
$this->getUserId(),
);
setRememberMe() (line 471-478) follows the same safe pattern with $db->escape().
Reachability: The phpMyFAQ Azure AD (Entra ID) OAuth flow calls setTokenData() after token exchange. The token response includes an id_token whose payload originates from the identity provider. An attacker registers a Microsoft account with a display name or custom claim containing SQL metacharacters. When that user logs into a phpMyFAQ instance with Azure AD auth enabled, the malicious claim flows into the UPDATE without sanitization.
Proof of Concept
Prerequisites: phpMyFAQ instance with Azure AD / Entra ID authentication enabled.
-
Bob registers an Azure AD account with display name
x]","email":"x',(SELECT SLEEP(5)))-- -. -
Bob initiates the OAuth login flow on the target phpMyFAQ.
-
After authorization, the token endpoint returns a JWT with the crafted claim.
-
phpMyFAQ calls
setTokenData()with the unsanitized token array. The resulting SQL becomes:
UPDATE faquser
SET
refresh_token = '<valid>',
access_token = '<valid>',
code_verifier = '<valid>',
jwt = '{"preferred_username":"x',(SELECT SLEEP(5)))-- -"}'
WHERE
user_id = 42
The single quote after x closes the jwt string literal. Everything after it executes as attacker-controlled SQL.
- To confirm time-based blind injection locally (requires modifying the OAuth token response in a proxy):
import requests
# Simulates what happens when the crafted JWT claim reaches the DB
# In production, this happens automatically through the OAuth flow
payload = "x'||(SELECT SLEEP(5))||'"
# The interpolated query will pause for 5 seconds, confirming injection
print(f"Injected jwt value: {payload}")
print("If the login takes 5+ seconds longer than normal, injection succeeded.")
Impact
An attacker who can authenticate via Azure AD with a crafted claim achieves arbitrary SQL execution on the phpMyFAQ database. This permits reading all FAQ data (including restricted entries), modifying or deleting content, and extracting password hashes and…
- Record
GHSA-pm8c-3qq3-72w7- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-89
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
thorsten/phpmyfaqPackagist |
through 4.1.1 | 4.1.2 |
phpmyfaq/phpmyfaqPackagist |
through 4.1.1 | 4.1.2 |
thorsten/phpmyfaqPackagist |
before 4.1.2, plus listed versions 2.10.0-alpha2.8.02.8.0-RC2.8.0-RC22.8.0-RC3 Show 45 moreShow less2.8.0-RC42.8.0-alpha22.8.0-alpha32.8.0-beta2.8.0-beta22.8.0-beta32.8.12.8.102.8.112.8.122.8.132.8.142.8.152.8.162.8.172.8.182.8.192.8.22.8.202.8.212.8.222.8.232.8.242.8.252.8.262.8.272.8.282.8.292.8.32.8.42.8.52.8.62.8.72.8.82.8.92.9.02.9.0-alpha2.9.0-alpha22.9.0-alpha32.9.0-alpha42.9.0-beta2.9.0-beta22.9.0-rc2.9.0-rc22.9.0-rc3 |
4.1.2 |
phpmyfaq/phpmyfaqPackagist |
before 4.1.2, plus listed versions 2.10.0-alpha2.8.02.8.0-RC2.8.0-RC22.8.0-RC3 Show 45 moreShow less2.8.0-RC42.8.0-alpha22.8.0-alpha32.8.0-beta2.8.0-beta22.8.0-beta32.8.12.8.102.8.112.8.122.8.132.8.142.8.152.8.162.8.172.8.182.8.192.8.22.8.202.8.212.8.222.8.232.8.242.8.252.8.262.8.272.8.282.8.292.8.32.8.42.8.52.8.62.8.72.8.82.8.92.9.02.9.0-alpha2.9.0-alpha22.9.0-alpha32.9.0-alpha42.9.0-beta2.9.0-beta22.9.0-rc2.9.0-rc22.9.0-rc3 |
4.1.2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | EUVD | |
| affected | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-46359 is a high vulnerability (CVSS 7.7) in Thorsten Phpmyfaq, published May 6, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.26%, the 18th percentile. Fixed in thorsten/phpmyfaq 4.1.2.
References
github.com/thorsten/phpMyFAQ/security/advisories/GHSA-pm8c-3qq3-72w7
vulncheck.com/advisories/phpmyfaq-sql-injection-in-currentuser-settokendata-via-unescaped-oauth-token-fields
nvd.nist.gov/vuln/detail/CVE-2026-46359
github.com/advisories/GHSA-p9wc-4pjv-rg82
github.com/advisories/GHSA-pm8c-3qq3-72w7
github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46359.json
github.com/thorsten/phpMyFAQ
Left out here: 240 versions and the rest of 2 source descriptions. The JSON record has them.