Live data from Hacker News

Using HTTP Basic Auth in 2022

joeldare.com

251–260 of 345 posts

Re: Using HTTP Basic Auth in 2022

#251
post #2

How do you logout?

Send an ajax request to your api with invalid credentials. The response returns a 401 and loggs the user out. Then redirect to the pre-login page.

if all the client needs is to see a 401, can't you just make a static /logout page that always renders a 401?

Re: Using HTTP Basic Auth in 2022

#252

Earlier quoted context omitted.

> The beautiful thing about this scheme is that the cookie is always sent, so I can create a rule which bypasses auth when the cookie is present. You don't even need the basic auth for that. Years ago I needed to expose my pfsense WebGUI on the default HTTPS, but I didn't want it to be so obvious, so I made a couple of HAProxy rules, which allowed me to open https://pfsense.tld/open-sesame to set a cookie, after whic…

Kind of like “port knocking” but for HTTP.

I like the idea of a multistep version, load domain.com/string1, domain.com/string2, domain.com/string3 in order and within a certain timeframe.

Re: Using HTTP Basic Auth in 2022

#253
post #187

Earlier quoted context omitted.

idk if you even need a zero knowledge proof. Server sends client a salt, client hashes the salt and password and sends back to server. Implement this as a built-in feature of the web browser, and the browser can show a special icon or symbol to mark that the password will be sent hashed (and later show a warning on password fields sent via plaintext).

Could that really work? Sounds like it's highly abusable if someone compromises the database and gets a list of all the hashes. Now, they don't even need to use rainbow tables or any brute force to compute the password. They just send the hash to the server and will be logged in.

Yes, if an attacker compromises the database they can send the direct hash.

The point is that a malicious or badly-secured site can't use your password on other websites, because ultimately most people use the same password on many different sites.

Re: Using HTTP Basic Auth in 2022

#254

Earlier quoted context omitted.

Plenty of very simple web apps terminate TLS at the edge ie: at something like API Gateway. So if you then turn on request logging... voila. Hardly a complex scenario, happens all the time. Or at the application layer: @path("/login") def login(request): print("I have a bug, I'll just log the whole request real quick to see wtf is up!", request) It's actually very hard to ensure that the password doesn't get logged.…

If the hash is used to authenticate, how is leaking the hash less bad than leaking the password? If I have the hash I can already impersonate you.

Because many inputs map to that hash (the hashing function is surjective instead of bijective). People re-use passwords all the time. If the hash leaks it will only affect the particular service.

Re: Using HTTP Basic Auth in 2022

#255
post #48

HTTP Basic Auth could be so much better with a little help from browsers. If it was a bit better, most websites wouldn't need to implement login pages over and over again. Plus it would be more secure since the popup is in its own security context. * Add a button to log out. Logout never really worked across browsers with basic auth. * Allow to inject a logo or a tiny bit of customization for branding. The default po…

> Improve the Digest auth to modern crypto standards

There is https://datatracker.ietf.org/doc/html/draft-yusef-httpauth-s... but looks like it had never gained any traction.

And most likely won't, because browser vendors seem to be extremely reluctant to do anything but deprecate all those standard UIs in favor of messed up JS APIs.

Re: Using HTTP Basic Auth in 2022

#256
post #48

HTTP Basic Auth could be so much better with a little help from browsers. If it was a bit better, most websites wouldn't need to implement login pages over and over again. Plus it would be more secure since the popup is in its own security context. * Add a button to log out. Logout never really worked across browsers with basic auth. * Allow to inject a logo or a tiny bit of customization for branding. The default po…

"Stop passing plain passwords over the wire." If you are using HTTPS, you are equally as good as any other login form. Some have suggested using JavaScript to encrypt passwords before send - but in my opinion, this is generally stupid because it breaks support on browsers without JavaScript, and this doesn't protect you from the server at all because a hacker could just change the JavaScript to send plaintext copies…

Except you usually send the password once, and get back a cookie with a token that you present for the rest of your session (possibly to other endpoints/servers). Whereas with basic auth, the login/password keeps being sent.

Re: Using HTTP Basic Auth in 2022

#257
Basic Auth has become increasingly difficult to use as a generic way to protect a web app. Many apps these days have endpoints that respond with 401 when a user isn't logged in, which if you're fronting the application with basic auth, results in the user being "logged out" as the browser thinks the credentials are no longer valid.

The hijacking of HTTP status codes by client-side apps wanting to interpret them in their own way makes me think we need a new range of codes for user-defined statuses.

Re: Using HTTP Basic Auth in 2022

#259
It seams firefox caches bad basic auth creds. It is so annoying because there are several sites where I can only do a basic auth login from a private window. If I go there in a regular window I just get the invalid authentication error, and no option to enter a new username/password. It isn't clear where this is cached either, so it is very difficult to clear that cache.

Re: Using HTTP Basic Auth in 2022

#260
post #48

HTTP Basic Auth could be so much better with a little help from browsers. If it was a bit better, most websites wouldn't need to implement login pages over and over again. Plus it would be more secure since the popup is in its own security context. * Add a button to log out. Logout never really worked across browsers with basic auth. * Allow to inject a logo or a tiny bit of customization for branding. The default po…

Upon account creation or reset, can't the user select a password, that hashed as the private key for a keypair and just the public sent to the server? Then when logging in they just sign a challenge on the client. Only thing stored is a users public key on the server.
Post reply on HN