Skip to content

Commit a0c2d6f

Browse files
committed
fix CRAM-MD5 security issue
1 parent 4d53272 commit a0c2d6f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

jenkins/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ run-test:
2727
(cd ../ && CK_FORK=no make check)
2828
sbin/dbmail-users -c testuser1 -w test -p plaintext || true
2929
sbin/dbmail-users -a testuser2 -w test -p plaintext || true
30+
sbin/dbmail-users -a testuser3 -w test -p sha256 || true
3031
sbin/dbmail-users -y -e testuser1 || true
3132
bin/py ../contrib/mailbox2dbmail/mailbox2dbmail -u testuser1 -m ../test-scripts/testbox -t mbox -p sbin/dbmail-deliver
3233
timeout 300 imaptest user=testuser1 pass=test port=10143 test=../test-scripts/imap

src/dm_db.c

+2
Original file line numberDiff line numberDiff line change
@@ -3695,6 +3695,8 @@ int db_user_validate(ClientBase_T *ci, const char *pwfield, uint64_t *user_idnr,
36953695
else
36963696
is_validated = (strcmp(dbpass, password) == 0) ? 1 : 0;
36973697
}
3698+
else if (ci && ci->auth) // CRAM-MD5 auth but storage is encrypted
3699+
is_validated = 0;
36983700

36993701
else if (SMATCH(encode, "crypt")) {
37003702
TRACE(TRACE_DEBUG, "validating using crypt() encryption");

test-scripts/testimap.py

+6
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,12 @@ def testLogin_cram_md5(self):
589589
self.failUnlessRaises(Exception, o.login_cram_md5,
590590
"fakeuser", "wrongpassword")
591591

592+
o = getsock()
593+
o.debug = DEBUG
594+
# testuser3 password stored as sha256 so this must fail
595+
self.failUnlessRaises(Exception, o.login_cram_md5,
596+
"testuser3", "password123")
597+
592598
def testLogout(self):
593599
"""
594600
logout()

0 commit comments

Comments
 (0)