-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The login form encrypts what you put in `username`.\n\n`POST /member.php?mod=logging&action=login&loginsubmit=yes` dispatches to the `logging_more` method of the `logging_ctl` class in `upload/source/class/class_member.php`. The first work the method does after seeing `lssubmit` is to concatenate the request's `username`, `password`, and a question-answered bit into a tab-separated string, encrypt the string, and serve the ciphertext back to the browser inside the URL of a JavaScript redirect:\n\n```php\nclass logging_ctl {\n\n public function on_logging_more() {\n global $_G;\n ...\n if(empty($_GET['lssubmit'])) {\n return;\n }\n $auth = authcode($_GET['username'].\"\\t\".$_GET['password'].\"\\t\".($questionexist ? 1 : 0), 'ENCODE', $_G['config']['security']['authkey']);\n $js = '';\n showmessage('location_login', '', ['type' => 1], ['extrajs' => $js]);\n }\n```\n\nThe handler runs before any session lookup, before any password check, before any rate limit. The first observable side effect of submitting the form is the response carrying an `auth=` parameter the next request in the login flow is expected to decrypt.\n\nThe encryption key is the third argument to `authcode()`: `$_G['config']['security']['authkey']`. That is the server-wide secret Discuz reads from `config/config_global.php` on every request. The handler's intent is round-tripping: encrypt the user's credentials, hand the ciphertext to the user's browser, decrypt the same ciphertext on the next request to complete login. The key never leaves the server. The ciphertext, by design, does.\n\nThe attacker submits the form with `username=method=export&time=9999999999&` and `password=1`. The handler concatenates `\"method=export&time=9999999999&\\t1\\t0\"`. It encrypts the string under the server's authkey. It returns the ciphertext to the attacker in the response body, inside the `auth=` parameter of the JavaScript redirect URL.\n\nThe attacker is now holding a server-signed encrypted blob whose plaintext is a URL-encoded query string they wrote themselves.\n\n## The database-backup API verifies authorization by decryption.\n\n`upload/api/db/dbbak.php` is a separate top-level PHP script under the `api/` tree. It does not bootstrap Discuz's session machinery. It does not call `discuz_application::init()`. It does not read auth cookies. Its authentication for every method it dispatches, `export`, `import`, `list`, `view`, `delete`, is one line, file line 58:\n\n```php\nparse_str(_authcode($code, 'DECODE', UC_KEY), $get);\n```\n\n`_authcode()` is defined at the bottom of the same file. It is the same RC4-variant symmetric cipher Discuz uses everywhere else, copied locally so the `api/` script does not need to include the wider framework. `UC_KEY` is defined in `upload/config/config_ucenter.php`:\n\n```php\ndefine('UC_KEY', $_config['security']['authkey']);\n```\n\nThat `$_config['security']['authkey']` is the same string the login handler passed in its third argument. The two endpoints use byte-equivalent encryption helpers, against the same plaintext-of-the-day, under the same key.\n\nThe dbbak handler's authorization model reduces to: decrypt the `code` parameter with `UC_KEY`, parse the result as `application/x-www-form-urlencoded`, dispatch on `method`. There is no other gate. Anyone who has produced ciphertext under that key can issue commands. Ciphertext possession is the credential.\n\nThe attacker pastes the `auth=` they received from the login response into `code=` on `/api/db/dbbak.php?apptype=discuzx`. The handler decrypts, parses, sees `method=export` and `time=9999999999`, dispatches into the export branch. The trailing `\\t1\\t0` becomes a garbage key in `$get` that the dispatch never reads. The freshness check `$timestamp - $get['time'] > 3600` evaluates against a `time` field set to the year 2286 and trivially passes. The handler walks every table prefixed by `pre_`, dumps each one as `INSERT INTO ... VALUES (...)`, writes the result to `data/backup__/_-1.sql`, and serves the file's URL back over HTTP.\n\nThe attacker now has a SQL dump of every member row, every thread, every admin password hash. That is the first step of the chain Egidio Romano published as KIS-2026-09/10/11. The four steps that follow leverage the same dbbak API and the same encryption oracle to import a doctored database, race the login flow into accepting an attacker-crafted session, and finally write a PHP webshell through the plugin-import handler. CVE-2026-49952 is the oracle that makes the first step possible. The race condition has its own CVE. The LFI has its own CVE. CVE-49952 is the cryptographic primitive that makes none of the others require an authenticated session.\n\n## The patch removes four characters per line. The default was already safe.\n\nThe fix lands as commit `9962dad`, May 9 2026, on branch `MitFrame`. The author is `monkeye@qq.com`, the same author who wrote the original `logging_ctl` class two months earlier. The commit message is `优化 登录逻辑`, \"optimize login logic.\" Four lines change:\n\n```diff\n--- a/upload/source/class/class_member.php\n+++ b/upload/source/class/class_member.php\n@@ -22,7 +22,7 @@ class logging_ctl {\n if(empty($_GET['lssubmit'])) {\n return;\n }\n- $auth = authcode($_GET['username'].\"\\t\".$_GET['password'].\"\\t\".($questionexist ? 1 : 0), 'ENCODE', $_G['config']['security']['authkey']);\n+ $auth = authcode($_GET['username'].\"\\t\".$_GET['password'].\"\\t\".($questionexist ? 1 : 0), 'ENCODE');\n@@ -38,7 +38,7 @@ class logging_ctl {\n if(!empty($_GET['auth'])) {\n- $dauth = authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']);\n+ $dauth = authcode($_GET['auth'], 'DECODE');\n@@ -61,7 +61,7 @@ class logging_ctl {\n if(!empty($_GET['auth'])) {\n- list($username, $password, $questionexist) = explode(\"\\t\", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']));\n+ list($username, $password, $questionexist) = explode(\"\\t\", authcode($_GET['auth'], 'DECODE'));\n@@ -81,7 +81,7 @@ class logging_ctl {\n if(!empty($_GET['auth'])) {\n- list($_GET['username'], $_GET['password']) = daddslashes(explode(\"\\t\", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey'])));\n+ list($_GET['username'], $_GET['password']) = daddslashes(explode(\"\\t\", authcode($_GET['auth'], 'DECODE')));\n```\n\nFour call sites. Four removals of the third argument. The argument removed is `$_G['config']['security']['authkey']`, the bare server-wide secret.\n\nWhat changes when the third argument is omitted? The `authcode()` function in `upload/source/function/function_core.php`:\n\n```php\nfunction authcode($string, $operation = 'DECODE', $key = '', $expiry = 0, $ckey_length = 4) {\n $key = md5($key != '' ? $key : getglobal('authkey'));\n ...\n}\n```\n\nWhen `$key` is the empty string, the function falls back to `getglobal('authkey')`. That global is set during application bootstrap in `upload/source/class/discuz/discuz_application.php`:\n\n```php\n$this->var['authkey'] = md5($this->var['config']['security']['authkey'].$this->var['cookie']['saltkey']);\n```\n\n`saltkey` is a random eight-character cookie Discuz sets the first time a browser hits any page:\n\n```php\nif(empty($this->var['cookie']['saltkey'])) {\n $this->var['cookie']['saltkey'] = random(8);\n dsetcookie('saltkey', $this->var['cookie']['saltkey'], 86400 * 30, 1, 1);\n}\n```\n\nThe salted key, `md5(authkey + saltkey)`, is per-browser, per-30-day-cookie-cycle entropy mixed into the actual encryption secret. It isolates per-session cryptographic contexts from each other and, importantly, from the server's bare config secret. Discuz already built the isolation. The dbbak API still reads `UC_KEY`, which is the bare secret. The login form, post-patch, encrypts with the salted derivative. A ciphertext signed under `md5(authkey + my_saltkey)` does not decrypt under `md5(authkey)`. The oracle is closed.\n\nThe pre-patch code was actively bypassing this. The explicit third argument was selecting the bare config secret in preference to the per-session derivative the function would have used by default. The patch is four removals of an argument that opts out of the helper's safety contract.\n\nThe function had a safe default. The login code went out of its way to pass a different key, the one the backup API verifies with.\n\n## The same shape appears in the same file. Three more times. Not patched.\n\nThe patch touches four call sites inside `logging_ctl`. `grep` against the same file for the same explicit-key shape returns three more:\n\n```\nclass_member.php:203: $auth = authcode($_GET['username'].\"\\t\".$_GET['password'].\"\\t\".($_GET['questionid'] ? 1 : 0).\"\\t1\", 'ENCODE', $_G['config']['security']['authkey']);\nclass_member.php:490: $hash = explode(\"\\t\", authcode($gethash, 'DECODE', $_G['config']['security']['authkey']));\nclass_member.php:568: $hashstr = urlencode(authcode(\"{$email}\\t{$_G['timestamp']}\", 'ENCODE', $_G['config']['security']['authkey']));\n```\n\nLine 203 is the CAPTCHA-re-show branch of `on_logging()`: a caller that fails the seccode check the first time gets the same encrypted blob returned, with the same key, through a different code path. Line 568 is the registration-email handler: a caller who supplies the literal string `method=import&time=9999999999&sqlpath=&` as their registration email receives a server-encrypted blob mailed to that address in the activation URL. Line 490 is the decrypt side of the same flow.\n\nWhether each one reaches the dbbak handler depends on the specifics of the surrounding flow, the seccode branch needs a failed-then-passed CAPTCHA, the email branch requires the attacker to receive the activation URL, the PoC walked the cleanest of the available paths and got CVEs for that one. The mechanism, the same library function called with the same explicit-key override that the patch named four times, survives in the same file in three more places.\n\n`grep -rn \"authcode.*authkey\" upload/source/` returns 40-odd more matches across the codebase. Some pass `md5($_G['config']['security']['authkey'])` rather than the bare string, which would land at `md5(md5(authkey))` inside the helper and is a separate trust context. Others pass the bare string and reach the same key the dbbak API trusts. The audit work the patch's four-line scope leaves on the table is naming which is which.\n\nThe shape has a name. Call it **same key, different trust**: a symmetric cipher helper called on both sides of a trust boundary, where the encrypt side returns its ciphertext to a caller the verify side does not trust, where both call sites override the helper's salted default to select a bare server-wide secret. The patch removed four instances of it from one file. The same file holds three more. The commit message did not name it. The advisory did not enumerate it.\n\n## Disclosure.\n\nCVE-2026-49952 was assigned on June 9, 2026. The advisory KIS-2026-09 was published on June 15, 2026. The patched release, version 20260510, was tagged on May 10, 2026. The fix commit `9962dad` was pushed on May 9, 2026, with the message \"optimize login logic.\" The commit carries no CVE reference, no security label, no advisory link, and no mention of the cross-context key reuse in its message. A defender reading the project's commit log between May 10 and June 15 had five weeks of public source for a working signing-oracle bug on every Discuz X5.0 deployment before that defender had a CVE number, an advisory, or a sentence telling them what the four removed arguments were for.\n\nThe candidate description for CVE-2026-49952 in the public record reads \"Chaining Security Bugs in Discuz! X5.0: from Race Condition to Pre-Auth RCE.\" That is the title of the full writeup, applied to the CVE because the disclosure bundled the chain. CVE-49952 is not the race condition the title puts in the middle. CVE-49952 is the cryptographic helper call site the chain's first request abuses to bootstrap the rest. The race condition is what happens after the dump is in hand.\n\nPoC: [passwa11/CVE-2026-49952](https://github.com/passwa11/CVE-2026-49952)","closing_line":"The function had a safe default. The login code went out of its way to pass the unsafe one. The database-backup API trusts what the login form was asked to sign.","hook_md":"The first request the Discuz! X5.0 exploit chain makes is `POST /member.php?mod=logging&action=login&loginsubmit=yes` with `username=method=export&time=9999999999&` and `password=1`. The response body contains `auth=`. That blob, pasted into `code=` on `/api/db/dbbak.php?apptype=discuzx`, dumps every member row, every thread, and every admin password hash to a file the same API serves over HTTP. No credentials were checked. The login form did not log the attacker in. It encrypted whatever string the attacker put in `username` under the server's authkey, and handed the ciphertext back. The database-backup API verifies authorization by decrypting `code` with the same key.","post_id":650,"slug":"discuz-cve-2026-49952-login-form-is-the-dbbak-oracle","title":"CVE-2026-49952: Discuz's Login Form Encrypts Under UC_KEY. The Database-Backup API Verifies By Decrypting Under UC_KEY.","type":"initial","unreadable_sentence":"The function had a safe default. The login code went out of its way to pass a different key, the one the backup API verifies with."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCaxMAlgAKCRDeZjl4jgkQ JlTOAQDY0hPXFf+tx6oyzi6jEGKavtqdpYVeBcSKokcqhlINsAEA97YiYALYYq6H rbyCbPSomaJLbBaj/N9CRolruHLNQwc= =JMY2 -----END PGP SIGNATURE-----