Live data from Hacker News

API Shouldn't Redirect HTTP to HTTPS

jviide.iki.fi

281–290 of 310 posts

Re: API Shouldn't Redirect HTTP to HTTPS

#281

Earlier quoted context omitted.

Nothing could possibly be bulletproof. You sent a key over the wire unencrypted. You were in trouble before the data even got to the server to do anything about it. This approach is a practical choice based on the reality that the bulk of unencrypted traffic is not being actively mitmed and is at most being passively collected. Outside of actually developing cryptosystems, security tends to be a practical affair wher…

as an old-school reader of the cypherpunks email list from before HTTPS existed, I'm still mad about this part: Outside of actually developing cryptosystems, security tends to be a practical affair where we are happy building systems that improve security posture even if they don't fix everything. there was a time in the 1990s when cryptography geeks were blind to this reality and thought we'd build a very different…

> we had (and still have today) all the technology required to build genuinely secure systems.

True, but if we actually did that, it would make those systems very unpleasant to use. The age-old tradeoff of security vs convenience is still as much a force today as is always has been.

Having technically the tightest possible security is not always the right answer. The right answer is whatever balance people are willing to work with for a particular use case. There's a reason that most people don't secure their houses by removing all windows and installing vault doors.

Re: API Shouldn't Redirect HTTP to HTTPS

#282

Earlier quoted context omitted.

I disagree. So does Wikipedia ("where the attacker secretly relays and possibly alters the communications between two parties who believe that they are directly communicating with each other, as the attacker has inserted themselves between the two parties ... for example, an attacker within range of an Wi-Fi access point hosting a network without encryption could insert themselves as a man in the middle") and so I be…

