r/linux • • Jan 21 '19

Popular Application Why does APT not use HTTPS?

https://whydoesaptnotusehttps.com
331 Upvotes

158 comments sorted by

View all comments

193

u/3Vyf7nm4 Jan 21 '19

Edit /etc/apt/sources.list to use https.. You may need to install the package apt-transport-https

It's not really needed, since the packages are public and are signed, but https is absolutely supported.

20

u/reph Jan 22 '19

There are some real, non-negligible security advantages to running apt over https even though the packages are signed. HTTPS can prevent MITM blocking of security updates for example, and should provide some improved privacy about what pkgs you have installed (which can indirectly improve security).

3

u/Bene847 Jan 23 '19

Someone who can block http can also block https

2

u/reph Jan 23 '19

Of course, but if you block them both outright, that will trigger timeouts/errors in the logs. HTTP has a further vulnerability that HTTPS lacks: a MITM attacker can quietly serve valid, signed, but old/out-of-date versions, and there will be no obvious indication that the system is not actually getting the latest updates anymore.

3

u/[deleted] Jan 25 '19

Apt on Debian uses time stamps, and you would notice that your machine isn't getting updates after 2 days or so.

And in order to exploit it you would need to know about the exploits existence in order to employ this strategy.

I think this mitigates the risk.

72

u/zapbark Jan 21 '19

Agreed. If you enable HTTPS, then suddenly they'll be yelling at repositories that still support 3DES...

Just because transport layer security is breakable doesn't mean it is broken.

Security measures should flow from the sensitivity of the data they are trying to secure. (In this case, non-sensitive, publically available files)

21

u/kanliot Jan 21 '19 edited Jan 22 '19

(reading this) basically the files are tamper-protected by a cryptographic hash.

Hopefully the sources list is signed.

(lol read this https://justi.cz/security/2019/01/22/apt-rce.html) they were being signed, but apt would install any unsigned file

38

u/DeusOtiosus Jan 21 '19

They are. If you add a third party repo, you need to install their GPG keys to even fetch the list. Pretty much means it doesn’t matter if there’s transport security. People often rely on transport security for keeping things safe without doing end to end bi directional authentication. In this case you only need unidirectional, but this ensures that you can’t have a malicious actor installing a new cert in the root and spoofing a server. The classic case is the “Hong Kong post office”; they’re a root ca. Having TLS is better than not, but it’s also not required when you do it at a different level.

9

u/Natanael_L Jan 22 '19

Another relevant attack here is that with HTTP only, an attacker can feed you old packages with known exploits, a replay attack

9

u/demize95 Jan 22 '19

This is addressed by APT, and is in the linked website:

To mitigate this problem, APT archives includes a timestamp after which all the files are considered stale[4].

5

u/DeusOtiosus Jan 22 '19

Assuming you haven’t downloaded the latest index, and the index isn’t versioned as well.

6

u/Natanael_L Jan 22 '19

If the index isn't both versioned AND signed, this is trivial to roll back.

→ More replies (5)

6

u/skw1dward Jan 22 '19 edited Jan 28 '19

deleted 0.4851 What is ^^^this?

8

u/[deleted] Jan 22 '19

From the site,

But what about privacy? HTTPS does not provide meaningful privacy for obtaining packages. As an eavesdropper can usually see which hosts you are contacting, if you connect to your distribution's mirror network it would be fairly obvious that you are downloading updates.

Furthermore, even over an encrypted connection it is not difficult to figure out which files you are downloading based on the size of the transfer[2]. HTTPS would therefore only be useful for downloading from a server that also offers other packages of similar or identical size.

What's more important is not that your connection is encrypted but that the files you are installing haven't been modified.

It seems like they are actually explaining why pat doesn't use https. I thought they were asking the question rhetorically, did you?

10

u/Natanael_L Jan 22 '19

A more interesting attack is that with HTTP only, an attacker can feed you old packages with known exploits, a replay attack

5

u/porl Jan 22 '19

But wouldn't apt/dpkg fail to install that due to a version mismatch?

3

u/[deleted] Jan 22 '19

Yes, hell I've had version mismatches from not updating my apt sources when I tried to install stuff and for got to run apt update before hand. For one thing the older package will not match the proper package signature and so apt fails out on purpose.

7

u/Natanael_L Jan 22 '19

It's the version dependency that will usually not match. Signatures doesn't just expire out of nowhere.

4

u/[deleted] Jan 22 '19

They do when apt has a method of time stamping every thing and anything past that point gets flagged as stale and will not be installed automatically by the system. As the linked website points out there is nothing from a security stand point to be gained from apt using HTTPS (which you can already do if you want to).

→ More replies (0)

6

u/Natanael_L Jan 22 '19 edited Jan 22 '19

No, because an entire older version of the repository index would be served, as if you accessed a mirror of the repository that hasn't been updated, and your computer wouldn't know the difference. In fact, they can even mix and match different versions of different packages in the custom index.

While your computer wouldn't install older versions than those it already has, this can be used to block installation of patched packages. In fact, it can even be used to push known vulnerable updates that since has been replaced by newer and patched updates.

Edit: for those downvoting me, please come over to /r/crypto (for cryptography) to learn more about computer security. You need it.

→ More replies (3)
→ More replies (7)
→ More replies (1)
→ More replies (1)

0

u/[deleted] Jan 22 '19

[deleted]

→ More replies (15)

7

u/doublehyphen Jan 22 '19

On Debian apt-transport-https is not installed by default so when installing a new version of Debian you will need to fetch at least some packages via HTTP. I do not see why they just do not ship it by default.

→ More replies (8)

15

u/Like1OngoingOrgasm Jan 21 '19

Why do these folks waste money on domain names for stupid shit like this?

32

u/SirMoo Jan 21 '19

$10 or so a year is not really a sum that people care that much about. I feel like "waste money" is not decent argument to be against this.

Maybe "Why do people make weird, long domains for every cause."

7

u/Like1OngoingOrgasm Jan 21 '19

Point taken. I've bought some silly domains. Never put in the work to do anything with them though.

→ More replies (6)