Update Information from Qualys
[exim-website.git] / templates / static / doc / security / CVE-2020-qualys / patches3.txt
1 Hi all,
2
3 We noticed the branch "hs/qualys-2020" and reviewed the patches. We just
4 have three comments and one question:
5
6 ========================================================================
7 commit 4f0ac4ad70d38a13fb3f248c3ae2b66b0e1fe7d3
8
9     Safeguard against relative names for msglog files.
10
11 Is there a reason for the extra "&& (p == filename || *(p-1) == '/')"?
12
13 Because of this extra condition, our exploit against CVE-2019-15846 for
14 example would work despite this patch: we overwrite the message id (the
15 argument for deliver_message()) with "/../../../../../../../etc/passwd"
16 but depending on the alignment of our memory corruption, the beginning
17 of id can be "./../../" (for example) and:
18
19 - (p = Ustrstr(filename, US"/../")) is true;
20
21 - (p == filename) is false, because filename always starts with
22   spool_directory, an absolute path;
23
24 - (*(p-1) == '/') is false, because the character before the first
25   "/../" is '.';
26
27 as a result, log_write(LOG_PANIC_DIE) is not called and we can modify
28 /etc/passwd.
29
30 ========================================================================
31 commit e5cb5e615a63a4c97d3e2e88903eaaadfb254bcb
32
33     Check overrun rcpt_count integer
34
35       if (rcpt_count+1 < 0
36
37 Actually, such a signed integer overflow is undefined behavior in C and
38 an optimizing compiler may therefore remove this check completely (some
39 do). The check should be made against INT_MAX (before the int overflow)
40 and should be made earlier, when rcpt_count is incremented (at the very
41 beginning of the case RCPT_CMD): otherwise, rcpt_count can be increased
42 without going through the recipients_max check (e.g., via the breaks in
43 "if (sender_address == NULL)" and "if (!recipient_domain)").
44
45 ========================================================================
46 commit 54895bc3ffdf5ecebcbafb2e6041fa52d6f5e5fb
47
48     smtp_out: Leave a clean input buffer, even in case of read error
49
50 +      inblock->ptr = ptr;
51        return -1;
52
53 There is another return -1 in this function, should it also get fixed?
54 Or maybe a common error codepath should be added instead?
55
56 ========================================================================
57
58 We saw 20-patches2.txt.gpg in cve-2020-qualys/ and just in case: did you
59 also receive/read patches1.txt?
60
61 ========================================================================
62
63 Thank you very much for all your work on Exim! We are at your disposal
64 for questions, comments, and further discussions.
65
66 With best regards,
67
68 -- 
69 the Qualys Security Advisory team