Web Application
CVE-2026-46359 high CVSS 7.5

SQL Injection in thorsten/phpmyfaq (CVE-2026-46359)

Summary

SQL injection in thorsten/phpmyfaq (CVE-2026-46359). Successful exploitation can lead to full system takeover. Exploitable via sprintf. Mitigation: upgrade to 4.1.2 or later.

Original description

The description as published by the source.

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": "…

Source: NIST National Vulnerability Database NVD GitHub Advisory

AI summary

Written by an external AI model and may contain mistakes. Check the original description and references below before acting on it.

phpMyFAQのバージョン4.1.2未満にSQLインジェクションの脆弱性が存在します。この脆弱性は、CurrentUser::setTokenData関数を介して、認証された攻撃者がOAuthトークンクレームを悪用して任意のSQLを実行できる点にあります。悪用には、文字列リテラルを破るためにSQLメタ文字を含むAzure ADアカウントが必要です。

❓ What is the problem

phpMyFAQのCurrentUser::setTokenDataにおけるSQLインジェクション脆弱性です。

📍 Affected scope

phpMyFAQのバージョン4.1.2未満。

🔥 Severity

攻撃者が任意のSQLを実行可能になるため、システム全体が危険にさらされます。

🔧 How to fix

脆弱性はバージョン4.1.2で修正されているため、ソフトウェアをこのバージョンにアップデートします。

🛡️ Workaround

情報なし

🔍 Detection

Azure ADアカウントやJWTクレーム内にSQLメタ文字が含まれるアカウントを確認してください。

Affected packages

composer thorsten/phpmyfaq
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.2"}]}]
composer phpmyfaq/phpmyfaq
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.2"}]}]
Packagist thorsten/phpmyfaq
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.2"}]}]
Packagist phpmyfaq/phpmyfaq
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.2"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details