by Pxtl · 6y ago · 0 comments
It can be done... But not by most people. Are history proves it, time [0] after time [1] and time [2] after time [3].
It is simply not worth it, if you can make use of parameterized queries.
[0] https://web.archive.org/web/20161024090111/https://ico.org.u...
[1] https://www.nytimes.com/2014/08/06/technology/russian-gang-s...
[2] https://www.baltimoresun.com/education/bs-xpm-2014-03-07-bs-...
[3] https://web.archive.org/web/20150219165019/http://www.batblu...
But still you wouldn't say that every software written in C is automatically insecure. You have to look into the actual case. Just grepping for SQL-string-concatination or uses of sprintf doesn't say much.
With sql that's different, every sane sql client library supports some form of prepared statements out of the box and they are really simple to use. There is no reason whatsoever to do this by hand, except for people that don't know better.
Prepared statements work fine as long as you just have simple SELECT statements with a few WHERE values as parameters. They completely fail if you need to do any advanced SQL with anything dynamic. Like optionally add more sophisticated calculated properties to the SELECT fields, conditionally JOIN in extra tables, use any of the DB engine's more advanced XML or JSON parsing features in a conditional way, support choosing <, > or =, etc.
this is true
> they are really simple to use
this is not. The amount of boilerplate I've written to properly parameterize a common pattern like
SELECT * FROM FOO WHERE
FOO.SomeKey IN (/* user-provided list of chosen values goes here */)
is grotesque.The sprintf example acknowledges that it’s not clear if the strings involved are user-controlled. It’s definitely possible that the programmer knows all the strings that may be involved and can prove that buffer overflow is impossible.
There’s the complaint that Zoom crash reporting reads registry values that the application has permission to read. This is only problematic because it sends that information to Zoom’s crash reporting service; i.e., somebody other than the user. But programs if the program can’t write sensitive data to the registry, then there’s nothing sensitive to disclose.
If message history goes into that database and is not sanitised properly there's a good chance this gives other conference participants RCE.
So, while that’s not about remote code execution, I will agree that what is actually logged in this SQLite database could be important information. But I would expect a little more than “OMG! They’re logging to a SQLite database, and you could log bad things to a SQLite database!”
* Bad SQLite queries can cause code execution
* Zoom is using concatenation to build queries
* Zoom uses SQLite to store message history and other remotely-controllable data
I've seen enough. I don't need to see the entire chain - which in this case would be that the message history queries specifically are built in an unsafe way - to know that Zoom is software that I absolutely should not trust, and that I do not want to have installed on any of my endpoints if I want the other data on them to remain secure.
Unfortunately, I do not have a choice. I am working with two telehealth providers who use Zoom. So the next best thing is to be as angry as possible about it. The hiring of Alex Stamos is a good move but we need to keep the pressure on.
Put another way, I work for an EU-based fintech. We have similar guidelines (plus a strict log rotation policy, partially due to GDPR but also for many other reasons), but i'm pretty sure our head of security would shit bricks if he found out that our logging framework had an RCE.
Every time it's "hey mr senior developer, I'm trying to reproduce that slow query but I can't, even though I'm doing the same thing as the application" and I'm like "you must be doing something wrong" and sure enough: no, it's the SQL server doing something wrong. And every time we found out "oh, running it un-parameterized makes it fast". So then I have to talk down the juniors who are like "well fine, I can fix it by running it unparameterized, let's just do that!".
So then we have to figure out how to trick it to generating a non-idiotic query plan without abandoning the security that parameterization provides.
... basically I'm deep into "the emperor has no clothes" on MS SQL server in general.
It is extremely frustrating. Never ran into problems like this with Postgres or MySQL.