How to secure passwords over HTTP
up vote
17
down vote
favorite
Say my password is abc
. I want to send it to the server over HTTP.
I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.
So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.
How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?
The method should be usable in any browser.
encryption passwords hash web-browser http
New contributor
|
show 6 more comments
up vote
17
down vote
favorite
Say my password is abc
. I want to send it to the server over HTTP.
I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.
So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.
How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?
The method should be usable in any browser.
encryption passwords hash web-browser http
New contributor
53
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
3
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
3
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
1
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago
|
show 6 more comments
up vote
17
down vote
favorite
up vote
17
down vote
favorite
Say my password is abc
. I want to send it to the server over HTTP.
I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.
So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.
How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?
The method should be usable in any browser.
encryption passwords hash web-browser http
New contributor
Say my password is abc
. I want to send it to the server over HTTP.
I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.
So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.
How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?
The method should be usable in any browser.
encryption passwords hash web-browser http
encryption passwords hash web-browser http
New contributor
New contributor
edited yesterday
curiousguy
4,00322126
4,00322126
New contributor
asked 2 days ago
FireCubez
19415
19415
New contributor
New contributor
53
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
3
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
3
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
1
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago
|
show 6 more comments
53
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
3
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
3
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
1
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago
53
53
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
3
3
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
3
3
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
1
1
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago
|
show 6 more comments
10 Answers
10
active
oldest
votes
up vote
67
down vote
accepted
You can't.
To securely send information over an unsecure channel, you need encryption.
Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].
That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out, which leaves you with HTTPS.
[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, like Kerberos.
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
add a comment |
up vote
29
down vote
TLS is really the only way to do it.
But what if I encrypt it with JavaScript?
The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.
Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.
Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.
There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.
add a comment |
up vote
18
down vote
While I agree that you should use HTTPS, you can make it even more secure by using the Salted Challenge Response Authentication Mechanism (SCRAM, see RFC 5802) for the actual authentication exchange.
It's not trivial to implement, but the gist of it is that, rather than send the password to the server, you send proof to the server that you know the password. Since deriving the proof uses a nonce from the client and server, it's not something that can be reused by an attacker (like sending the hash itself would be).
This has a few added benefits to using HTTPS with the basic authentication you describe:
- The server never actually sees your password as you log in. If someone has managed to insert malicious code onto the server, they still won't know what your password is.
- If there is a bug in the HTTPS implementation (think Heartbleed), attackers still won't be able to acquire your password. Because, even once TLS is bypassed, the password isn't available.
- If, for some reason, you can't use HTTPS, this is better than sending the password in the clear. An attacker will not be able to guess your password based on the exchange. That said, you should still use HTTPS, because defense in depth is better.
Please note that this is only secure if the client is able to perform the SCRAM computations without downloading code from the server. You could provide a fat client, or users may be able to write their own code that they control. Downloading the SCRAM code over HTTP would give an attacker an opportunity to modify the SCRAM code to send the password in cleartext, or otherwise expose it. Thank you to Zoltan for the clarification.
New contributor
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
|
show 1 more comment
up vote
5
down vote
You should definitely deploy TLS in this case.
If you decide to try to invent a transport security system over HTTP, ultimately you're going to end up implementing a susbset of the TLS functionality anyway. There are many pitfalls to be aware of when designing and implementing such a system, which are further amplified when you choose to try to implement the system with a language that doesn't offer many safety features.
Even if you did implement a correct implementation of a cryptographic protocol in JavaScript (which is already a big challenge) you can't rely upon that implementation being resistant to timing attacks, and the whole thing breaks if someone has scripts disabled (e.g. with NoScript).
As a general rule you should choose the implementation that consists of the most simple, well-understood, trusted components that require you to write the least amount of security-critical code. To quote Andrew Tannenbaum:
A substantial number of the problems (in application security) are caused by buggy software, which occurs because vendors keep adding more and more features to their programs, which inevitably means more code and thus more bugs.
add a comment |
up vote
4
down vote
Do I need to implement some encryption algorithm like RSA public key encryption?
If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.
add a comment |
up vote
2
down vote
It is actually quite possible.
Password has to be hashed on the client side, but not with a static function. The following method uses two steps, and is inspired by the Digest access authentication:
NOTE: The server keeps a HMAC of the Password and the corresponding Key (Digest);
- The client starts by requesting a nonce to the server, the server returns the Key and the Nonce;
- Client calculates: HMAC( HMAC( Password, Key ), Nonce) and sends it to the server;
- Server calculates: HMAC( Digest, Nonce ) and compares it to the received value.
This protects you against replay.
The main interest I see is not a protection against eavesdropping, but to be completely sure that the plaintext password will not be store on the server, not even in a system log (see Twitter or GitHub).
Note: HMAC can be replaced by PBKDF2.
New contributor
1
Then some attacker can inject some code to get the password directly from the<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).
– Gustavo Rodrigues
yesterday
add a comment |
up vote
1
down vote
There is actually a way to authenticate a user over an insecure connection: Secure Remote Password (SRP) protocol. SRP is specifically designed to allow a client to authenticate itself to a server without a Man-in-the-Middle attacker being able to capture the client's password, or even replay the authentication to later impersonate the client, whether the authentication succeeded or not. Furthermore, successful authentication with SRP creates a shared secret key that both the client and the server know, but a MitM does not. This secret key could be used for symmetric encryption and/or HMACs.
However, there are a number of limitations of SRP:
- The user must have registered in some secure fashion, as the registration process does require transmitting password-equivalent material (though the server does not need to store it).
- Although it is safe to attempt an SRP login with an untrusted server (that is, it won't expose your password to that server, and you'll be able to tell that the server didn't have your password in its database), It's not safe to load a login web page from an untrusted server (it could send down a page that captures your every keystroke and sends it off somewhere).
- Although successful authentication via SRP generates a secure shared secret key, the code to actually use this key in a web app would need to be loaded from a server, and an attacker could tamper with that code to steal the symmetric key and make changes to the requests and responses.
In other words, while SRP can be useful in situations where you have a trusted client that doesn't need to download its code over the insecure connection and also you have some other secure way to register the user(s), SRP is not suitable for a web application. Web apps always download their code from the server, so if the connection to the server isn't secure, a MitM (or other network attacker, for example somebody spoofing DNS) can inject malicious code into the web app and there's nothing that you, the victim, can do about it. Once that code is there, it can capture any password or other data you enter, steal any key that is generated, and tamper with any requests you send or responses you receive without you even knowing.
add a comment |
up vote
0
down vote
An alternative would be to set up a secure VPN to the destination server, and perform a HTTP login from there. A malicious man in the middle will therefore have to break the encryption on the VPN channel in order to attack the connection and retrieve the passwords.
However, in terms of end user usability, it's still not as good as HTTPS, since it requires them to setup and use a different channel with a different set of credentials.
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
add a comment |
up vote
0
down vote
It is certainly possible to send a password securely using HTTP. There is even a standard for it. It's called HTTP-Digest
and it's defined in RFC 7616. It's been a part of the HTTP spec for quite a while. It was originally designed to use only the MD5 message-digest ("hashing") algorithm, but later revisions of the standard allow the client and server to negotiate which algorithm to use.
Unfortunately, there are many problems with HTTP-digest and the most glaring of them is that the server needs to have the password in cleartext. So while it's possible to communicate passwords securely using HTTP, it's not possible to securely-store passwords on the server while using it. So basically, it's not useful.
As others have said, it would be better to implement TLS because it solves multiple problems all at the same time, and it's fairly forward-compatible.
add a comment |
up vote
-1
down vote
You need the recipient to send you his key. You can't randomly send someone encrypted info without them first providing you with their personal public key.
add a comment |
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
67
down vote
accepted
You can't.
To securely send information over an unsecure channel, you need encryption.
Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].
That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out, which leaves you with HTTPS.
[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, like Kerberos.
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
add a comment |
up vote
67
down vote
accepted
You can't.
To securely send information over an unsecure channel, you need encryption.
Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].
That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out, which leaves you with HTTPS.
[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, like Kerberos.
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
add a comment |
up vote
67
down vote
accepted
up vote
67
down vote
accepted
You can't.
To securely send information over an unsecure channel, you need encryption.
Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].
That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out, which leaves you with HTTPS.
[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, like Kerberos.
You can't.
To securely send information over an unsecure channel, you need encryption.
Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].
That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out, which leaves you with HTTPS.
[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, like Kerberos.
edited 2 days ago
timothywalter
332
332
answered 2 days ago
tim
22.4k55991
22.4k55991
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
add a comment |
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
Couldn't you hash it twice? Once on the client side, once on the server?
– Nathan Merrill
yesterday
6
6
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
@NathanMerrill - Hashing the password on the client side just makes the hash the password (absent some scheme to include extra information). However, only securing the password is worthless - you have to at least authenticate the channel, or an attacker can impersonate both ends of the conversation, even without knowing the password.
– Clockwork-Muse
yesterday
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
This is misleading. Yes, you can. This question asks for how to secure passwords when you can't use HTTP. A bad company policy, a misconfigured firewall can all force HTTP to be used. In situations like this, exchanging certificates (IPsec TLS SCRAM etc) through a side-channel is possible and should be the answer. Answer the question instead of giving advice that was not sought after.
– noɥʇʎԀʎzɐɹƆ
4 hours ago
add a comment |
up vote
29
down vote
TLS is really the only way to do it.
But what if I encrypt it with JavaScript?
The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.
Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.
Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.
There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.
add a comment |
up vote
29
down vote
TLS is really the only way to do it.
But what if I encrypt it with JavaScript?
The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.
Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.
Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.
There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.
add a comment |
up vote
29
down vote
up vote
29
down vote
TLS is really the only way to do it.
But what if I encrypt it with JavaScript?
The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.
Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.
Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.
There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.
TLS is really the only way to do it.
But what if I encrypt it with JavaScript?
The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.
Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.
Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.
There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.
answered 2 days ago
AndrolGenhald
8,58841830
8,58841830
add a comment |
add a comment |
up vote
18
down vote
While I agree that you should use HTTPS, you can make it even more secure by using the Salted Challenge Response Authentication Mechanism (SCRAM, see RFC 5802) for the actual authentication exchange.
It's not trivial to implement, but the gist of it is that, rather than send the password to the server, you send proof to the server that you know the password. Since deriving the proof uses a nonce from the client and server, it's not something that can be reused by an attacker (like sending the hash itself would be).
This has a few added benefits to using HTTPS with the basic authentication you describe:
- The server never actually sees your password as you log in. If someone has managed to insert malicious code onto the server, they still won't know what your password is.
- If there is a bug in the HTTPS implementation (think Heartbleed), attackers still won't be able to acquire your password. Because, even once TLS is bypassed, the password isn't available.
- If, for some reason, you can't use HTTPS, this is better than sending the password in the clear. An attacker will not be able to guess your password based on the exchange. That said, you should still use HTTPS, because defense in depth is better.
Please note that this is only secure if the client is able to perform the SCRAM computations without downloading code from the server. You could provide a fat client, or users may be able to write their own code that they control. Downloading the SCRAM code over HTTP would give an attacker an opportunity to modify the SCRAM code to send the password in cleartext, or otherwise expose it. Thank you to Zoltan for the clarification.
New contributor
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
|
show 1 more comment
up vote
18
down vote
While I agree that you should use HTTPS, you can make it even more secure by using the Salted Challenge Response Authentication Mechanism (SCRAM, see RFC 5802) for the actual authentication exchange.
It's not trivial to implement, but the gist of it is that, rather than send the password to the server, you send proof to the server that you know the password. Since deriving the proof uses a nonce from the client and server, it's not something that can be reused by an attacker (like sending the hash itself would be).
This has a few added benefits to using HTTPS with the basic authentication you describe:
- The server never actually sees your password as you log in. If someone has managed to insert malicious code onto the server, they still won't know what your password is.
- If there is a bug in the HTTPS implementation (think Heartbleed), attackers still won't be able to acquire your password. Because, even once TLS is bypassed, the password isn't available.
- If, for some reason, you can't use HTTPS, this is better than sending the password in the clear. An attacker will not be able to guess your password based on the exchange. That said, you should still use HTTPS, because defense in depth is better.
Please note that this is only secure if the client is able to perform the SCRAM computations without downloading code from the server. You could provide a fat client, or users may be able to write their own code that they control. Downloading the SCRAM code over HTTP would give an attacker an opportunity to modify the SCRAM code to send the password in cleartext, or otherwise expose it. Thank you to Zoltan for the clarification.
New contributor
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
|
show 1 more comment
up vote
18
down vote
up vote
18
down vote
While I agree that you should use HTTPS, you can make it even more secure by using the Salted Challenge Response Authentication Mechanism (SCRAM, see RFC 5802) for the actual authentication exchange.
It's not trivial to implement, but the gist of it is that, rather than send the password to the server, you send proof to the server that you know the password. Since deriving the proof uses a nonce from the client and server, it's not something that can be reused by an attacker (like sending the hash itself would be).
This has a few added benefits to using HTTPS with the basic authentication you describe:
- The server never actually sees your password as you log in. If someone has managed to insert malicious code onto the server, they still won't know what your password is.
- If there is a bug in the HTTPS implementation (think Heartbleed), attackers still won't be able to acquire your password. Because, even once TLS is bypassed, the password isn't available.
- If, for some reason, you can't use HTTPS, this is better than sending the password in the clear. An attacker will not be able to guess your password based on the exchange. That said, you should still use HTTPS, because defense in depth is better.
Please note that this is only secure if the client is able to perform the SCRAM computations without downloading code from the server. You could provide a fat client, or users may be able to write their own code that they control. Downloading the SCRAM code over HTTP would give an attacker an opportunity to modify the SCRAM code to send the password in cleartext, or otherwise expose it. Thank you to Zoltan for the clarification.
New contributor
While I agree that you should use HTTPS, you can make it even more secure by using the Salted Challenge Response Authentication Mechanism (SCRAM, see RFC 5802) for the actual authentication exchange.
It's not trivial to implement, but the gist of it is that, rather than send the password to the server, you send proof to the server that you know the password. Since deriving the proof uses a nonce from the client and server, it's not something that can be reused by an attacker (like sending the hash itself would be).
This has a few added benefits to using HTTPS with the basic authentication you describe:
- The server never actually sees your password as you log in. If someone has managed to insert malicious code onto the server, they still won't know what your password is.
- If there is a bug in the HTTPS implementation (think Heartbleed), attackers still won't be able to acquire your password. Because, even once TLS is bypassed, the password isn't available.
- If, for some reason, you can't use HTTPS, this is better than sending the password in the clear. An attacker will not be able to guess your password based on the exchange. That said, you should still use HTTPS, because defense in depth is better.
Please note that this is only secure if the client is able to perform the SCRAM computations without downloading code from the server. You could provide a fat client, or users may be able to write their own code that they control. Downloading the SCRAM code over HTTP would give an attacker an opportunity to modify the SCRAM code to send the password in cleartext, or otherwise expose it. Thank you to Zoltan for the clarification.
New contributor
edited 2 days ago
New contributor
answered 2 days ago
Melanie
1814
1814
New contributor
New contributor
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
|
show 1 more comment
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
7
7
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
You can safely do this with a fat client (a desktop or mobile application) that is distributed in a safe manner. However, with an in-browser thin client, the client code itself is delivered over HTTP as well, and as @AndrolGenhald pointed out, attackers in the middle can intercept and change it to send the password to them.
– Zoltan
2 days ago
2
2
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
@Zoltan That's very true, thank you for the clarification. The original question doesn't specify whether they need a thin or fat client, so my answer wouldn't apply in all cases. But even over HTTP, I think this provides some additional security. The attack has gone from just snooping traffic to modifying code. Nothing insurmountable, so it wouldn't be secure, but maybe less bad? And I think having both HTTPS and SCRAM is very beneficial.
– Melanie
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
If you agree, you may consider mentioning this restriction in your answer. Otherwise I really like your answer as challange-response was my first thought too and none of the other answers mentioned it.
– Zoltan
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
Thank you, I've updated my answer. Let me know if you think it could use further clarifications!
– Melanie
2 days ago
1
1
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
@Melanie You are absolutely correct that even with just HTTP it's better. There are attackers only capable of passive attacks. That being said, there's no reason not to use HTTPS nowadays when it's free.
– Duncan X Simpson
2 days ago
|
show 1 more comment
up vote
5
down vote
You should definitely deploy TLS in this case.
If you decide to try to invent a transport security system over HTTP, ultimately you're going to end up implementing a susbset of the TLS functionality anyway. There are many pitfalls to be aware of when designing and implementing such a system, which are further amplified when you choose to try to implement the system with a language that doesn't offer many safety features.
Even if you did implement a correct implementation of a cryptographic protocol in JavaScript (which is already a big challenge) you can't rely upon that implementation being resistant to timing attacks, and the whole thing breaks if someone has scripts disabled (e.g. with NoScript).
As a general rule you should choose the implementation that consists of the most simple, well-understood, trusted components that require you to write the least amount of security-critical code. To quote Andrew Tannenbaum:
A substantial number of the problems (in application security) are caused by buggy software, which occurs because vendors keep adding more and more features to their programs, which inevitably means more code and thus more bugs.
add a comment |
up vote
5
down vote
You should definitely deploy TLS in this case.
If you decide to try to invent a transport security system over HTTP, ultimately you're going to end up implementing a susbset of the TLS functionality anyway. There are many pitfalls to be aware of when designing and implementing such a system, which are further amplified when you choose to try to implement the system with a language that doesn't offer many safety features.
Even if you did implement a correct implementation of a cryptographic protocol in JavaScript (which is already a big challenge) you can't rely upon that implementation being resistant to timing attacks, and the whole thing breaks if someone has scripts disabled (e.g. with NoScript).
As a general rule you should choose the implementation that consists of the most simple, well-understood, trusted components that require you to write the least amount of security-critical code. To quote Andrew Tannenbaum:
A substantial number of the problems (in application security) are caused by buggy software, which occurs because vendors keep adding more and more features to their programs, which inevitably means more code and thus more bugs.
add a comment |
up vote
5
down vote
up vote
5
down vote
You should definitely deploy TLS in this case.
If you decide to try to invent a transport security system over HTTP, ultimately you're going to end up implementing a susbset of the TLS functionality anyway. There are many pitfalls to be aware of when designing and implementing such a system, which are further amplified when you choose to try to implement the system with a language that doesn't offer many safety features.
Even if you did implement a correct implementation of a cryptographic protocol in JavaScript (which is already a big challenge) you can't rely upon that implementation being resistant to timing attacks, and the whole thing breaks if someone has scripts disabled (e.g. with NoScript).
As a general rule you should choose the implementation that consists of the most simple, well-understood, trusted components that require you to write the least amount of security-critical code. To quote Andrew Tannenbaum:
A substantial number of the problems (in application security) are caused by buggy software, which occurs because vendors keep adding more and more features to their programs, which inevitably means more code and thus more bugs.
You should definitely deploy TLS in this case.
If you decide to try to invent a transport security system over HTTP, ultimately you're going to end up implementing a susbset of the TLS functionality anyway. There are many pitfalls to be aware of when designing and implementing such a system, which are further amplified when you choose to try to implement the system with a language that doesn't offer many safety features.
Even if you did implement a correct implementation of a cryptographic protocol in JavaScript (which is already a big challenge) you can't rely upon that implementation being resistant to timing attacks, and the whole thing breaks if someone has scripts disabled (e.g. with NoScript).
As a general rule you should choose the implementation that consists of the most simple, well-understood, trusted components that require you to write the least amount of security-critical code. To quote Andrew Tannenbaum:
A substantial number of the problems (in application security) are caused by buggy software, which occurs because vendors keep adding more and more features to their programs, which inevitably means more code and thus more bugs.
answered 2 days ago
Polynomial
95.7k29241325
95.7k29241325
add a comment |
add a comment |
up vote
4
down vote
Do I need to implement some encryption algorithm like RSA public key encryption?
If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.
add a comment |
up vote
4
down vote
Do I need to implement some encryption algorithm like RSA public key encryption?
If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.
add a comment |
up vote
4
down vote
up vote
4
down vote
Do I need to implement some encryption algorithm like RSA public key encryption?
If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.
Do I need to implement some encryption algorithm like RSA public key encryption?
If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.
answered 2 days ago
Brian Williams
1764
1764
add a comment |
add a comment |
up vote
2
down vote
It is actually quite possible.
Password has to be hashed on the client side, but not with a static function. The following method uses two steps, and is inspired by the Digest access authentication:
NOTE: The server keeps a HMAC of the Password and the corresponding Key (Digest);
- The client starts by requesting a nonce to the server, the server returns the Key and the Nonce;
- Client calculates: HMAC( HMAC( Password, Key ), Nonce) and sends it to the server;
- Server calculates: HMAC( Digest, Nonce ) and compares it to the received value.
This protects you against replay.
The main interest I see is not a protection against eavesdropping, but to be completely sure that the plaintext password will not be store on the server, not even in a system log (see Twitter or GitHub).
Note: HMAC can be replaced by PBKDF2.
New contributor
1
Then some attacker can inject some code to get the password directly from the<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).
– Gustavo Rodrigues
yesterday
add a comment |
up vote
2
down vote
It is actually quite possible.
Password has to be hashed on the client side, but not with a static function. The following method uses two steps, and is inspired by the Digest access authentication:
NOTE: The server keeps a HMAC of the Password and the corresponding Key (Digest);
- The client starts by requesting a nonce to the server, the server returns the Key and the Nonce;
- Client calculates: HMAC( HMAC( Password, Key ), Nonce) and sends it to the server;
- Server calculates: HMAC( Digest, Nonce ) and compares it to the received value.
This protects you against replay.
The main interest I see is not a protection against eavesdropping, but to be completely sure that the plaintext password will not be store on the server, not even in a system log (see Twitter or GitHub).
Note: HMAC can be replaced by PBKDF2.
New contributor
1
Then some attacker can inject some code to get the password directly from the<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).
– Gustavo Rodrigues
yesterday
add a comment |
up vote
2
down vote
up vote
2
down vote
It is actually quite possible.
Password has to be hashed on the client side, but not with a static function. The following method uses two steps, and is inspired by the Digest access authentication:
NOTE: The server keeps a HMAC of the Password and the corresponding Key (Digest);
- The client starts by requesting a nonce to the server, the server returns the Key and the Nonce;
- Client calculates: HMAC( HMAC( Password, Key ), Nonce) and sends it to the server;
- Server calculates: HMAC( Digest, Nonce ) and compares it to the received value.
This protects you against replay.
The main interest I see is not a protection against eavesdropping, but to be completely sure that the plaintext password will not be store on the server, not even in a system log (see Twitter or GitHub).
Note: HMAC can be replaced by PBKDF2.
New contributor
It is actually quite possible.
Password has to be hashed on the client side, but not with a static function. The following method uses two steps, and is inspired by the Digest access authentication:
NOTE: The server keeps a HMAC of the Password and the corresponding Key (Digest);
- The client starts by requesting a nonce to the server, the server returns the Key and the Nonce;
- Client calculates: HMAC( HMAC( Password, Key ), Nonce) and sends it to the server;
- Server calculates: HMAC( Digest, Nonce ) and compares it to the received value.
This protects you against replay.
The main interest I see is not a protection against eavesdropping, but to be completely sure that the plaintext password will not be store on the server, not even in a system log (see Twitter or GitHub).
Note: HMAC can be replaced by PBKDF2.
New contributor
edited yesterday
emory
1,4881013
1,4881013
New contributor
answered yesterday
Pierre del Perugia
211
211
New contributor
New contributor
1
Then some attacker can inject some code to get the password directly from the<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).
– Gustavo Rodrigues
yesterday
add a comment |
1
Then some attacker can inject some code to get the password directly from the<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).
– Gustavo Rodrigues
yesterday
1
1
Then some attacker can inject some code to get the password directly from the
<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).– Gustavo Rodrigues
yesterday
Then some attacker can inject some code to get the password directly from the
<input>
. A crazy idea: "Sadly it's just a little bit hard to support HTTPS on Reserved IP addresses. Please run this code on your terminal and paste the result HMAC were." (of course disable copy pasting to prevent pastejacking in the long run).– Gustavo Rodrigues
yesterday
add a comment |
up vote
1
down vote
There is actually a way to authenticate a user over an insecure connection: Secure Remote Password (SRP) protocol. SRP is specifically designed to allow a client to authenticate itself to a server without a Man-in-the-Middle attacker being able to capture the client's password, or even replay the authentication to later impersonate the client, whether the authentication succeeded or not. Furthermore, successful authentication with SRP creates a shared secret key that both the client and the server know, but a MitM does not. This secret key could be used for symmetric encryption and/or HMACs.
However, there are a number of limitations of SRP:
- The user must have registered in some secure fashion, as the registration process does require transmitting password-equivalent material (though the server does not need to store it).
- Although it is safe to attempt an SRP login with an untrusted server (that is, it won't expose your password to that server, and you'll be able to tell that the server didn't have your password in its database), It's not safe to load a login web page from an untrusted server (it could send down a page that captures your every keystroke and sends it off somewhere).
- Although successful authentication via SRP generates a secure shared secret key, the code to actually use this key in a web app would need to be loaded from a server, and an attacker could tamper with that code to steal the symmetric key and make changes to the requests and responses.
In other words, while SRP can be useful in situations where you have a trusted client that doesn't need to download its code over the insecure connection and also you have some other secure way to register the user(s), SRP is not suitable for a web application. Web apps always download their code from the server, so if the connection to the server isn't secure, a MitM (or other network attacker, for example somebody spoofing DNS) can inject malicious code into the web app and there's nothing that you, the victim, can do about it. Once that code is there, it can capture any password or other data you enter, steal any key that is generated, and tamper with any requests you send or responses you receive without you even knowing.
add a comment |
up vote
1
down vote
There is actually a way to authenticate a user over an insecure connection: Secure Remote Password (SRP) protocol. SRP is specifically designed to allow a client to authenticate itself to a server without a Man-in-the-Middle attacker being able to capture the client's password, or even replay the authentication to later impersonate the client, whether the authentication succeeded or not. Furthermore, successful authentication with SRP creates a shared secret key that both the client and the server know, but a MitM does not. This secret key could be used for symmetric encryption and/or HMACs.
However, there are a number of limitations of SRP:
- The user must have registered in some secure fashion, as the registration process does require transmitting password-equivalent material (though the server does not need to store it).
- Although it is safe to attempt an SRP login with an untrusted server (that is, it won't expose your password to that server, and you'll be able to tell that the server didn't have your password in its database), It's not safe to load a login web page from an untrusted server (it could send down a page that captures your every keystroke and sends it off somewhere).
- Although successful authentication via SRP generates a secure shared secret key, the code to actually use this key in a web app would need to be loaded from a server, and an attacker could tamper with that code to steal the symmetric key and make changes to the requests and responses.
In other words, while SRP can be useful in situations where you have a trusted client that doesn't need to download its code over the insecure connection and also you have some other secure way to register the user(s), SRP is not suitable for a web application. Web apps always download their code from the server, so if the connection to the server isn't secure, a MitM (or other network attacker, for example somebody spoofing DNS) can inject malicious code into the web app and there's nothing that you, the victim, can do about it. Once that code is there, it can capture any password or other data you enter, steal any key that is generated, and tamper with any requests you send or responses you receive without you even knowing.
add a comment |
up vote
1
down vote
up vote
1
down vote
There is actually a way to authenticate a user over an insecure connection: Secure Remote Password (SRP) protocol. SRP is specifically designed to allow a client to authenticate itself to a server without a Man-in-the-Middle attacker being able to capture the client's password, or even replay the authentication to later impersonate the client, whether the authentication succeeded or not. Furthermore, successful authentication with SRP creates a shared secret key that both the client and the server know, but a MitM does not. This secret key could be used for symmetric encryption and/or HMACs.
However, there are a number of limitations of SRP:
- The user must have registered in some secure fashion, as the registration process does require transmitting password-equivalent material (though the server does not need to store it).
- Although it is safe to attempt an SRP login with an untrusted server (that is, it won't expose your password to that server, and you'll be able to tell that the server didn't have your password in its database), It's not safe to load a login web page from an untrusted server (it could send down a page that captures your every keystroke and sends it off somewhere).
- Although successful authentication via SRP generates a secure shared secret key, the code to actually use this key in a web app would need to be loaded from a server, and an attacker could tamper with that code to steal the symmetric key and make changes to the requests and responses.
In other words, while SRP can be useful in situations where you have a trusted client that doesn't need to download its code over the insecure connection and also you have some other secure way to register the user(s), SRP is not suitable for a web application. Web apps always download their code from the server, so if the connection to the server isn't secure, a MitM (or other network attacker, for example somebody spoofing DNS) can inject malicious code into the web app and there's nothing that you, the victim, can do about it. Once that code is there, it can capture any password or other data you enter, steal any key that is generated, and tamper with any requests you send or responses you receive without you even knowing.
There is actually a way to authenticate a user over an insecure connection: Secure Remote Password (SRP) protocol. SRP is specifically designed to allow a client to authenticate itself to a server without a Man-in-the-Middle attacker being able to capture the client's password, or even replay the authentication to later impersonate the client, whether the authentication succeeded or not. Furthermore, successful authentication with SRP creates a shared secret key that both the client and the server know, but a MitM does not. This secret key could be used for symmetric encryption and/or HMACs.
However, there are a number of limitations of SRP:
- The user must have registered in some secure fashion, as the registration process does require transmitting password-equivalent material (though the server does not need to store it).
- Although it is safe to attempt an SRP login with an untrusted server (that is, it won't expose your password to that server, and you'll be able to tell that the server didn't have your password in its database), It's not safe to load a login web page from an untrusted server (it could send down a page that captures your every keystroke and sends it off somewhere).
- Although successful authentication via SRP generates a secure shared secret key, the code to actually use this key in a web app would need to be loaded from a server, and an attacker could tamper with that code to steal the symmetric key and make changes to the requests and responses.
In other words, while SRP can be useful in situations where you have a trusted client that doesn't need to download its code over the insecure connection and also you have some other secure way to register the user(s), SRP is not suitable for a web application. Web apps always download their code from the server, so if the connection to the server isn't secure, a MitM (or other network attacker, for example somebody spoofing DNS) can inject malicious code into the web app and there's nothing that you, the victim, can do about it. Once that code is there, it can capture any password or other data you enter, steal any key that is generated, and tamper with any requests you send or responses you receive without you even knowing.
answered yesterday
CBHacking
9,01711527
9,01711527
add a comment |
add a comment |
up vote
0
down vote
An alternative would be to set up a secure VPN to the destination server, and perform a HTTP login from there. A malicious man in the middle will therefore have to break the encryption on the VPN channel in order to attack the connection and retrieve the passwords.
However, in terms of end user usability, it's still not as good as HTTPS, since it requires them to setup and use a different channel with a different set of credentials.
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
add a comment |
up vote
0
down vote
An alternative would be to set up a secure VPN to the destination server, and perform a HTTP login from there. A malicious man in the middle will therefore have to break the encryption on the VPN channel in order to attack the connection and retrieve the passwords.
However, in terms of end user usability, it's still not as good as HTTPS, since it requires them to setup and use a different channel with a different set of credentials.
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
An alternative would be to set up a secure VPN to the destination server, and perform a HTTP login from there. A malicious man in the middle will therefore have to break the encryption on the VPN channel in order to attack the connection and retrieve the passwords.
However, in terms of end user usability, it's still not as good as HTTPS, since it requires them to setup and use a different channel with a different set of credentials.
An alternative would be to set up a secure VPN to the destination server, and perform a HTTP login from there. A malicious man in the middle will therefore have to break the encryption on the VPN channel in order to attack the connection and retrieve the passwords.
However, in terms of end user usability, it's still not as good as HTTPS, since it requires them to setup and use a different channel with a different set of credentials.
answered 2 days ago
March Ho
8631713
8631713
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
add a comment |
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
How is the DNS resolution protected? (1) Is the DNS resolver (a) local? (b) reachable by a secure link? (2)(a) Does resolution happen over the VPN? Is the authoritative DNS server reachable by the resolver by a secure link? (b) What happens if the DNS resolution occurs before the VPN is set-up? (c) Can false DNS results obtained before the VPN is set-up be cached? (3)(a) Does the resolver use DNSSEC? (b) How is validation failure treated by the resolver? DNS resolution can be secured, by it isn't trivial.
– curiousguy
yesterday
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
@curiousguy The same can be said for HTTPS though, unless you manually verify the certificate.
– March Ho
7 hours ago
add a comment |
up vote
0
down vote
It is certainly possible to send a password securely using HTTP. There is even a standard for it. It's called HTTP-Digest
and it's defined in RFC 7616. It's been a part of the HTTP spec for quite a while. It was originally designed to use only the MD5 message-digest ("hashing") algorithm, but later revisions of the standard allow the client and server to negotiate which algorithm to use.
Unfortunately, there are many problems with HTTP-digest and the most glaring of them is that the server needs to have the password in cleartext. So while it's possible to communicate passwords securely using HTTP, it's not possible to securely-store passwords on the server while using it. So basically, it's not useful.
As others have said, it would be better to implement TLS because it solves multiple problems all at the same time, and it's fairly forward-compatible.
add a comment |
up vote
0
down vote
It is certainly possible to send a password securely using HTTP. There is even a standard for it. It's called HTTP-Digest
and it's defined in RFC 7616. It's been a part of the HTTP spec for quite a while. It was originally designed to use only the MD5 message-digest ("hashing") algorithm, but later revisions of the standard allow the client and server to negotiate which algorithm to use.
Unfortunately, there are many problems with HTTP-digest and the most glaring of them is that the server needs to have the password in cleartext. So while it's possible to communicate passwords securely using HTTP, it's not possible to securely-store passwords on the server while using it. So basically, it's not useful.
As others have said, it would be better to implement TLS because it solves multiple problems all at the same time, and it's fairly forward-compatible.
add a comment |
up vote
0
down vote
up vote
0
down vote
It is certainly possible to send a password securely using HTTP. There is even a standard for it. It's called HTTP-Digest
and it's defined in RFC 7616. It's been a part of the HTTP spec for quite a while. It was originally designed to use only the MD5 message-digest ("hashing") algorithm, but later revisions of the standard allow the client and server to negotiate which algorithm to use.
Unfortunately, there are many problems with HTTP-digest and the most glaring of them is that the server needs to have the password in cleartext. So while it's possible to communicate passwords securely using HTTP, it's not possible to securely-store passwords on the server while using it. So basically, it's not useful.
As others have said, it would be better to implement TLS because it solves multiple problems all at the same time, and it's fairly forward-compatible.
It is certainly possible to send a password securely using HTTP. There is even a standard for it. It's called HTTP-Digest
and it's defined in RFC 7616. It's been a part of the HTTP spec for quite a while. It was originally designed to use only the MD5 message-digest ("hashing") algorithm, but later revisions of the standard allow the client and server to negotiate which algorithm to use.
Unfortunately, there are many problems with HTTP-digest and the most glaring of them is that the server needs to have the password in cleartext. So while it's possible to communicate passwords securely using HTTP, it's not possible to securely-store passwords on the server while using it. So basically, it's not useful.
As others have said, it would be better to implement TLS because it solves multiple problems all at the same time, and it's fairly forward-compatible.
answered yesterday
Christopher Schultz
1978
1978
add a comment |
add a comment |
up vote
-1
down vote
You need the recipient to send you his key. You can't randomly send someone encrypted info without them first providing you with their personal public key.
add a comment |
up vote
-1
down vote
You need the recipient to send you his key. You can't randomly send someone encrypted info without them first providing you with their personal public key.
add a comment |
up vote
-1
down vote
up vote
-1
down vote
You need the recipient to send you his key. You can't randomly send someone encrypted info without them first providing you with their personal public key.
You need the recipient to send you his key. You can't randomly send someone encrypted info without them first providing you with their personal public key.
answered yesterday
Tomachi
1042
1042
add a comment |
add a comment |
FireCubez is a new contributor. Be nice, and check out our Code of Conduct.
FireCubez is a new contributor. Be nice, and check out our Code of Conduct.
FireCubez is a new contributor. Be nice, and check out our Code of Conduct.
FireCubez is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsecurity.stackexchange.com%2fquestions%2f197330%2fhow-to-secure-passwords-over-http%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
53
Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
2 days ago
3
@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
2 days ago
You don't need native TLS - you could, theoretically, implement TLS over HTTP - but it would be nowhere near practical.
– Solomonoff's Secret
2 days ago
3
Is this a real problem you are facing or just a thought expirement?
– whatsisname
yesterday
1
@whatsisname I stated that in a previous comment, it's just an experiment
– FireCubez
17 hours ago