11 ms·
All you need to know about sudo and frankly most other pieces of the Linux userspace is that it is undertested. The commit that added this flaw to sudo claims t
by jeffbee 6y ago
All you need to know about sudo and frankly most other pieces of the Linux userspace is that it is undertested. The commit that added this flaw to sudo claims to fix a parser bug but includes no tests. There is no reason for the author, the reviewer (if there even was such a person), or anyone else to believe that the bug existed or was fixed by this change. The pull request that supposedly fixes this CVE also includes no tests. There is no reason anyone should believe this fix is effective or complete, or that it does not introduce new defects. This is the result of people who stubbornly refuse to practice even the most basic good engineering practices, like testing and code review, while at the same time using the industry's most dangerous high-level language. As long as this type of thing continues, our tools will remain at a very low level of safety, reliability, and correctness.
- nsajko 6y agoI think the design of the relevant code is worse than the lack of relevant test coverage. The problem solved insecurely by the code instead seems like an obvious target for lexical and syntactic analysis (and this has been so since the sixties, I think).
- megous 6y agoYes, please at least use re2c when parsing anything more complicated in C. The result is much more readable, and integration costs are pretty low, and you still keep a lot of flexibility in how you structure your code.
- miohtama 6y agoAnother question is who wants to maintain four decades old GNU C soup? It was written at a different time, with different best practices. In some point someone will rewrite all GNU/UNIX user land in modern Rust or similar and save the day. Until this happens these kind of incidents will happen yearly.
- jeffbee 6y agoThe GNU project is wall-to-wall toxic waste, but I note for the record that I don't think sudo is a GNU program and IIRC it's not even GPL.
- DaiPlusPlus 6y agoHow is it possible that GNU’s `sudo` is not GPL? Unless it’s BSD, I guess?
- rincebrain 6y agoIt's not GNU's `sudo`, it's under an ISC-style license, and is maintained by an OpenBSD developer, so it's closer to "BSD's sudo" (though OpenBSD has been shipping `doas` instead for a little while now).
- arp242 6y agosudo even predates GNU by several years.
- riffraff 6y agowow, I never realized sudo is from 1980[0]! I thought it was a product of the late '90s. It's actually incredible it has managed to stay around this long. [0] https://www.sudo.ws/history.html https://www.sudo.ws/history.html
- DaiPlusPlus 6y agoPffft, `sed` is from 1974: https://en.wikipedia.org/wiki/Sed https://en.wikipedia.org/wiki/Sed And `ed` dates from 1969: https://en.wikipedia.org/wiki/Ed_(text_editor) https://en.wikipedia.org/wiki/Ed_(text_editor)
- riffraff 6y ago
- muricula 6y agoEven if there were basic unit & regression tests, this bug might not have been caught. This bug should have gone through detailed security review and should probably also undergo fuzzing.
- jeffbee 6y agoYou can bet your bottom banana that the GRU, the NSA, Chinese state security, and the mob have all thoroughly fuzzed sudo and are sitting on the results. It just seems SO EASY to add a test for this problem, literally the relevant test input is one slash by itself, or any string ending in a slash! So simple! If I sent a change like this at work, no matter how trivial, that said it fixed this bug but I didn't send any tests, the reviewer would reject it out of hand or, probably, just silently ignore my change. But that's the real problem here. This program is a monograph. There are no reviewers and there are, consequently, no standards.
- bnroberts 6y agoSingle persons often have superhuman standards. It is easy to see that most of the best works in math or art were produced by an individual. Code review can work, but often it doesn't. There are countless examples of projects with "strict" review requirements that have similar issues (whereas qmail only had one). Writing tests is the important thing, it keeps you honest.
- jeffbee 6y ago31 CVEs later I think it's safe to say that this particular author does not possess superhuman standards. How much more evidence would we need?
- mike_d 6y agoIt sounds like you'd find great pleasure in writing harnesses for oss-fuzz. Google has found and reported over 25,000 bugs in 375 projects, but they need people like you to help wire up new projects. You can get started here: https://google.github.io/oss-fuzz/ https://google.github.io/oss-fuzz/
- gnunez 6y agoA Turing Award winner once said, “Program testing can be used to show the presence of bugs, but never to show their absence!"
- jeffbee 6y agoSounds like a very smart person. Much of the value in the test is showing that the old revision fails it. If I were fixing this bug, first thing I would do is write the test and make sure the existing code fails. If it doesn't fail, that means I don't understand the problem yet. Then I fix the problem and commit both the fix and the test. I don't just discard the test, because it is valuable to know that in the future nobody re-introduces the exact same flaw (this regularly happens in open source projects).
- gnunez 6y agoI agree. Keeping the test around provides a safety net (a bug repellent of sorts) for the next person the comes along. The test also serves as a documented history of the bugs of the past. The problem is that test does not guarantee the injection of future bugs of a different type. I don't think any amount of testing will. That's not to say we shouldn't write test, we should just be aware of the limits of testing.
- tbrownaw 6y ago> The commit that added this flaw to sudo claims to fix a parser bug but includes no tests. There is no reason for the author, the reviewer (if there even was such a person), or anyone else to believe that the bug existed or was fixed by this change. "The PR does not include tests" is not the same as "nobody performed any tests" is not the same as "nobody actually noticed a bug". And of course, it's perfectly reasonable to form beliefs about code from reading it.
- TomSwirly 6y ago"You can't prove no one tested that!" is not really a good basis for robust software design.
- jonhohle 6y agoIn addition to the value of repeatability, it’s just being a good human to show and share your work.
- saagarjha 6y agoTests you perform locally should probably be described, if not encoded into something that other people can run as well.
- iovrthoughtthis 6y ago> And of course, it's perfectly reasonable to form beliefs about code from reading it. Broadly yes, but it would be hubris to claim you can tell the correctness of all code from merely looking at it.
- cheph 6y agoFor some code you should be able to do this, and if you can't then I don't think you should be writing code. Coding is not brute forcing. I feel like this is taking an extreme position at the complete opposite end from not testing anything. EDIT: Misread the comment I replied to. I agree that it is not likely that anyone can tell the correctness of all code from merely looking at it.
- jrockway 6y agoA journey of a thousand releases begins with the first unit test. Everyone has decided to stay home this year, though.
- gerdesj 6y ago"All you need to know about sudo and frankly most other pieces of the Linux userspace is that it is undertested" Fair enough but what do you recommend? Me, I try to keep people out of my systems that I don't trust. This particular snag needs local access but I will grant you that my web server or other exposed service might provide a local interface. Instead of throwing your hands up and screaming "crap" you do your risk assessment and attempt to mitigate as best you can. I read a lot of blogs and have a fair amount of logging and analytics lying around the place (and that's just at home). Fairly recently I found that my wife's car had loose nuts on the front nearside wheel. That was a change to fix a worn tyre for obvious safety reasons but for whatever reason the fixings were not done up properly. I think they were done up finger tight but a distraction caused the mechanic to forget to use a spanner (wrench) to finish the job to spec. The wheel seemed to work fine but you would get a low rumble sound on corners. It was not a trivial to diagnose fault because you had to notice it before failure - I'm a (non chartered) Civ Eng and IT bod but not a mechanic. There is a minimally screwed on plastic cover that stopped the bolts from flying out - not much. A car wheel is a thing we can all look at and see that the four bolts are not working properly, once you remove the plastic cover and see them wobble. Now that is what you can do to protect yourself (risk assess, mitigate etc.) However there should also be something that protects "civilians" and I think that is what is missing. I'm not too sure how we do that.
- lmm 6y ago> Fair enough but what do you recommend? MirageOS unikernels like were mentioned yesterday? Get away from running network services on Linux entirely?
- danaris 6y agoDoes it have full support for all the kinds of stacks people are running on Linux today? Is there a robust ecosystem of MirageOS users online able to help troubleshoot issues from the simple to the arcane? Is it supported by VPS providers the world over? Personally, while I doubt these are the case, having never heard of MirageOS before, I'm willing to be proven wrong. However, if the answer to any of these is "no", I have a hard time seeing how "just abandon Linux wholesale for NewShinyThing" is a viable option for more than a tiny subset of users. (Even if they're all "yes", it's still a wildly unrealistic expectation...)
- pfundstein 6y agoDid you just call C a high level language?
- pocketgrok 6y agoTechnically, it is. But usage of the term has shifted a lot over the last 50 years.
- pjmlp 6y agoIndeed, "C Is Not a Low-level Language, Your computer is not a fast PDP-11." https://queue.acm.org/detail.cfm?id=3212479 https://queue.acm.org/detail.cfm?id=3212479
- entelechy0 6y agoBlaming the language is to blame yourself. You can't prevent mistakes that way.
- xorcist 6y ago> people who stubbornly refuse to practice even the most basic good engineering practices, like testing and code review That is not fair. This software is maintained by Todd Miller, the well known OpenBSD developer, and has both tests and certainly discusses code proposals. Not everyone has to use github or the language de jour to be useful.
- srfilipek 6y ago> This software is maintained by Todd Miller, the well known OpenBSD developer Ironic that OpenBSD dropped sudo in favor of a much simpler utility.
- beams 6y agoStopped reading your comment after the first sentence because that’s all I needed to know.