259 points · by fanf2 · 6y ago · 159 comments
/* this line is unreachable */
printf("You have reached unreachable code\n");
10 years later, it gets printed...But not every "unthinkable" case being reached represents a security problem as it does in this case. So in the general case of how to approach such assert-type checks, an abort might take down the process when not necessary, turning it into a DoS.
Edit: I am not sure if my friend the downvoter realizes I am not trying to justify legit security bugs, just talking abstractly about varying approaches to handling asserts for unforeseen or "allegedly impossible" circumstances.
For a project in a space that's notoriously vulnerability prone - I mean, when it was released it was competing with Sendmail - it seems very reasonably cautious to pepper the code with panic handlers in "impossible" places. They won't slow the code down any because they should never be evaluated, but give nice, noisy explosions when unexpected things happen. There's no downside to doing this.
Asserting only in debug builds is rather ineffective because the unthinkable input isn't in your testsuite. If it were, then it wouldn't have been unthinkable.
(paraphrased from a friend's answering-machine message)
DJB welched on every claim at that bounty, and refused to pay out. He is an egotistical over-selfconfident person. He wrote good code back in the day, but he lost the forest for the trees.
I was a bit curious about this wording which seems quite weasel-wordy at first glance, so these are the snapshots of the page that have been saved by Archive here https://archive.vn/https://cr.yp.to/djbdns/guarantee.html
I did a rough diff of the two first saved snapshots (which span 2009), and got this:
@@ -6,7 +6,7 @@
The djbdns security guarantee
-I offer $500 to the first person to publicly report a verifiable security hole in the latest version of djbdns.
+I offer $1000 to the first person to publicly report a verifiable security hole in the latest version of djbdns.
@@ -14,17 +14,25 @@
-Bugs outside of djbdns, such as OS bugs or browser bugs, do not qualify. The vulnerability of DNS to forgery does not qualify. Denial-of-service attacks do not qualify. (An attacker can easily take down the Domain Name System, or selected parts of it; this is not news.)
+Examples of problems that do not qualify:
+
+
+
+ Bugs outside of djbdns, such as OS bugs or browser bugs. (People could seize control of BIND 9.1 through an OpenSSL buffer overflow, but that was a bug in OpenSSL, not in BIND.)
+
+ The vulnerability of DNS to forgery. (BIND's port reuse makes blind forgery much less expensive, but this is a quantitative difference, not a qualitative difference. The DNS architecture needs cryptographic protection.)
+
+ Denial-of-service attacks. (BIND 9's fragility makes denial of service completely trivial; but an attacker can easily take down the Domain Name System without using any of BIND's bugs. The DNS architecture needs to be decentralized.)
I don't think this looks unreasonable in terms of actual consequences/definitions, but it is interesting how much effort and verbiage he spends on pointing out the flaws of other DNS servers.(If you don't know: he is a top cryptographer that can amazingly correct code. However, he also has a very big ego...)
And his attitude is just bonkers to me. "I'm not going to fix this exploitable security issue because I assume that people will configure their environment in a particular way." What? That's... flat-out irresponsible.
https://en.wikipedia.org/wiki/Qmail#Security_reward_and_Geor...
(Similar story with djbdns/tinydns.)
"Recently" he released his code with new licenses, so that people could finally start distributing updated versions, rather than the previous approach where lots of people were sharing conflicting patches for various features (e.g. IPv6 support for AAAA records in tinydns.)
(regardless, you should not directly encrypt a large amount of data, even nacl suggest against it https://nacl.cr.yp.to/valid.html)
In addition both Filo and Garrett have a bone to pick with DJB due to their personal political beliefs and his involvement in the Appelbaum case and I found both of them to be extremely dislikeable and unable to accept their own faults in personal discussions that I had with them in the past (regarding different issues). Considering that this was a subpost my opinion of them is even lower now.
Given that his principles of writing secure software (included in the Qmail guarantee[1]) includes this: "7. Write bug-free code." that might be a bit hard for him to swallow.
The guy is a legend
[1] Actually, Jim Paradis announced the Linux/Alpha development kit January 23, 1995 on comp.os.linux.announce (Message-ID: 3g0787$59i@kruuna.Helsinki.FI). So it's possible he had the kernel ported in late 1994. He announced a fully functional distribution July 1, 1995. (Message-ID: 3t34ph$mi@kruuna.helsinki.fi)
The vulnerabilities were introduced in a third party patch, not source code that was authored or advocated by djb.
"As recommended by Daniel J. Bernstein, qmail can be protected against all three 2005 CVEs by placing a low, configurable memory limit (a "softlimit") in the startup scripts of all qmail services."
Seems much simpler than patching, let alone trusting someone else's patches.
Interesting that they developed their exploit against Debian's default configuration. qmail from its source at https://cr.yp.to/qmail.html comes with no such default configuration.
Which patch are you talking about? I don't see anything about a patch in the CVE.
> Seems much simpler than patching, let alone trusting someone else's patches.
We can patch the issue for good (and with a simple patch, apparently), or we can rely on users not to mess with seemingly unrelated init scripts. Do you trust third party users more than a (likely heavily scrutinised) small third party patch?
As to the second question, I trust softlimit from daemontools and that is what I use. https://cr.yp.to/daemontools/softlimit.html
Not sure what "messing with seemingly unrelated init scripts" means. Can you be more specific?
""https://cr.yp.to/qmail/guarantee.html has for many years mentioned qmail's assumption that allocated array lengths fit comfortably into 32 bits. I run each qmail service under softlimit -m12345678, and I recommend the same for other installations.""
About our new discovery, Daniel J. Bernstein issues the following statement:
"https://cr.yp.to/qmail/guarantee.html has for many years mentioned
qmail's assumption that allocated array lengths fit comfortably into
32 bits. I run each qmail service under softlimit -m12345678, and I
recommend the same for other installations."
And from his "guarantee"In May 2005, Georgi Guninski claimed that some potential 64-bit portability problems allowed a ``remote exploit in qmail-smtpd.'' This claim is denied. Nobody gives gigabytes of memory to each qmail-smtpd process, so there is no problem with qmail's assumption that allocated array lengths fit comfortably into 32 bits.
Under mitigations they list:
As recommended by Daniel J. Bernstein, qmail can be protected against all three 2005 CVEs by placing a low, configurable memory limit (a "softlimit") in the startup scripts of all qmail services.
Alternatively:
qmail can be protected against the RCE (Remote Code Execution) by configuring the file "control/databytes", which contains the maximum size of a mail message (this file does not exist by default, and qmail is therefore remotely exploitable in its default configuration).
Unfortunately, this does not protect qmail against the LPE (Local Privilege Escalation), because the file "control/databytes" is used exclusively by qmail-smtpd.
Alternatively:
- an updated version of qmail-verify will be available at https://free.acrconsulting.co.uk/email/qmail-verify.html after the Coordinated Release Date;
- the developers of notqmail (https://notqmail.org/) have written their own patches for the three 2005 CVEs and have started to systematically fix all integer overflows and signedness errors in qmail.
Correct, or am I oversimplifying/missing something?
Nowadays, the author should be telling people to install postfix.
djb's view is that the environment is the responsibility of the admin, not the program's responsibility to enforce sane defaults. This is of course debatable.
If the admin uses a recommended environment (low memory limit), there is no exploitability.
-m12345678
Ah, magic numbers.I really hate supporting that.
I've more recently come a little bit to terms with this whole abrasive thing being a brain chemistry artifact, and not just being an asshole for assholes sake. Because it seems to disproportionately impact those of us in the technical field. Not to excuse it, but to understand it.
It seems like it does hit the tech field more often, yet overwhelmingly I see leading people in tech get softer, more empathetic, and more open to outside ideas the longer they work and the more experience they gain.
Perhaps this is selection bias (the people I see are the "popular" ones, so of course they are the ones with more social awareness), or perhaps there is no hard and fast "genius requires ego". Note: I'm aware you didn't say that it did, you only mentioned that abrasive-ness seems disproportionately frequent in the tech field.
I'm all for improving our understanding and ways of communication - I've definitely known people in the "asshole" category that were surprised and bothered to discover that was how they came across - but I'm not interested in normalizing abuse as a necessary cost. Which, again, you didn't say nor imply, but the concepts are related to what you've brought up, so I mention it here because the topic is interesting, not as a counterpoint.
Indeed. I don’t have to abide such people, and neither do you. Now if he had found a cure for cancer, would we have more tolerance?
I wish people stopped repeating it over and over. See https://news.ycombinator.com/item?id=23250748
Yes, which invalidates your statement that said "refuses to admit when he makes a mistake".
> And that negates all the other times he refused to admit he was wrong
No, I personally think that he should have awarded the 2005 report.
Considering that we have one example where he rewarded the bountry and one where he did not I would say that "he has such a big ego and refuses to admit when he makes a mistake" is just as valid as "he is humble and admits it when he makes a mistake"
It appears the only victim of your spite is yourself. (Hmmm... there's an old saying along these lines.)
* System-wide ASLR (kernel.randomize_va_space): Full (Setting: 2)
* Does the CPU support NX: Yes
* Core-Dumps access to all users: Restricted
COMMAND PID RELRO STACK CANARY SECCOMP NX/PaX PIE FORTIFY
# checksec --proc-all |grep qmail
qmail-injectXXXXX27 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled Yes
qmail-queueXXXXX97 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled Yes
qmail-sendXXXXX78 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled Yes
qmail-lspawnXXXXX89 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled Yes
qmail-rspawnXXXXX90 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled Yes
qmail-cleanXXXXX91 Full RELRO Canary found Seccomp-bpf NX enabled PIE enabled YesBoth are examples of extremely well designed software written with care by security minded persons.
But that's kind of the point. 20 years worth of feature accumulation is 20 years worth of additional attack surface, which is a liability if all you need is what qmail does.
I was using Courier MTA for a while for self-hosting email.
I may do so again, and will likely use mailcow or mail in a box. Neither are based on qmail.
I needed some additional flexibility and switched to Exim for my MTA of choice instead but have fond memories of Qmail.