Describe The Bug
Noticed this while testing e5f2f0d4 on beta-5.28.1 and mentioned it in an email thread with the security team — filing it here as well so it doesn't get lost. Measured against the e2e suite rather than a running install, hence the odd-looking environment fields below.
In logout(), revokeUserSessions() is awaited before the cookies are cleared. If it throws, the Set-Cookie line is never reached: the response is a 500 with no Set-Cookie header at all, and the hb-refresh cookie stays in the browser. POST /auth/session with it still returns 201 afterwards.
The UI catches the error and reloads regardless, so from the user's side: they click "log out", the page reloads, and they are back in the signed-in interface with no indication that anything went wrong.
Steps to reproduce (Nest e2e via app.inject, against 270ef02e):
- Log in, keep the
hb-refresh cookie.
- Make the write fail. I used a read-only storage directory (
EACCES when the temp file is opened) and, separately, a corrupted auth.json while the user cache was still warm.
POST /auth/logout → 500, no Set-Cookie.
POST /auth/session with the same cookie → 201, with a usable access token.
Control run with a writable directory: logout 201, and the same cookie then returns 401.
Neither failure is something an attacker can trigger, but both are plausible on a Pi — ext4 defaults to remounting read-only on error, and a full or dying SD card gets there. The corrupted-file variant also persists: the user "logs out", someone repairs auth.json later, and the cookie still restores the session because sessionVersion was never incremented.
Clearing the cookies even when the revocation fails would make logout fail closed. How you do that is your call — I've got a patch and a test ready if you want it, happy to open a PR or leave it with you.
Homebridge UI Version
beta-5.28.1 @ 270ef02
Homebridge Version
2.4.0
Node.js Version
24.19.0
Operating System
Other (specify in description)
Environment Info
Other (specify in description)
Describe The Bug
Noticed this while testing
e5f2f0d4onbeta-5.28.1and mentioned it in an email thread with the security team — filing it here as well so it doesn't get lost. Measured against the e2e suite rather than a running install, hence the odd-looking environment fields below.In
logout(),revokeUserSessions()is awaited before the cookies are cleared. If it throws, theSet-Cookieline is never reached: the response is a 500 with noSet-Cookieheader at all, and thehb-refreshcookie stays in the browser.POST /auth/sessionwith it still returns 201 afterwards.The UI catches the error and reloads regardless, so from the user's side: they click "log out", the page reloads, and they are back in the signed-in interface with no indication that anything went wrong.
Steps to reproduce (Nest e2e via
app.inject, against270ef02e):hb-refreshcookie.EACCESwhen the temp file is opened) and, separately, a corruptedauth.jsonwhile the user cache was still warm.POST /auth/logout→ 500, noSet-Cookie.POST /auth/sessionwith the same cookie → 201, with a usable access token.Control run with a writable directory: logout 201, and the same cookie then returns 401.
Neither failure is something an attacker can trigger, but both are plausible on a Pi — ext4 defaults to remounting read-only on error, and a full or dying SD card gets there. The corrupted-file variant also persists: the user "logs out", someone repairs
auth.jsonlater, and the cookie still restores the session becausesessionVersionwas never incremented.Clearing the cookies even when the revocation fails would make logout fail closed. How you do that is your call — I've got a patch and a test ready if you want it, happy to open a PR or leave it with you.
Homebridge UI Version
beta-5.28.1 @ 270ef02
Homebridge Version
2.4.0
Node.js Version
24.19.0
Operating System
Other (specify in description)
Environment Info
Other (specify in description)