Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's absolutely nothing you can do to prevent an active MITM attack over HTTP


I think the CONNECT proxy protocol carrying TLS over HTTP/1 is a counterexample.

ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CO...


Have the authentication header effectively be a signed hash of relevant headers and the full URL, rather than a simple bearer token?


What's stopping the MITM just copying that header?


There's complicated authentication schemes around hmac that tries to do this, but if you're putting that much effort into it you might as well give up and use https.


Some of these include a nonce and/or are deployed over TLS to prevent replay attacks and avoid sending bearer tokens over the wire. AWS sig v4 and RFC7616 come to mind.


Even if the copy the header, they can only perform a replay attack, which is an improvement over leaking an API key. Also, you could include a timestamp in the signature to limit the amount of time it could be replayed.


Sign a nonce.


It’s preventing the theft of the API key. The attack can, at most, replay that specific request (which you could also mitigate with a nonce and expiration).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: