For a hack lab in that I'm doing I reach a point where I get a
htpasswd file in clear in an Apache server.
Is there any tool that given the crypted password I can try to brute
force (or use a dictionary attack) and get the original password? There
are a lot of MD5 password crackers but they don't state if they work for
htpasswd generated passwords.
Thanks!
Miguel
------------------------------------------------------------------------
This list is sponsored by: Information Assurance Certification Review Board
Prove to peers and potential employers without a doubt that you can actually do a proper penetration test. IACRB CPT and CEPT certs require a full practical examination in order to become certified.
http://www.iacertification.org
------------------------------------------------------------------------
It's not easy to write bruteforce decryptor as it generates new
password each time upon generation.
>./htpasswd -nb test test
Automatically using MD5 format.
test:$apr1$O9B501zi$LIb3jgek2pqVEv29qfCqO0
>./htpasswd -nb test test
Automatically using MD5 format.
test:$apr1$Rekfkt5.$8NeNTA7C/Oy4jEuCgrnBE/
>./htpasswd -nb test test
Automatically using MD5 format.
test:$apr1$PEH.OBdt$wE/nHRG.FYo2bzmAfxfIn1
>./htpasswd -nb test test
Automatically using MD5 format.
test:$apr1$BtwEARib$2WWdK3nGlAWVutTRkFyV20
2010/6/18 Miguel González Castaños <miguel_3...@yahoo.es>:
-----邮件原件-----
发件人: listb...@securityfocus.com [mailto:listb...@securityfocus.com] 代表 Jacky Jack
发送时间: 2010年6月19日 22:05
收件人: Miguel González Castaños
抄送: pen-...@securityfocus.com
主题: Re: htpasswd decrypt
> -- This list is sponsored by: Information Assurance Certification
> I haven't been aware of it, too.
> If you know it, let me know.
Why don't you just try? Took me less than two minutes:
home template # htpasswd -cbm testfile test test
Adding password for user test
home template # cat testfile
test:$apr1$qgW5z/..$7Y85TQKs.nBK6GbO.VqfK/
home template # john testfile
Created directory: /root/.john
Loaded 1 password hash (Apache MD5 [32/32])
test (test)
guesses: 1 time: 0:00:00:00 100% (1) c/s: 25.00 trying: test
So the answer is: yes, it works.
Cheers,
Christine Kronberg.
(void) srand((int) time((time_t *) NULL));
ap_to64(&salt[0], rand(), 8);
It seems that time based seed is used to generate MD5 hash. Also, according to source, "salt" is char array and is 8 bytes long (+1 null byte). If you want to bruteforce password, you will need to bruteforce these 8 bytes too
---
Gaurav Kumar, CISSP
Email:g...@pivotalsecurity.com| Phone: +1 (425) 686-9695 |Web: www.pivotalsecurity.com
> -- This list is sponsored by: Information Assurance Certification
Thanks,
Miguel
--- El dom, 20/6/10, Christine Kronberg <see...@shalla.de> escribió:
John did the trick
Thanks
Miguel
The salted hashes are only a challenge if you don't have the salt,
like in the case of generating rainbow tables.
> 2010/6/18 Miguel González Castaños <miguel_3...@yahoo.es>:
>> Hi all,
>>
>> For a hack lab in that I'm doing I reach a point where I get a htpasswd
>> file in clear in an Apache server.
However, the original poster has captured the file, and therefore has
the full salt and hash. So a brute-force or dictionary attack against
the captured hash using any number of the tools already mentioned in
this thread will work just fine.
PaulM