Sitemap
November Rain

November Rain

A persistent of xchopath's brain-cache. https://novr.one | https://zerobyte.id .

Is HTTP Basic-Authentication Secure?

2 min readNov 25, 2022

--

HTTP BASIC-Auth is basic authentication to protect an authorized page which transmits credentials as user-id/password pairs, encoded using Base64. For example client request contains a header field: “Authorization: Basic <Base64>” and server-side will validate the request. It does not require cookies, session identifiers, or login page and easy to implement.

HTTP Basic Authentication.

Is BASIC-Auth secure “enough” to protect the system?

Generally BASIC-Authentication is not considered secure.

Get November Rain’s stories in your inbox

Join Medium for free to get updates from this writer.

Everyone thoughts HTTP BASIC-Authentication is secure enough to protect their system because BASIC-Authentication implementation is the simplest technique for enforcing access controls to web resources. But it is not completely safe, even the dev using (TLS/SSL).

Several reasons Why Auth BASIC is never considered secure:

1. Password encoding is too weak (Base64)

The password using mainstream encoding like Base64 (not an encryption or hash) and then Attacker could decode the password easily.

2. Password is cached by browser

Password may be stored permanently in the browser (if the user requests) and might be stolen by another user on a shared machine. Even though it does not happen, there is an another issue like CSRF as HTTP Basic Authentication vulnerability, because the cached password can be reused by any other request to the server. By the way i found this bug (CSRF through HTTP Basic Auth) in my client’s app, I will explain this in another post.

3. Password sent repeatedly (request by request)

It sounds not an issue, but it is dangerous though. If the password stored in DB, the DB should do a query to validating the password and will cause a bottleneck issue. Let’s say it will be a DoS Attack.

From those points, we can say HTTP Basic Auth is not secure anymore.

If you still using Basic authentication, I suggest you to change your Basic authentication to Bearer authentication, I think Bearer Auth is better than Basic authentication to improve any system security. You can prevent CSRF, prevent attacks via CORS, and many more.

Should We Move?

Yeah you should because Github is deprecating HTTP BASIC-Auth for the few endpoints on GitHub.com since 8 Aug 2019 and Microsoft is also deprecating HTTP BASIC-Auth from Exchange Online since 20 Sept 2019.

Do you still want to use BASIC Authentication after it?

--

--