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=<encrypted blob>. That blob, pasted into code=<blob> 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.
CVE-2026-49952: Discuz's Login Form Encrypts Under UC_KEY. The Database-Backup API Verifies By Decrypting Under UC_KEY.
vendor
pattern
cve
proof of concept
The login form encrypts what you put in username.
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:
class logging_ctl {
public function on_logging_more() {
global $_G;
...
if(empty($_GET['lssubmit'])) {
return;
}
$auth = authcode($_GET['username']."\t".$_GET['password']."\t".($questionexist ? 1 : 0), 'ENCODE', $_G['config']['security']['authkey']);
$js = '<script type="text/javascript">showWindow(\'login\', \'member.php?mod=logging&action=login&auth='.rawurlencode($auth).'&referer='.rawurlencode(dreferer()).(!empty($_GET['cookietime']) ? '&cookietime=1' : '').'\')</script>';
showmessage('location_login', '', ['type' => 1], ['extrajs' => $js]);
}The 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=<ciphertext> parameter the next request in the login flow is expected to decrypt.
The 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.
The 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.
The attacker is now holding a server-signed encrypted blob whose plaintext is a URL-encoded query string they wrote themselves.
The database-backup API verifies authorization by decryption.
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:
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);_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:
define('UC_KEY', $_config['security']['authkey']);That $_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.
The 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.
The attacker pastes the auth=<blob> they received from the login response into code=<blob> 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_<date>_<random>/<date>_<random>-1.sql, and serves the file's URL back over HTTP.
The 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.
The patch removes four characters per line. The default was already safe.
The fix lands as commit 9962dad, May 9 2026, on branch MitFrame. The author is [email protected], the same author who wrote the original logging_ctl class two months earlier. The commit message is 优化 登录逻辑, "optimize login logic." Four lines change:
--- a/upload/source/class/class_member.php
+++ b/upload/source/class/class_member.php
@@ -22,7 +22,7 @@ class logging_ctl {
if(empty($_GET['lssubmit'])) {
return;
}
- $auth = authcode($_GET['username']."\t".$_GET['password']."\t".($questionexist ? 1 : 0), 'ENCODE', $_G['config']['security']['authkey']);
+ $auth = authcode($_GET['username']."\t".$_GET['password']."\t".($questionexist ? 1 : 0), 'ENCODE');
@@ -38,7 +38,7 @@ class logging_ctl {
if(!empty($_GET['auth'])) {
- $dauth = authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']);
+ $dauth = authcode($_GET['auth'], 'DECODE');
@@ -61,7 +61,7 @@ class logging_ctl {
if(!empty($_GET['auth'])) {
- list($username, $password, $questionexist) = explode("\t", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']));
+ list($username, $password, $questionexist) = explode("\t", authcode($_GET['auth'], 'DECODE'));
@@ -81,7 +81,7 @@ class logging_ctl {
if(!empty($_GET['auth'])) {
- list($_GET['username'], $_GET['password']) = daddslashes(explode("\t", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey'])));
+ list($_GET['username'], $_GET['password']) = daddslashes(explode("\t", authcode($_GET['auth'], 'DECODE')));Four call sites. Four removals of the third argument. The argument removed is $_G['config']['security']['authkey'], the bare server-wide secret.
What changes when the third argument is omitted? The authcode() function in upload/source/function/function_core.php:
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0, $ckey_length = 4) {
$key = md5($key != '' ? $key : getglobal('authkey'));
...
}When $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:
$this->var['authkey'] = md5($this->var['config']['security']['authkey'].$this->var['cookie']['saltkey']);saltkey is a random eight-character cookie Discuz sets the first time a browser hits any page:
if(empty($this->var['cookie']['saltkey'])) {
$this->var['cookie']['saltkey'] = random(8);
dsetcookie('saltkey', $this->var['cookie']['saltkey'], 86400 * 30, 1, 1);
}The 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.
The 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.
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.
The same shape appears in the same file. Three more times. Not patched.
The patch touches four call sites inside logging_ctl. grep against the same file for the same explicit-key shape returns three more:
class_member.php:203: $auth = authcode($_GET['username']."\t".$_GET['password']."\t".($_GET['questionid'] ? 1 : 0)."\t1", 'ENCODE', $_G['config']['security']['authkey']);
class_member.php:490: $hash = explode("\t", authcode($gethash, 'DECODE', $_G['config']['security']['authkey']));
class_member.php:568: $hashstr = urlencode(authcode("{$email}\t{$_G['timestamp']}", 'ENCODE', $_G['config']['security']['authkey']));Line 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=<x>& 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.
Whether 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.
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.
The 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.
Disclosure.
CVE-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.
The 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.
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.