Files
wekan/server/lib/lockoutReporter.js
T
Lauri Ojansivu c49d9d8d3e Fix the JamBleed regression: a login lockout never disables the account being guessed.
The lockout reporter recorded brute.lockout (high, blocked) with the GUESSED
account as its userId, and a high-severity blocked event with a userId
disables that account. So three wrong passwords from anyone who knew a username
disabled its owner until an admin re-enabled it - worse than the per-user lock
GHSA-rf3w-rj48-jxcc removed - and a user who mistyped their own password three
times was disabled the same way.

The reporter is now one module for startup and reload and names the account as
targetUserId; a catalog key can declare blocksAccount: false, and brute.lockout
does. An account already disabled keeps the reason it was disabled for instead
of later events overwriting it. tests/jamBleedVictimBlock.test.cjs drives the
real blocking decision with the real catalog; its negative test fails if a
lockout is recorded anywhere else or a login target is recorded as an actor.

Thanks to xet7 !
2026-10-02 10:31:23 +03:00

27 lines
1.4 KiB
JavaScript

// GHSA-rf3w-rj48-jxcc: a lockout firing is an ATTEMPT that the fix refused, so
// it belongs in Admin Panel -> Problems. A Meteor package cannot import app
// code, so this reporter is injected into AccountsLockout, at startup and when
// the settings are reloaded - one function for both, so they cannot drift.
// Wrapped, because the record of the defence must never break the defence.
//
// JamBleed, again: the account named here is the one being GUESSED - the
// victim, not the actor. Recorded as its `userId`, a high-severity 'blocked'
// event disabled that account (server/lib/blockOnSecurityEvent.js), so three
// wrong passwords from anyone who knew a username locked its owner out until
// an admin noticed, and a user who mistyped their own password three times
// was disabled the same way. It is the TARGET, so it is recorded as one.
export function reportLockout({ userId, username, ip, headers, failedAttempts, lockoutSeconds }) {
try {
require('/server/lib/securityLog').record({
key: 'brute.lockout',
action: 'blocked',
source: 'DDP login',
targetUserId: userId,
ip,
location: require('/models/lib/geoHeaders').locationFromHeaders(headers),
detail: `locked one address out of account ${username || userId} after ${failedAttempts} `
+ `wrong passwords, for ${lockoutSeconds}s`,
});
} catch (e) { /* logging must never break the guard */ }
}