mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
1ca2a00255
weecrypto_totp_validate compared the generated and client-supplied OTPs with strcmp and broke out of the time-window loop on the first match. Both choices leaked information via response timing: strcmp leaked the expected OTP digit-by-digit (shrinking the brute-force search from ~10^digits to a handful of guesses within the 30-second window), and the early break leaked which window offset matched. Compare in constant time with string_memcmp_constant_time and always iterate the full window, OR-ing the result into otp_ok without an early exit. This affects both relay protocols (which call totp_validate via the public info hook) and any other caller of the info hook.