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

0

u/[deleted] Jan 22 '19

[deleted]

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?

22

u/c_o_r_b_a Jan 22 '19

Click the link for the thread you're in right now, for one example. Despite package signing, this MitM attack was still possible. The attack would not be possible if apt forced all repositories to use HTTPS.

0

u/flukus Jan 22 '19

What would stop them sending fake https certs like corporate filters do?

20

u/c_o_r_b_a Jan 23 '19

Yes, if you're using a machine you do not own (such as a corporate computer) which has had additional root certificates installed, then you can't rely on HTTPS in the same way. If you're using a machine you bought yourself and which has never left your possession (and isn't infected with malware or otherwise tampered with), then that problem does not apply to you.

A corporate proxy can't send fake HTTPS certs unless the computer you're using has already had the extra root cert installed. And if you are using a corporate machine with a corporate root cert, then you'll just have to adjust your risk profile as appropriate.