åå ãããsetodaNote CTF Exhibition ãéå§ãã¾ãããCTF ã«ã¯è¤æ°ã®ã«ãã´ãªãããã¾ããããªãã¼ã¹ã¨ã³ã¸ãã¢ãªã³ã°ãPwn ãåªå
çã«åãçµã¿ããã¨æã£ã¦ãã¾ããããããã ãããçµãã£ãã®ã§ã次ã¯ãksnctf ã並è¡ãã¦é²ãããã¨æãã¾ãã
ksnctf ããå½å
ã®å¸¸è¨ã® CTF ã§ãã
ããã§ã¯ããã£ã¦ããã¾ãã
ã¯ããã«
ãã»ãã¥ãªãã£ãã®è¨äºä¸è¦§ã§ããè¯ãã£ããåèã«ãã¦ãã ããã
ã»ãã¥ãªãã£ã®è¨äºä¸è¦§
ksnctf ã®å
¬å¼ãµã¤ãã¯ä»¥ä¸ã§ãã
ksnctf.sweetduet.info
ããã§ã¯ããã£ã¦ããã¾ãã
ksnctfã«ç»é²ãã
ä¸ã® URL ã«ã¢ã¯ã»ã¹ãã¦ãå³ä¸ã® Login ãã¯ãªãã¯ããã¨ãwith Twitter ã¨åºãã®ã§ãã¯ãªãã¯ãã¾ãã
ã¢ã¯ã»ã¹ã許å¯ããããèãããã®ã§ããé£æºã¢ããªãèªè¨¼ããã¯ãªãã¯ãã¾ãã
ãã°ã¤ã³ã§ãã¾ãããç»é²ã®æé ã¯ä»¥ä¸ã¨ãªãã¾ãã
åé¡ä¸è¦§
åé¡æ°ã¯ 41åã§ãå
¨ã¦ã®ãã¤ã³ããç²å¾ãã㨠5161ãã¤ã³ãã«ãªãã¨æãã¾ããRanking ãè¦ãã¨ã10,232åä¸ã6åã 5161ãã¤ã³ãã§ãããåå 人æ°ãå¤ãã§ããã
ãã® CTF ã¯ãWriteup ã®è¨äºãæ¸ããã¨ã¯åé¡ãªãã¨ã®ãã¨ã§ããããã©ã°ã®æååã¯å
¬éãã¦ã¯ãããªãã¨ã®ãã¨ã§ãã
å
¬å¼ãµã¤ãã§ã¯ãååé¡ã«ã¤ãã¦ãã«ãã´ãªã¯æ¸ããã¦ãã¾ããããåèã¾ã§ã«ãç§ãåæã«æ³åããã«ãã´ãªãæ¸ãã¦ããã¾ãã
No. |
ã«ãã´ãª |
åé¡å |
ãã¤ã³ã |
ç¶æ³ |
1 |
Misc |
Test Problem |
1 |
Complete |
2 |
Crypto |
Easy Cipher |
50 |
Complete |
3 |
Crypto |
Crawling Chaos |
100 |
Complete |
4 |
Pwn |
Villager A |
300 |
0% |
5 |
Crypto |
Onion |
70 |
0% |
6 |
|
Login |
120 |
0% |
7 |
|
Programming |
110 |
0% |
8 |
|
Basic is secure? |
50 |
0% |
9 |
|
Digest is secure! |
150 |
0% |
10 |
Misc |
#! |
20 |
Complete |
11 |
|
Riddle |
200 |
0% |
12 |
|
Hypertext Preprocessor |
70 |
0% |
13 |
|
Proverb |
70 |
0% |
14 |
|
John |
60 |
0% |
15 |
|
Jewel |
250 |
0% |
16 |
|
Math I |
150 |
0% |
17 |
|
Math II |
50 |
0% |
18 |
|
USB flash drive |
80 |
0% |
19 |
|
ZIP de kure |
150 |
0% |
20 |
|
G00913 |
30 |
0% |
21 |
|
Perfect Cipher |
200 |
0% |
22 |
|
Square Cipher |
60 |
0% |
23 |
|
Villager B |
450 |
0% |
24 |
|
Rights out |
100 |
0% |
25 |
|
Reserved |
30 |
0% |
26 |
|
Sherlock Holmes |
70 |
0% |
27 |
|
Lives out |
150 |
0% |
28 |
|
Lo-Tech Cipher |
60 |
0% |
29 |
|
Double Blind |
50 |
0% |
30 |
|
Alpha Mixed Cipher |
80 |
0% |
31 |
|
KanGacha |
130 |
0% |
32 |
Web |
Simple Auth |
50 |
Complete |
33 |
|
HTTPS is secure. |
180 |
0% |
34 |
|
Are you human? |
220 |
0% |
35 |
Web |
Simple Auth II |
20 |
0% |
36 |
|
Are you ESPer? |
120 |
0% |
37 |
|
Competitive Programming |
600 |
0% |
38 |
|
Canned Can Opener |
80 |
0% |
39 |
|
Unknown Plaintext Attack |
250 |
0% |
40 |
|
Deep Flag Network |
100 |
0% |
41 |
|
Private BBS |
80 |
0% |
Misc
æåã®åé¡ã¯ãTest Problem ã¨ãããã¨ãªã®ã§ããããã Miscï¼ãã¹ã¯ï¼ã§ãã
Test Problem
Problems ãããTest Problem ãã¯ãªãã¯ãã¾ãã
1ãã¤ã³ãç²å¾ãã¦ã10,232åä¸ã7,679ä½ã«ãªãã¾ããï¼
0ãã¤ã³ãã®ã¾ã¾ã®æ¹ããã¾ããããåããã¤ã³ãã®å ´åã¯ãå¾ãããã®ãã¤ã³ãã«ãªã£ã人ããä¸ã®é ä½ã«ãªãããã§ãã
#!
åé¡åãè¨å·ã ãã§ãã
20ãã¤ã³ãç²å¾ãã¦ãè¨21ãã¤ã³ãã§ã10,232åä¸ã7,550ä½ã«ãªãã¾ããï¼
Crypto
Easy Cipher
ã·ã¼ã¶ã¼æå·ã£ã½ãã§ãã
ããã¨é«ãé »åº¦ã§åºã¦ããã®ã§ãPython ã§æ¸ãã¦ããã¾ãã
def str2int( ss, offset=0 ):
lst = []
for cc in ss:
if cc == ' ':
lst.append( ord(cc) )
elif '0' <= cc <= '9':
mm = (ord(cc) - ord('0') + offset) % (ord('9') - ord('0') + 1)
lst.append( mm + ord('0') )
elif 'A' <= cc <= 'Z':
mm = (ord(cc) - ord('A') + offset) % (ord('Z') - ord('A') + 1)
lst.append( mm + ord('A') )
elif 'a' <= cc <= 'z':
mm = (ord(cc) - ord('a') + offset) % (ord('z') - ord('a') + 1)
lst.append( mm + ord('a') )
else:
lst.append( ord(cc) + offset )
print( f"str2int={lst}" )
return lst
def int2chr( lst ):
ss = ""
lst_ret = []
for ii in lst:
ss += chr(ii)
lst_ret.append( chr(ii) )
print( f"int2chr={ss}" )
return lst_ret
ss = "EBG KVVV vf n fvzcyr yrggre fhofgvghgvba pvcure gung ercynprf n yrggre jvgu gur yrggre KVVV yrggref nsgre vg va gur nycunorg. EBG KVVV vf na rknzcyr bs gur Pnrfne pvcure, qrirybcrq va napvrag Ebzr. Synt vf SYNTFjmtkOWFNZdjkkNH. Vafreg na haqrefpber vzzrqvngryl nsgre SYNT"
lst = str2int( ss, -13 )
lst_ret = int2chr( lst )
å®è¡ãã¦ã¿ã¾ãããããã°çãªã¨ããã¯çç¥ãã¦è²¼ãã¾ãã
$ python tmp.py
int2chr=ROT XIII is a simple letter substitution cipher that replaces a letter with the letter XIII letters after it in the alphabet! ROT XIII is an example of the Caesar cipher developed in ancient Rome! Flag is FLAGSwzgxBJSAMqwxxAU! Insert an underscore immediately after FLAG
空ç½ã ãã§ã¯ãªããè¨å·ãªã©ãããã®ã¾ã¾åºåããããã«ããæ¹ãè¯ãã£ãã§ããã
50ãã¤ã³ãç²å¾ãã¦ãè¨71ãã¤ã³ãã§ã10,232åä¸ã5,561ä½ã«ãªãã¾ããï¼
Crawling Chaos
ãªã³ã¯ã 1ã¤ããã ãã§ãããã®ãªã³ã¯ãã¯ãªãã¯ããã¨ãå
¥åãã©ã¼ã ã 1ã¤ã¨ãéä¿¡ãã¿ã³ãããã ãã§ããæå㯠Web ããªãã¨æãã¾ããããCrypto ã«ãã¦ããã¾ãã
試ãã«ãaaa
ã¨éãã¨ãä½ããªãã£ããã®ããã«ããã©ã¼ã ã«å
¥åããæååãæ¶ããã ãã§ããåé¡ã®ã¿ã¤ãã«ã® Crawling Chaos
ã¨ã¯ããã«ãªã¹ãéããã¨ããæå³ã®ããã§ãã
ããããåé¡ã®å ´åãæ»æã«ãªããããªãããããæååãã²ãããå
¥åãã¦ããã®ãæ£ããããæ¹ãªãã§ãããããæ®éã®ãã©ã¦ã¶ã§è©¦ãã¨ãããããè¦ããªããã®ãå¤ãã®ã§ãBurp Suite ãªã©ã使ã£ã¦ãHTTP ã®ããããè¦ã¦ããæ¹ãããã¨æãã¾ãã
Burp Suite ã使ã£ã¦è¦ã¦ã¿ãã¨ãã¬ã¹ãã³ã¹ã«ã大éã®å¤ãªæåãè¿ã£ã¦ãã¦ãã¾ãã以ä¸ã®ãããªæååã§ãã¾ã ã¾ã 大éã«ç¶ãã¾ãã
(á§áÏá)=(/áÏá/),(á§áÏá).á§ãã¼=-!!(/áÏá/).ã«ãã¼,(ã³áÏá)=(á§áÏá),(ã³áÏá).ã³ã«ãã¼=- -!(á§áÏá).á§ãã¼,(á§áÏá).á§ãã¼ï½°=(ã³áÏá).ã³ã«ãã¼- -!(á§áÏá).á§ãã¼,(ã³áÏá).ã³ã«ãã¼ï½°=(á§áÏá).á§ãã¼ï½°- -(ã³áÏá).ã³ã«ãã¼,(á§áÏá).á§ãã¼ã¼=(ã³áÏá).ã³ã«ãã¼ï½°- -!(á§áÏá)
ãã®å¤§éã®æååã®ä¸ã«ããã©ã°ãé ãã¦ãã¨æ¨æ¸¬ããã¾ããURL ã unya.html
ã¨ãããã¨ã§ããããã¨ãã«ãããé¢ä¿ãããã§ãããããã«é¡æåã¯é¢ä¿ãªãããªãã¨æãã¾ãã
ãããã¨ãã«ããã«ç¶ããå
¨è§ã®ãã¤ãã³ã¨åè§ã®ãã¤ãã³ã¯ãã¢ã¼ã«ã¹ä¿¡å·ã®ããã«è¦ãã¾ããã¢ã¼ã«ã¹ä¿¡å·ã¨è¨ãã°ããããã¨ãã«ããã§ãã¢ã¼ã«ã¹ä¿¡å·ã®ããã«ãè¦ãã¾ãï¼ç¬ï¼ãæ確ãªåºåãæåãåããã¾ããã
è¦æ¹ãå¤ãã¦ããããã 0 ã§ããã«ããã 1 ã§ã2é²æ°ã¨è¦ã¦ãASCIIã³ã¼ãã«ãªãã¨ãã¯ãã©ãã§ããããããã¼ããéãæ°ãããã
ããã¼ããã«ãã¼ãã§æ¤ç´¢ãããããã³ã¼ãã¨ãåºã¦ãã¾ããããªãã»ã©ããããããã¨ã§ããã
æ¬æ¥ãªããå
¥åãã©ã¼ã ã«ä½ãå
¥åããã¨ãJavaScript ã®ãããã¢ãããåºãä»æ§ã¿ããã§ããç¾å¨ã¯ãjquery ããã¾ãèªããªãããã§ãã試ãã«ãjquery ããã¼ã«ã«ã«ç½®ããç¶æ
ã§ãunya.html ãåããã¦ã¿ã¾ããã
以ä¸ã®ããã«ãä½ãæåãå
¥ããã¨ããããã¢ãããåºã¾ããããããã½ã¼ã¹ãè¦ã¦ãããããªãããã¢ãããåºããããªã½ã¼ã¹ã¯ç¡ããããã¼ãã¨ãã«ãã¼ãã ãã«è¦ãã¾ãã
JavaScript ã¯ãå¤æ°åã«å
¨è§æåã使ããã¨ãããã¨ã§ãããã¯æ£ããã½ã¼ã¹ã³ã¼ãã¨ãããã¨ã§ãããã®ã¾ã¾ã§ã¯èªã¿ã«ããã®ã§ãã¨ãããããconsole.log ã§åºåãã¦ã¿ãã°ãããããããããæ´å½¢ããã®ã以ä¸ã§ãã
å¤æ° f ããfalse ã«ããªããã°è¯ãããã§ããããã®ããã«ã¯ãif(t.charCodeAt(i) * (i + 1) != p[i])
ã常ã«æãç«ã¤ããã«ãp ã«åããã¦å
¥åãã¦ããã°ããã§ãã
$(function(){
$("form").submit(function(){
var t = $('input[type="text"]').val();
var p = Array(70,152,195,284,475,612,791,896,810,850,737,1332,1469,1120,1470,832,1785,2196,1520,1480,1449);
var f = false;
if(p.length == t.length){
f = true;
for(var i = 0; i < p.length; i++)
if(t.charCodeAt(i) * (i + 1) != p[i])
f = false;
if(f)
alert("(ãã»Ïã»)ããã¼!(/ã»Ïã»)/ã«ãã¼!");
}
if(!f)
alert("No");
return false;
});
});
ã§ã¯ãPython ã§è¨ç®ããã¾ãã
lst = [70,152,195,284,475,612,791,896,810,850,737,1332,1469,1120,1470,832,1785,2196,1520,1480,1449]
for ii, pp in enumerate(lst):
ret = int( pp / (ii + 1) )
assert ret * (ii + 1) == pp, "fatal"
print( chr(ret), end="" )
print()
å®è¡ããã¨ããã©ã°ãåºåããã¾ãã
100ãã¤ã³ãç²å¾ãã¦ãè¨171ãã¤ã³ãã§ã10,232åä¸ã4,150ä½ã«ãªãã¾ããï¼
Onion
大éã®æåãããã¾ããbase64 ã§ããããã76æåãã¨ã«æ¹è¡ãå
¥ã£ã¦ãã¾ãã
base64 ã§ãã³ã¼ããã¦ã¿ã¾ããããæååã§ã¯ãªãããã§ãã
ã¡ãã£ã¨åãããªãã®ã§ãå¾åãã§ãã
ããããCrypto ã«ãã¦ããã¾ãã
Web
Simple Auth
URL ã 2ã¤ããã¾ãï¼http 㨠httpsï¼ããå®éã«è¡ã£ã¦ã¿ãã¨ãè¦ãç®ã¯åãã«è¦ãã¾ãã
ã½ã¼ã¹ãããã®ã§ãè¦ã¦ã¿ã¾ããFLAG_????????????????
ãå
¥ããã¨ãè¯ãããã§ããããããããã®ã¾ã¾ãã©ã°ã«ãªãã¨ãããã¨ã§ããããã
<html>
<head>
<title>Simple Auth</title>
</head>
<body>
<div>
<?php
$password = 'FLAG_????????????????';
if (isset($_POST['password']))
if (strcasecmp($_POST['password'], $password) == 0)
echo "Congratulations! The flag is $password";
else
echo "incorrect...";
?>
</div>
<form method="POST">
<input type="password" name="password">
<input type="submit">
</form>
</body>
</html>
ãã®ã½ã¼ã¹ããWebãµã¼ãã«ã¢ãããã¦ããã£ã¦ã¿ã¾ãããã£ã±ãããã§ããã§ããããã¨ãããã¨ã¯ããã®ã½ã¼ã¹ã¯ãå®éã«ä½¿ããã¦ãã½ã¼ã¹ã¨ã¯éãã£ã¦ãã¨ã§ãããã????
ãèããåé¡ã¨ãããã¨ã§ããããã
ãã¼ããå¾åãã«ãã¾ãã
Simple Auth II
Simple Auth ã«ç¶ãã¦ãSimple Auth II ã§ãããªãã â
¡ ã®æ¹ããã¤ã³ããä½ãã§ãã
ãã¡ãããURL ã 2ã¤ããã¾ãï¼http 㨠httpsï¼ããå®éã«è¡ã£ã¦ã¿ãã¨ãè¦ãç®ã¯åãã«è¦ãã¾ããã½ã¼ã¹ãããã®ã§ãè¦ã¦ã¿ã¾ãã
ãã¡ããå¾åãã«ãã¾ãã
Pwn
Villager A
300ãã¤ã³ãã®åé¡ã§ããSSH ã§ãã°ã¤ã³ã§ããã¨ãããã¨ã§ããããã
試ãã«ããã°ã¤ã³ãã¦ã¿ã¾ããå
¥ãã¾ããããã©ã°ãããã¾ãï¼ãããã権éããªãã§ããq4 ã¨ããããã°ã©ã ãç½®ãã¦ããã¾ãããããSGID ã®ããããç«ã£ã¦ã¾ããããã®ããã°ã©ã ãå®è¡ãã¦ãã¨ãã«ãã©ã°ãèªããã¨ãããã¨ã§ããããã
$ ssh [email protected] -p 10004
The authenticity of host '[ctfq.u1tramarine.blue]:10004 ([160.16.127.224]:10004)' can't be established.
RSA key fingerprint is SHA256:LBqdPUUa6DGkF6+BSQfNrILUDplXcgxzAUIiW/DeFQ8.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ctfq.u1tramarine.blue]:10004' (RSA) to the list of known hosts.
[email protected]'s password:
[q4@eceec62b961b ~]$ ls
flag.txt q4
[q4@eceec62b961b ~]$ cat flag.txt
cat: flag.txt: Permission denied
[q4@eceec62b961b ~]$ ls -alF
total 32
dr-xr-xr-x 1 root root 4096 Feb 27 2021 ./
drwxr-xr-x 1 root root 4096 Feb 27 2021 ../
-rw-r--r-- 1 root root 18 Jul 21 2020 .bash_logout
-rw-r--r-- 1 root root 141 Jul 21 2020 .bash_profile
-rw-r--r-- 1 root root 456 Feb 27 2021 .bashrc
-r--r----- 1 root q4a 22 Feb 26 2021 flag.txt
-r-xr-sr-x 1 root q4a 5857 Feb 26 2021 q4*
32bit ã®ããã°ã©ã ã®ããã§ããã¨ãããããå®è¡ãã¦ã¿ã¾ãã
[q4@eceec62b961b ~]$ file q4
q4: setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=526c75e7f0f34744808eb1b09a5a91880562efc8, not stripped
[q4@eceec62b961b ~]$ ./q4
What's your name?
aa
Hi, aa
Do you want the flag?
bb
Do you want the flag?
^C
[q4@eceec62b961b ~]$
300ãã¤ã³ããªã®ã§ãç°¡åã§ã¯ãªãããã§ããå¾åãã«ãã¾ãã
ãããã«
ä»åã¯ãksnctf ã®ãã£ã¬ã³ã¸ãéå§ãã¾ããã
å°ããã£ã¦ã¿ãææ³ã§ãããã«ãã´ãªãåãããªãã®ã¨ãåé¡ã®ã¬ãã«ãåãããªãã®ã¯ãåå¿è
ã«ã¯å°ãå³ããã£ãã§ããã©ããªã«ãã´ãªã§ããããç¨åº¦é²ãããã CTFä¸ç´è
以ä¸ã®æ¹ã対象ãªæ°ããã¾ãã
ãã¨ãã¡ã³ããã³ã¹ãããã¦ããªããããªã®ã§ãåå¿è
ã¯ãå¤ãªã¨ããã«ãããã¨ãããããã¾ãããå¥ã®åé¡ã§ãã¬ãã«ãä¸ãã¦ãããåææ¦ãããã¨æãã¾ãã
æå¾ã«ãªãã¾ããããã¨ã³ã¸ãã¢ã°ã«ã¼ãã®ã©ã³ãã³ã°ã«åå ä¸ã§ãã
æ°æ¥½ã«ãããã¨ãããããé¡ããããã¾ãð
ä»åã¯ä»¥ä¸ã§ãï¼
æå¾ã¾ã§ãèªã¿ããã ãããããã¨ããããã¾ããã