3x-ui/internal
Sanaei c8a3a2d723
fix(security): require a 2FA code to replace the stored TOTP secret
The confirmation gate in updateSetting only covered the true -> false
transition, so a settings save that kept twoFactorEnable=true while
carrying a non-blank twoFactorToken silently rebound the authenticator.
preserveRedactedSecrets restores the stored secret only when the
submitted one is blank, so a non-blank value went straight through
without any branch asking for a code.

Not reachable pre-auth or cross-site (CSRFMiddleware rejects unsafe
methods without the session token), but it matters after a session
hijack or with an admin API token, which sets api_authed and
short-circuits the CSRF check: the attacker gains persistence and locks
the legitimate operator out of their own authenticator.

Now a code is required whenever 2FA is currently on and the submitted
secret differs from the stored one. Enabling from off is untouched, as
no code exists yet to verify, and a blank secret still means
"unchanged", so the panel's normal save path is unaffected.

Reported by @n0ctal (GHSA-xqqw-jqqv-99h6).
2026-08-19 19:54:15 +02:00
..
config feat(nodes): opt-in encryption at rest for the outbound node API token (#6186) 2026-08-15 16:48:50 +02:00
crypto/nodetoken feat(nodes): opt-in encryption at rest for the outbound node API token (#6186) 2026-08-15 16:48:50 +02:00
database Add per-client external link controls (#5650) 2026-08-18 13:55:04 +02:00
eventbus chore: refresh dependencies, fix Linux tool tasks, modernize Go idioms 2026-07-25 16:08:09 +02:00
logger fix(inbounds): apply runtime changes after the DB commit (#5768) 2026-07-08 22:12:28 +02:00
mtproto fix(mtproto): synchronize child-process lifecycle (#6141) 2026-07-29 20:56:26 +02:00
sub Add remote routing URL support (#6168) 2026-08-18 16:02:11 +02:00
tunnelmonitor style: adopt golangci-lint v2 and resolve all findings 2026-06-27 15:42:22 +02:00
util fix(netsafe): classify IPv6 transition and CGNAT ranges as internal 2026-08-19 19:37:14 +02:00
web fix(security): require a 2FA code to replace the stored TOTP secret 2026-08-19 19:54:15 +02:00
xray feat(clients): renew on a calendar day instead of a rolling interval (#6239) 2026-08-18 12:46:00 +02:00