I'm making a REST-API and it's straight forward to do BASIC auth login. Then let HTTPS secure the connection so the password is protected when the api is used.
Can this be considered secure?
|
I'm making a REST-API and it's straight forward to do BASIC auth login. Then let HTTPS secure the connection so the password is protected when the api is used. Can this be considered secure? |
|||||||
|
|
There are a few issues with HTTP Basic Auth:
Of those, using SSL only solves the first. And even with that, SSL only protects until the webserver - any internal routing, server logging, etc, will see the plaintext password. So, as with anything its important to look at the whole picture. |
|||||||||||||||||
|
|
Depends entirely on how secure it needs to be. Basic auth over ssl will still be sending credentials in plain text, which means you only have one layer of protection. You would be better off to hash the password with a nonce, or better yet use claims model that passes the auth over to a trusted 3rd party. |
|||
|
|
|
Basic Auth over HTTPS is good, but it's not completely safe. Similar to how Fiddler works for SSL debugging, a corporate HTTPS proxy is managing the connection between the web browser and the Proxy (whose IP address appears in your webserver logs). In that case the HTTPS password is decrypted, and later re-encrypted at the corporate proxy. Depending on who is managing the proxy, and how its logs are used, this may be acceptable or a bad thing from your perspective. For more information on how SSL interception is done, see this link:
Some companies get around the certificate pop-up issue mentioned above by deploying the root certificates (of the Proxy) to each workstation via GPO. Although this will only affect software that uses the Microsoft Certificate store. Software such as Firefox needs to be updated differently. |
|||||||||||||||||
|
|
You note the need for authenticating the client and ask about the security of HTTP basic auth, over SSL. This is what SSL was designed for and will work fine so long as the password is a good one. If you're really setting this up for just a single client, that is easy to ensure by picking a long random password, e.g. 12 characters using a good source of randomness, or other techniques discussed at this site. Your client also also does need to ensure that you have the right cert for the server. In the situation like what you describe, using a self-signed cert as described at the python ssl page referenced will be fine. |
|||||||||||||
|
|
Plenty of large and popular sites use basic (or another forms-based) auth over HTTPS. It usually gets a 'sigh' from security-conscious people. Can you hash the password on the client-side and send the hash instead? That would raise the bar a bit more. That said, it's generally considered acceptable, under the condition that your landing page hosting the logon form is HTTP/S as well. In your case of a RESTful API you probably don't have a landing page so that's okay. If you can, verify your application with some free security tools like Watcher and Skipfish. |
|||||
|
|
I am using this myself for many things, and as long as you don't ignore any SSL warnings from the browser you should be good. SSL works below HTTP, so any data transmitted through HTTP will be encrypted. It'll be as secure as submitting any password form, like Stack Exchange's for example. Instead of using a self-signed certificate though, I would suggest using StartSSL. They provide free certificates and are trusted by Microsoft, Mozilla, etc., and thus it won't give an SSL warning in the browser. I think it's better to use this instead of a self-signed certificate; if you ever see an SSL error you know it's real and not just because your cert is self-signed. |
|||||||||||
|
|
Try to think of it this way: When you are logging in to any website using SSL, you are most likely passing password in plain-text over HTTPS (for eg GMail). The only difference that Basic-Auth makes is that username/password is passed in the request headers instead of the request body (GET/POST). As such, using basic-auth+https is no less or more secure than a form based authentication over HTTPS. |
|||
|
|