Skip to content

Conversation

@Naveed8951
Copy link

This PR fixes a timing side-channel vulnerability in the OTP SASL
authentication mechanism.

The OTP verification logic used memcmp() to compare cryptographic
hash values. Because memcmp() exits on the first mismatch, execution
time varied depending on the number of matching prefix bytes, leaking
information through observable timing differences.

The Dovecot codebase already provides mem_equals_timing_safe() and
uses it for other authentication mechanisms (e.g., APOP, CRAM-MD5,
SCRAM, password verification). This patch replaces memcmp() with
mem_equals_timing_safe() in the OTP mechanism to ensure constant-time
comparison.

@cmouse
Copy link
Contributor

cmouse commented Jan 10, 2026

Thank you for the pull request. We'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants