When running large scale production services, the best practice is building your own image, perhaps starting minimal Debian or Alpine core, using automation, and the tech giants have settled on statically linked binaries a while ago, so Debian packaging "idiosyncrasies" should not apply anyways.
So there are many good reasons distributions patch. It's not reasonable to paint them all with the same brush. If you want to credibly criticize this, you need to be more specific.
Or are you just basing this on <bad thing> happened, thus all other cases (hundred of thousands of patches) are wrong?
I'm not going to weigh in on which party should be responsible for that test.
Is this Lua sandboxing really a good idea? It it robust? It didn't work out well for Java, which removed the SecurityManager feature recently. Python gave up on attempts at sandboxing many decades ago.
https://github.com/redis/redis/commit/49efe300af258e83f377cd...
and you can check the history on that file to see they haven't removed the fix:
https://github.com/redis/redis/commits/unstable/deps/lua/src...
it could be the latest lua version that Debian ships with has 'safe' byte code evaluation and this fix no longer needs to be applied.
Since you've already let the cat out of the hat (which is not ideal), please file the bugs at Debian and Ubuntu.
Test command:
redis-cli eval 'return select(2, loadstring("\027")):match("binary") and "VULNERABLE" or "OK"' 0
While we're at it, redis has ignored the advice at: http://lua-users.org/wiki/SandBoxes
Almost all of the critical functions (loadstring, load, getmetatable, getfenv, ...) are present and unprotected in the redis 'SandBox' (which isn't).Which means, disable scripting or shut down your redis instances NOW, which do not run with the same privileges as any client which has access to this. Scripting can be disabled by renaming the EVAL and EVALSHA commands to unguessable names.
But, just to clarify, mikemike's advice is that everyone (i.e. including people running upstream redis) should disable scripting.
Always seems a bit strong given Debian’s policy of dynamic linking is responsible for this security vulnerability.
According to the Redis documentation [1], "The sandbox attempts to prevent accidental misuse [...] Scripts should never [...] attempt to perform any other system call other than those supported by the API".
(Also "reduce potential threats", but that doesn't sound like the primary purpose or a particularly strong claim of security.)
It's trivial to DoS-hang redis with the script feature (and SCRIPT KILL won't help).
And I found at least 3 DoS-crash, because it hasn't backported fixes to its copy of Lua 5.1.5 (but Debian's liblua 5.1 might -- I haven't checked).
And that's without even exploring the really problematic builtins it still has available.
Maybe they should instead clarify their security guarantee for redis scripting (e.g. "none").
The documentation makes it sound like it's primarily intended to guide people towards using the API correctly. Here is the whole section for context:
> Redis places the engine that executes user scripts inside a sandbox. The sandbox attempts to prevent accidental misuse and reduce potential threats from the server's environment.
> Scripts should never try to access the Redis server's underlying host systems, such as the file system, network, or attempt to perform any other system call other than those supported by the API.
> Scripts should operate solely on data stored in Redis and data provided as arguments to their execution.
In a perfect world we can all update immediately but when we still have some servers in Ubuntu 16.04..
The Lua interpreter _within_ redis acts as a sandbox, which got a bit mangled here. Most features are not implemented in Lua, though. So this is only used for things like the EVAL command.
Good writeup. Thank you.
Another thing that would be interesting and affect upstream as well would be getting the "debug" package back from the redis error function.
One nice thing is that some years ago, Debian/Ubuntu configured the default config to only bind to localhost. (You can change it, but only if you need to, so it's "default secure" instead of "default insecure".)
That can really hurt, especially since you might build it and start it up for testing from within your personal user account (maybe just to benchmark a new server -- and perhaps you have sudo?), and then: boom, that entire machine is now pwned.
Binding to all interfaces by default is definitely not the wisest design decision when you could just bind to localhost and then let people bind to 0.0.0.0 as they like, but you still see some naive devs doing it even on new software (like seaweedfs.) Even Mongodb doesn't do that anymore.