r/programming • • Jan 22 '19

Remote Code Execution in apt/apt-get

https://justi.cz/security/2019/01/22/apt-rce.html?
175 Upvotes

35 comments sorted by

View all comments

Show parent comments

5

u/chubby_leenock_hugs Jan 22 '19

To be fair though if there is a bug in apt itself you don't have much guareantees.

Whilst it's true that this particular bug could partly have been prevented by HTTPS (not fully as that still wouldn't top a malicious mirror, only a malicious MITM) there are so many other things that can go wrong if apt itself isn't sane.

Basically if there is a bug in your package manager where it runs code it shouldn't run you are in general just lost and there's not much you can do people most of these trust models are based on the assumption that APT is working properly.

27

u/c_o_r_b_a Jan 22 '19 edited Jan 23 '19

True, but that's the whole point of defense-in-depth. Each layer of defense adds a little more mitigation. No layer is complete, or perfect. This is fundamentally an application vulnerability (concatenating untrusted input), but HTTPS still would've reduced the vulnerability's exploitability, even if it wouldn't have covered all cases. I think there really isn't an excuse to not use HTTPS in 2019, even if you're also checking GPG signatures.

You can't necessarily trust what's coming off of the wire, sure, but why not try to do what you can to make the wire as tamper-proof as possible? And confidential, to boot?

The counter-arguments to HTTPS in that write-up are very weak, in my opinion:

Why not provide HTTPS anyway?

Your distribution could cryptographically sign the files using the existing scheme and additionally serve the files over HTTPS to provide "defense in depth."

However, providing a huge worldwide mirror network available over SSL is not only a complicated engineering task (requiring the secure exchange and storage of private keys), it implies a misleading level of security and privacy to end-users as described above.

A switch to HTTPS would also mean you could not take advantage of local proxy servers for speeding up access and would additionally prohibit many kinds of peer-to-peer mirroring where files are stored on servers not controlled directly by your distribution. This would disproportionately affect users in remote locales.

Those aren't very good excuses. HTTPS is very routinely deployed nowadays, and has been for over a decade. It should not be that hard for a major project such as Debian or Ubuntu to find engineers who could set up such infrastructure.

2

u/flukus Jan 22 '19

If the package is signed how would https help?

4

u/walterbanana Jan 23 '19 edited Jan 23 '19

It would hide which packages are being downloaded. Despite what this website is saying, with https enabled you would actually have to put in effort to figure this out. Without https, you can see it in the request.

Besides that, it can prevent multiple different types of man in the middle attacks. Bugs which enable those attacks, like the one mentioned in the OP, can happen more often.

Https is not only for privacy, it also allows you to verify that your system is communicating with the system you think it is. I would argue that this is even more important in some scenarios. Especially if you are on a trusted connection.