6 ms·
SQLite is the most thoroughly tested codebase I'm aware of [1]. It has seven times more test code than non-test code. 100% branch coverage. If even SQLite can h
by modeless 8y ago
SQLite is the most thoroughly tested codebase I'm aware of [1]. It has seven times more test code than non-test code. 100% branch coverage. If even SQLite can have a RCE vulnerability, I'm convinced that it is not feasible for anybody to write safe C code.
[1] https://www.sqlite.org/testing.html https://www.sqlite.org/testing.html
- blattimwind 8y agoSQLite can by principle not suffer from a RCE.
- deleted 8y ago[deleted]
- coleifer 8y agoNot sure why this is being downvoted, but you're correct. Now, a networked application that exposes some level of access to sqlite? That's another story. The question I think we all are asking is just how much "leg" does sqlite have to show to be vulnerable?
- tptacek 8y agoIt's a pretty silly definition; it's like saying PDF or JPEG parsers can't be vulnerable to RCE, when they are in fact major vectors for RCE attacks.
- schoen 8y agoI assume people making this distinction are thinking about "network services that the public can compromise by interacting with them over the Internet" vs. "software that someone can compromise by getting it to accept a malicious input". But I agree that "RCE" is commonly used for both; otherwise we would have to maintain that browsers don't suffer RCE vulnerabilities because a malicious document is no longer "remote" once the browser has downloaded it.
- ynniv 8y agoThey're only vulnerable to RCE if image data can be supplied remotely. What's the analog here? Accessing the JavaScript API? Specifying a query string? Maliciously encoded data? Some of these are scarier than others.
- tptacek 8y agoThis isn't, like, a real debate. Go here: https://pwnies.com/ https://pwnies.com/ Start with the 2018 nominations but feel free to check the archives. Drive-by browser vulnerabilities are RCEs.
- blattimwind 8y ago> Drive-by browser vulnerabilities are RCEs. I would never argue they aren't, but by this logic ("it's like saying PDF or JPEG parsers can't be vulnerable to RCE") virtually every code execution vuln in a library can be called RCE. I haven't noticed this to be the case with e.g. libtiff vulnerabilities (of which many make it into my inbox regularly), although image libraries are one of the cases were CE = RCE is still fairly reasonable. Let's assume this SQLite bug is only exploitable if you can input arbitrary SQL. Almost no applications use it this way (except Chrome). I think it's clearly unreasonable to call it a RCE in SQLite then.
- tptacek 8y agoUh, no, for example, it could also potentially impact any application that uses sqlite as (part of) a file format.
- deleted 8y ago[deleted]
- stefan_ 8y agoIn that sense, soon USB kernel stacks have remote code execution vulnerabilities because browsers added dumb APIs. Should we fix bugs? Yes. Should we scream at people that expose raw APIs they don't understand far beyond their design constraints? Yes yes yes.
- eli 8y agoSure, but I very frequently parse PDFs and JPEGs from untrusted sources, but almost never open untrusted .sqlite files. (This is still a serious security vulnerability)
- tlrobinson 8y agoI don't know. I'd say PDF or JPEG parsers (and SQLite) can have arbitrary code execution vulnerabilities, which can in turn be responsible for remote code execution vulnerabilities when used in network-connected software. e.g. SQLite has an ACE. Chrome has a RCE (which is SQLite's fault).
- tptacek 8y agoIf what you're observing is that industry lingo is suboptimal, you'll get no argument from me. Consider for instance "XSS" and "CSRF", which are just manifestly silly names. But the names mean what they mean; try as I might, I can't get people to accept "Javascript injection".
- tlrobinson 8y agoI’m observing there are reasonable terms for both the vulnerability in SQLite (https://en.m.wikipedia.org/wiki/Arbitrary_code_execution https://en.m.wikipedia.org/wiki/Arbitrary_code_execution) and the vulnerability in Chrome due to the vulnerability in SQLite (https://en.m.wikipedia.org/wiki/Remote_code_execution https://en.m.wikipedia.org/wiki/Remote_code_execution) and wondering why we can’t just use those?
- tptacek 8y agoI don't know what to tell you. Try this: Google [browser rce], and then [browser ace] (or [browser ace vulnerability] or whatever). It'll be immediately apparent what the term of art for drive-by code execution vulnerabilities in browsers is. I sort of intellectually in the back of my head know that "arbitrary code execution" is a term that has been coined and used in the past, but I don't offhand know of anyone that uses it (among other things, it's kind of redundant). "Local only" code execution vulnerabilities aren't "LCE", but rather (usually) "privilege escalation".
- tlrobinson 8y agoIn both my comments I explicitly said that vulnerabilities in browsers can and should be called RCEs. I was only arguing about what to call vulnerabilities in the underlying libraries (like SQLite) which aren't inherently exposed to "remote" data/manipulation. Say for some reason someone used an exploitable version of SQLite in a program that had the setuid bit set. You wouldn't say SQLite had a privilege escalation vulnerability, would you?
- ATsch 8y agoI think the reverse definition is just as silly... Calling a JPEG parser vulnerability an RCE just because some online service is using it in a way that can be exploited remotely. By that definition, any bug is an RCE, since I can just set up a web server to run that program. I think a better way of looking at it is that it's an ACE Vulnerability in the e.g. JPEG parser that causes an RCE in the Online Service. Or, in this case, an ACE vulnerability in SQLite that causes an RCE in Chromium.
- tptacek 8y agoSure, though what I'd say is silly is epistemological conceit of trying to pin down vulnerabilities as "remote" or "local". A lot of vulnerability research terms are silly (sillier than RCE). Either way: it's a "term of art", and it means what it means, and this is a clear and obvious instance of an RCE.
- LolNoGenerics 8y agoSql databases are usually behind an application layer. Still they can suffer from RCE. Sqlites model is no protection.
- yzmtf2008 8y agoIt's no more "by principle" secure than any other SQL server bind to localhost only, so I'm not sure what you meant by it does not suffer from a RCE.
- int_19h 8y agoIt is, actually. When something binds to localhost, there's still potential for privilege escalation vulnerability, since any process can connect to the port - so if there's an exploit, a low-privileged process could hijack a higher-privileged one. Localhost sockets are still a security boundary. Since SQLite in and of itself is just a library, it doesn't have that problem. You have to expose it to untrusted inputs manually somehow (e.g. by setting up a socket).
- segmondy 8y ago100% branch, line coverage means nothing. It's about logical coverage. What are you testing for? You are not testing lines of code, but logic.
- mholt 8y agoThis is exactly why I don't find code coverage tools useful. Now, a tool that can show what the tests assert against? THAT would be useful.
- yladiz 8y agoIsn't that the definition of branch testing, to test all possible branches within code and also testing the logic in all of those branches?
- nyc_pizzadev 8y agoOr lets wait and see what the bug is and why it wasn't detected in the testing coverage.
- snaky 8y agoEspecially considering you could generate faster C code than written by hand. With Proofs, Without Compromises http://adam.chlipala.net/papers/FiatCryptoSP19/FiatCryptoSP19.pdf http://adam.chlipala.net/papers/FiatCryptoSP19/FiatCryptoSP1...
- jcden 8y agoJust get good scrub
- jeklj 8y agoTo be a bit glib, unit tests don’t catch security vulnerabilities. Maybe I’d agree this can happen to any project, but my example might be something more like OpenBSD
- hyperman1 8y agoWhy not? In this specific case, a unit test that checked this integer overflow seeems to prevent the vulnerability. To be clear: This is not to admonish sqlite. They have taken testing further than any other project i've heard of, except maybe the NASA software that might cost lives if it fails.
- hashhar 8y agoIncidentally a lot of NASA tools use SQLite as well from what I have heard.
- nobody271 8y agoYou had me up until that last little bit at the end. No where did you make any reference to C until the end. You're kind of putting the cart before the horse aren't you?
- xtrapolate 8y ago> "If even SQLite can have a RCE vulnerability, I'm convinced that it is not feasible for anybody to write safe C code." This has much less to do with C, than it has to do with the fact that sqlite is a huge codebase. Software can be vulnerable regardless of the programming languages used.