Damncon 2022 Writeup

この大会は2022/12/22 0:00(JST)~2022/12/25 0:00(JST)に開催されました。
今回もチームで参戦。結果は134点で637チーム中91位でした。
自分で解けた問題をWriteupとして書いておきます。

Test - CTF (web)

$ curl https://test-ctf.dsphctf.repl.co/source.txt
<?php
require 'function.php';

$dev = $_GET['number'];
if (isset($dev)) {
	if (is_numeric($dev)){
		if (!strpos($dev, ".")){
			if (strlen($dev) > 6){
				if ($dev < 99999 && $dev > 90000)
				echo 'Flag:  '.'Damncon{FAKE_FLAGS}';
				else
				print '<div class="alert">Oh Oh Think again</div>';
			} else
				print '<h1>Wrong Move Champ</h1>';
		} else
		print '<h1>Not That hard . keep trying</h1>';	
	} else
		print '</h1>Just read the source code once again</h1>';
}
?>

例えば、numberに95000e0と指定すれば、$devは95000と同等なので、条件を満たす。
https://test-ctf.dsphctf.repl.co/?number=95000e0にアクセスすると、フラグが表示された。

DAMNCON{Q4L3URPGHJMA65C}

WELCOME CHALLENGE (general)

URLのidのパラメータの値で"%"が不足しているので、適宜"%"を入れる。

DAMNCON%25%25%25%25%25%25%25%25%7BWELCOM_2022%25%25%25%25%25%25%25%25%7D

これをCyberChefなどで、URLデコードする。

DAMNCON%%%%%%%%{WELCOM_2022%%%%%%%%}

"%"を削除するとフラグになった。

DAMNCON{WELCOM_2022}

Giffy (crypto)

アニメーションGIFが添付されている。
以下の順に数字が表示される。

144
141
155
156
143
157
156
173
147
151
146
137
143
162
141
143
153
145
144
175

8進数のASCIIコードとしてデコードする。

#!/usr/bin/env python3
codes = ['144', '141', '155', '156', '143', '157', '156', '173', '147', '151',
    '146', '137', '143', '162', '141', '143', '153', '145', '144', '175']

flag = ''
for code in codes:
    flag += chr(int(code, 8))
print(flag)
damncon{gif_cracked}

Webnux (web)

HTMLソースを見るが、何もない。読み込んでいるstatic/scripts.jsを見てみると、コメントにフラグが書いてあった。

const cdPrinter = () => {
    /* flag: damncon{shunux_web_cracked} */
    let cdDiv = document.createElement("p")
    cdDiv.innerHTML = "Ohh... You Hackoor? Sorry kid it's just a website not a machine"
    cdDiv.setAttribute("class", "ag output-row")
    siteContainer.insertBefore(cdDiv, currentTerminalDiv)
}
damncon{shunux_web_cracked}