It's just semantics... but I'll throw my hat into the ring nevertheless: The "eavesdropping" attack happens when you capture unecrypted packets. From there, you could either try to hijack the session by inserting yourself into the local conversation (effectively launching a "MITM" attack) or completely independently of the local conversation attempt to impersonate the login session (effectively launching an "imperson…

How fan we capture unencrypted packets from the network? I thought you had to run tcpdump or something like that to be able to do that. But you won't be able to run tcpdump if you don't have access to the interface (source or destination), no?

Re: API Shouldn't Redirect HTTP to HTTPS

#283

Earlier quoted context omitted.

If your goal is to waste people's time, cause them to question their sanity, and guarantee that they're way too pissed off when they finally figure out what happened that instead of teaching others about how important it is too use HTTPS from the start, they talk about how awful your API is and how much they hate your company for a terrible design, then yes this sounds like a good plan.

If it were a generic 403, sure. But if the 403 message said something to the effect of "this API key is no longer valid because it has previously been observed over insecure HTTP", then wouldn't that be fine?

Yes agreed, I think that would improve it, although depending on the situation it may still cause substantial pain. Also apologies, after re-reading my previous comment it seemed unnecessarily harsh toward you, though that wasn't my intention!

On the subject though, an example of how it could cause a lot of pain, many bigger corps don't allow developers to have "real" API keys, and they certainly can't generate new ones themselves, so this might mean one slip-up with curl results in at best a ticket with another team. It also might end up bringing down production in a horrible way, for example if the dev or an ops person is debugging and curls the endpoint from a pod in prod and forgets to explicitly put the https, curl will default to http which would then immediately cause the prod key to be revoked with no second chances. That could even happen on a GET request, which normally GETs are supposed to be safe/side-effect free! If you're operating at a big scale, that could be utterly disastrous, causing a widespread production outage immediately.

If it's a dev that is just testing a key locally that isn't used anywhere else, then it's obviously less of an issue, but taking that into account starts to balloon the complexity around your token revocation code.

Re: API Shouldn't Redirect HTTP to HTTPS

#284
post #54

The Stack Exchange API used to revoke API keys sent over HTTP (and return an error message), which is my favorite way to handle this.

The client-side library should disable HTTP by default to ensure that raw data never leaves the local environment, thereby avoiding any leakage.

(I develop client SDKS)

It could make sense for first-party SDKs for an API to block http access to the first-party API domain, but that should be unnecessary – typically users would use the default base URL hardcoded in the client library, and only replace it if they're going through some other proxy.

When they _do_ go through some other proxy, it's commonly in an internal network of some kind, where http is appropriate and should not be blocked.

Re: API Shouldn't Redirect HTTP to HTTPS

#285

Earlier quoted context omitted.

as an old-school reader of the cypherpunks email list from before HTTPS existed, I'm still mad about this part: Outside of actually developing cryptosystems, security tends to be a practical affair where we are happy building systems that improve security posture even if they don't fix everything. there was a time in the 1990s when cryptography geeks were blind to this reality and thought we'd build a very different…

> we had (and still have today) all the technology required to build genuinely secure systems. True, but if we actually did that, it would make those systems very unpleasant to use. The age-old tradeoff of security vs convenience is still as much a force today as is always has been. Having technically the tightest possible security is not always the right answer. The right answer is whatever balance people are willin…

I’d disagree that there has to be a trade off at all. Using hardware security keys or device based passkeys, secure authentication is actually pretty convenient now.

Re: API Shouldn't Redirect HTTP to HTTPS

#286

Earlier quoted context omitted.

It's just semantics... but I'll throw my hat into the ring nevertheless: The "eavesdropping" attack happens when you capture unecrypted packets. From there, you could either try to hijack the session by inserting yourself into the local conversation (effectively launching a "MITM" attack) or completely independently of the local conversation attempt to impersonate the login session (effectively launching an "imperson…

How fan we capture unencrypted packets from the network? I thought you had to run tcpdump or something like that to be able to do that. But you won't be able to run tcpdump if you don't have access to the interface (source or destination), no?

I'm speaking in the context of the parent conversation ("unencrypted WiFi packets"). On wireless networks, all devices share the same "wire", so to speak. Normally that traffic is useless when captured due to encryption, but that's not the case on unencrypted (i.e. public) WiFi.

Re: API Shouldn't Redirect HTTP to HTTPS

#287
post #229

Earlier quoted context omitted.

There might be but I'm not aware of any tickets. But if you open chrome and navigate to 192.168.20.20 you should see it. Or any domain that resolves to a non-responsive IP, if you have one in mind.

Just tried on Chromium, I get ERR_ADDRESS_UNREACHABLE as I would expect.

Yeah, someone else said it's not enabled for everyone.

It might just be settings? Do you have "Always use secure connections" turned on? I don't remember if that was a manual toggle or not.

However it's triggered, I hope they make the UI better before they deploy it more widely.

And I'll quote the exact text for you:

[warning triangle]

The connection to 192.168.0.40 is not secure

You are seeing this warning because this site does not support HTTPS. Learn more

[Continue to site] [Go back]

Then when I click continue, the only sign it's doing anything is that the reload arrow becomes a stop X. After 20 seconds it moves on to "This site can't be reached".

Re: API Shouldn't Redirect HTTP to HTTPS

#288
post #10

Earlier quoted context omitted.

I don't think this is ever a good idea. Even for non-enterprise use cases, you wouldn't want some public hotspot to be able to inject random garbage into responses, even if not done with malicious intent.

• It allows retro computers to connect. • It allows very low power embedded devices to connect without extra overhead. • It's not a real security concern if you're on a private network.

Yes, I think these are valid reasons.

If you are still concerned, you can make API keys that have been registered by TLS to require TLS, while those that haven't, do not require TLS.

(However, the note about private networks only applies if you run the service yourself. Sometimes this will be the case, though. Even then, the administrators can configure it to use TLS if this is desired.)

Re: API Shouldn't Redirect HTTP to HTTPS

#289

Earlier quoted context omitted.

The point is that you don't need to be 'in the middle' to evesdrop unencrypted data - you can sniff traffic without either end being any the wiser, but if the data is TLS encrypted then you can only decrypt it if you interpose yourself.

I said that already. What are you trying to contest or expand? One of us has not understood the others purpose, because I don't understand the point of your response to my first comment. Nothing is making sense after that. My initial point was to show that mere evesdropping on an encrypted link is still mitm, and so the full interposition is merely an implimentation detail, required by the encryption. If mere evesdro…

> I don't understand the point of your response to my first comment. Nothing is making sense after that.

You're right, my initial comment wasn't detailed enough to make the point I was trying to make. Let me try again; and just to be certain we're all on the same page, and not to patronise you - MITM here stands for 'Man In The Middle'.

Per your original comment:

> You have to mitm in order to evesdrop on an encrypted channel.

This is correct. The reason for this is important - the evesdropper has to decrypt the traffic, and the only way they can do that (assuming TLS or equivalent) is to get involved in the initial key exchange. If Alice and Bob are trying to communicate, and Eve wants to listen in, Eve has to spoof both Alice- and Bob's connections so that they (unwittingly) each negotiate an encrypted connection with Eve, instead of with each other. Then, Eve is 'in the middle' of the connection - all traffic explicitly travels through an endpoint controlled by Eve. The communication looks like Alice Eve Bob. Alice and Bob think they are communicating with each other, and as you point out, indirectly they are, but there is a Man (or Woman) In The Middle of the channel - Eve. Eve can do whatever she likes with the data - just store it, or modify it in some way. No matter what Eve chooses to do, the topology of the attack is, by definition, a MITM attack.

> If you do nothing but evesdrop, isn't it still mitm?

It depends on the topology of the connection. In the scenario above, then yes. However if Eve is just sniffing unencrypted wifi packets then no, because, again by definition, there is no third party in the middle of the communication channel. Wifi traffic is broadcast and therefore can be logged by anyone nearby without affecting the connection - just as you and I can both listen to the same radio station using different handsets (that's why busy wifi networks suffer congestion and have to use all kinds of tricks to deal with that - if every device is talking at once then the router can't easily pick them apart; they have to find ways to take turns).

In this situation it's more like Alice and Bob shouting at each other across a room, while Eve hides behind a curtain and listens in. Eve doesn't have to do anything to make this happen, apart from showing up - she is not involved in the communication channel in any way.

> If mere evesdropping is still mitm, then as far as I'm concerned any other evesdropping is also mitm.

Hopefully this is clearer now, but no, that's not true. The mechanism by which the evesdropping occurs defines whether or not the attack is a MITM attack. As an aside:

> Then again, I guess a keylogger is evesdropping and not called mitm.

Yes, a keylogger works as a kind of MITM - all communication between the keyboard and the applications travels through a third party of sorts.

Hopefully that's more useful?

Re: API Shouldn't Redirect HTTP to HTTPS

#290

As a non-developer, ordinary computer user "providing service" for one user (yours truly) it's easy for me to configure the TLS forward proxy listening on the loopback to send _all_ HTTP requests, from _any_ application, including ones sent to port 80, via HTTPS. This I find preferable to letting a browser try to convert HTTP to HTTPS, e.g., "HTTPS Everywhere", or letting a developer do it with a redirect. Personally…

There’s absolutely nothing ordinary or easy about that setup, but I admire it. I’ve only seen that level of paranoia at a three letter agency. Do applications with pinned certificates break? A bunch of mobile apps do that to get in the way of Wireshark.

https://f-droid.org
Post reply on HN