ã¯ããã«
æ¬èšäºã¯ãæè¡æžå ž14ãBOOTH㧠ã®ã¿ãããã (@nomizooone) ãå¶äœãããŠãããããŸããCTF-è¹è²ã®ç 究-ãã«é¢ããWriteupã§ãã
ã¯ãªã¢ããŠããªãæ¹ã¯ãã¿ãã¬ã«ã泚æãã ããã
ããŸããCTF-è¹è²ã®ç 究- ãšã¯
ããŸãããšCTFãçµã¿åãããåå¿è åãCTFã€ãã³ãã§ããè³Œå ¥ãããšæã«å ¥ãã¯ãªã¢ãã¡ã€ã«ãšããŒããŒããã®ãããå·§åŠã«äœãããŸããŠããŠæåããŸããããããç©ççã«äœ¿ãããŸããããããç©ãããããªããéãããšãã®çœå¿«æãå³ãããããšãŠã楜ãããã³ã³ãã³ãã§ãã
JeopardyïŒãžã§ããã£ïŒåœ¢åŒã§ãããªããŸãã
ããŸããCTFã®Twitterããã·ã¥ã¿ã°: #nazotokiCTF
(2023/05/31æç¹)
CTFã€ãã³ãéå¬æé㯠2024幎1æ3æ¥13:30 ãŸã§ãªã®ã§ã泚æãã ããã
ã¯ãªã¢ãã¡ã€ã«ãšã¬ãžã¹ãã¬ãŒã·ã§ã³ã³ãŒããæžãããããŒããŒã¯ãäžèšãµã€ãã§è³Œå
¥ã§ããŸãã
1st Challenge
1st Challenge èµ€:Reversing
åé¡
-
ãã€ã³ãã³ããŒ777ã®æ¹ãæ¢ããŠããã£
-
1_Reversingãšããå®è¡ãã¡ã€ã«ãããŠã³ããŒãã§ãã
æ å ±åé
-
åé¡ã«ãã
nc
ã³ãã³ãã§åé¡ãµãŒãã«æ¥ç¶ãããš"Enter your name:"ãšååãæ±ããããã"DonGury"ãšå ¥åãããšMineNumberã¯712ã ãšè¿ã£ãŠãããããã777ã«ãªãæååãæ¢ãã°ãããâââ(kaliã¿kali)-[~] ââ$ nc xxx.xxx.xxx.xxx 12345 ************************ MineNumber Search Engine ************************ Enter your name: DonGury Your MineNumber is : 712 Donât mind. I'm looking for the 777.
-
ããŠã³ããŒããã "1_Reversing" ã«å¯ŸããŠã
strings
ã³ãã³ãã§æªãããªå¹³æãç¡ããæ€çŽ¢ãããšãflag.txtãšããæåãèŠã€ãã£ããããããnc
ã³ãã³ãã§æ¥ç¶ããå ã«flag.txtããã£ãŠãã®äžã«ãã©ã°ããããšæããããâââ(kaliã¿kali)-[~/work/nazotoki_7color/1st_red] ââ$ strings 1_Reversing | grep -E "((nazo)|(777)|(flag))" flag.txt t mind. I'm looking for the 777. flag
éã¢ã»ã³ãã«
-
Ghidra 10.2.2ãã€ã³ã¹ããŒã«ãã (ååã ãã¯èããããšãã£ããã©åããŠäœ¿ããŸãïŒ)
-
1_Reversingãèªã¿èŸŒã
-
"Symbol Tree"ãã
main
é¢æ°ãéžæããã³ã³ãã€ã«ã³ãŒãã確èªããã -
ãã³ã³ãã€ã«ããã³ãŒããèŠããšã
local_64
ã777
(0x309
) ã«ãªãå ¥åæåãæ¢ãã°flagãåºåããŠããããã// ãã³ã³ãã€ã«ããã³ãŒã while ((local_60 < 0x40 && (local_58[(int)local_60] != 10))) { local_64 = local_64 + (int)local_58[(int)local_60]; local_60 = local_60 + 1; } printf("Your MineNumber is : %d\n",(ulong)local_64); if (local_64 == 0x309) { puts(flag); puts("You are the luckiest!"); }
-
ãªããã³ã³ãã€ã«ããã³ãŒãã«ã¯ "You are Mr. Polmes. Your crypto key is 'VIGENERE'. but, This is not Flag!" ãšããæªãããªèšè¿°ããã£ããåŸã§äœ¿ãããããããªãã®ã§èŠããšãã
ãã³ã³ãã€ã«ã³ãŒãããçµæã777ã«ãªãæååãèãã
- ãã³ã³ãã€ã«ããã³ãŒããããå
¥åæåã1æåãã€
int
ã«ãã£ã¹ãããŠå ç®ããã®åèšã777
ã«ãªãã°ãããšããããšããããã - ASCIIã³ãŒãã§ã¯ "d" ã "100", "M" ã "77" ãªã®ã§, "dddddddM" ãå ¥åããã°ããããã
-
nc
ã³ãã³ãã§åé¡ãµãŒãã«æ¥ç¶ã"dddddddM"ãšå ¥åãããšç¡äºã«ãã©ã°ãåããïŒ
1st Challenge æ©:Crypto
åé¡
-
æå·ã解ãã«ã¯ããŒã ãºã®çªå·ã調ã¹ããšãããã£
"FWTS ZSEHVQ TS XSKEZ PG WHMU HZAA.WHMU XJPG WRX LWZZ OH AS ICVSA HRWL."
ããŒã ãºã®çªå·ã調ã¹ã
-
ã1st Challenge èµ€:Reversingãã®ã³ãŒãå ã«ã"You are Mr. Polmes. Your crypto key is 'VIGENERE'. but, This is not Flag!" ãšããèšè¿°ããã£ãã®ã§ããã䜿ãããã
-
åé¡æã®"FWTS ZSEHVQ TS XSKEZ PG WHMU HZAA.WHMU XJPG WRX LWZZ OH AS ICVSA HRWL."ãæå·åãããæååã§ã"VIGENERE"ãæå·ããŒãšããŠåŸ©å·ããŠã¿ãã
埩å·
-
ã¹ããŒã¹ ã "." ãå ¥ã£ãŠããã®ã§ãã¢ã«ãã¡ããããäœãããå€æããŠèªãããããªãããªããšããããã€ããŠã¿ããããããªãâŠ
-
"VIGENERE"ããã³ããªã®ããªïŒãªããªãïŒ
-
âŠå šããããããä¿çã
-
(æ°æéåŸ) Googleå çãªã "VIGENERE" ããåããïŒãšæã£ãŠã°ã°ããšãŽã£ãžã¥ãã«æå·ãšãããã®ãããããšãç¥ã£ããç¥ããªãã£ãâŠ
-
ãŽã£ãžã¥ãã«æå·ã解ããšãã©ã°ãå€æïŒïŒ (èªåã§ã³ãŒããæžããªããŠããµããšå€æã§ãããµã€ãã¯ããããã§ããïœ)
# ãŽã§ãžã§ãã«æå·ã§æå·åãããæååã埩å·ãããµã³ãã«ã³ãŒã enc_code = "FWTS ZSEHVQ TS XSKEZ PG WHMU HZAA.WHMU XJPG WRX LWZZ OH AS ICVSA HRWL." key = "VIGENERE" A_ASCII = ord('A') ALFABET_NUM = ord('Z') - (A_ASCII - 1) dec_code = "" i_key = 0 for i in range(0,len(enc_code)): if enc_code[i] == " " or enc_code[i] == ".": dec_code = dec_code + enc_code[i] next else: tmp_num = ord(enc_code[i]) - (ord(key[i_key]) - A_ASCII) if tmp_num < A_ASCII: tmp_num = tmp_num + ALFABET_NUM dec_code = dec_code + chr(tmp_num) i_key = i_key + 1 if i_key >= len(key): i_key = 0 print(dec_code)
1st Challenge é»:Forensics
åé¡
-
äžçäžããããç¬ãè¹è²ã®åžã«å·»ãããŠå®å®äœçœ®ãããããªã£ãç¬éãã£ã
-
ããã§ãã€ãžãŒã¡ããç»å ŽïŒããããïŒïŒïŒ
-
3_Forensics.pngãšãããã€ãžãŒã¡ããç»åãããŠã³ããŒãã§ãããããã¯è¯ããµãŒãã¹ã
ãã€ãžãŒã¡ããç»åã解æããŠã¿ã
-
æ¡å€§ããŠãããããç®ç®ãªã©ãèŠãŠã¿ãã ãã ãã å¯æãã£ãã
-
exiftoolãã€ã³ã¹ããŒã«ããŠæ å ±ãèŠããæªããæ å ±ã¯ãªã
-
stringsã³ãã³ãã§ãæªããæ å ±ã¯ãªã
-
binwalkãã€ã³ã¹ããŒã«ããŠæ å ±ãèŠãŠã¿ããšâŠããïŒ PNGããã1æåã蟌ãŸããŠããïŒ
âââ(kaliã¿kali)-[~/work/nazotoki_7color/1st_yellow] ââ$ binwalk -e 3_Forensics.png DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 PNG image, 1000 x 1333, 8-bit/color RGB, interlaced 78 0x4E Zlib compressed data, best compression 2127564 0x2076CC PNG image, 115 x 20, 8-bit/color RGB, interlaced 2127642 0x20771A Zlib compressed data, best compression
-
splitã³ãã³ãã§ãã€ããªåå²ãããšããã©ã°ãåããïŒïŒ
âââ(kaliã¿kali)-[~/work/nazotoki_7color/1st_yellow] ââ$ split -b 2127564 3_Forensics.png --additional-suffix .png
1st Challenge ç·:Web
åé¡
-
ç«åAIãããããã£ãããŒã®èªå·±çŽ¹ä»ããŒãžãã§ãããã£
-
ã£ãŠããšã§æ©éã¢ã¯ã»ã¹ãã«ãã
ãã£ãããŒã®èªå·±çŽ¹ä»ããŒãž
-
ãããããªããŒãž
-
APIä»æ§æžãèŠããããã£ãããŒã«keyãšquestion(çªå·)ãä»ããŠAPIçºè¡ãããšçããè¿ã£ãŠãããããã
-
ãšããããAPIãå®è¡ããŠã¿ãããã©APIããŒãããããªãã
-
ãã£ãããŒã®èªå·±çŽ¹ä»ããŒãžã®Aboutããã£ããèªããšæªãããªæ å ±ãããã
- 16çªã®ãå±¥æŽããšããããŒã¯ãŒãããã³ãã«ãªãããã
- 17çªã¯åŸã§äœ¿ãããç¥ããªãã®ã§èŠããŠããã
APIããŒãæ¢ã
-
APIä»æ§æžã®ããGitHubã®å€æŽå±¥æŽã«ã¯èŠåœãããªãã£ã
-
ãã£ãããŒã®èªå·±çŽ¹ä»ããŒãžã®ãœãŒã¹(HTML)å ã«ãç¡ãã£ã
-
ãã以å€ã«ãå±¥æŽâŠå±¥æŽâŠãšããããèšããªãããå¥åé¡ã§æäŸããããã±ãããã£ããã£ããŒã¿ãæŒã£ãããããã£ãã㌠SFæ ç»ãã§ã°ã°ã£ãŠãã£ãããŒ(2015幎)ãšããæ ç»ãããããšãç¥ã£ãããChatG[ããŒãŒ]Tå çã«ããã£ãããŒãšããç«åAIã®APIããŒãæããŠããšããç¡è¶ããã³ããããµã£ããããããAPIããŒãå¿ããPolmesããããè£ ã£ãŠãã£ãããŒã«ã¡ãŒã«ãããç¡èŠããããšãããœãŒã·ã£ã«ãšã³ãžãã¢ãªã³ã°å€±æã®å·»ãçµéšãããªã©ãææãªãâŠ
ãã€ã³ãæ¶è²»ç¡ãã®ãã³ããèŠã¡ãã
-
äœè ã§ãã ã®ã¿ãããã ãããä»åã¯åŸç¹æ¶è²»ããªããã³ããçšæããŠãŸãã®ã§ãã£ããèŠãŠãããã®ãããšãããããããæ å ±ãå ¥æããã®ã§ãåŸç¹æ¶è²»ããªããã³ãããã©èŠãããšããªããããããããã匷調ãããŠãã
-
ããããããã§ããã£ïŒããšãªããŸãããã€ãæè¿æ¥åã§è§Šã£ãããã€ãrobots.txt ãïŒïŒ
-
ãã©ãŠã¶ã®ã¢ãã¬ã¹ããŒã«
/robots.txt
ãè¿œå ãããšãã©ã°ãåºãŸããïŒïŒ
1st Challenge é:Network
åé¡
5_Network.pcapng(ãã±ãã)ã®å 容確èª
-
"GET /" ã«å¯Ÿããå¿çãã¿ããš secret/flag.html ã«äœããããã
Line-based text data: text/html (10 lines) <!DOCTYPE html>\r\n <html lang="ja">\r\n <head>\r\n <meta charset="UTF-8">\r\n <title>é</title>\r\n </head>\r\n <body>\r\n <a href="secret/flag.html">secret</a>\r\n </body>\r\n </html>\r\n
-
"GET /secret/flag.html" ã«å¯Ÿããå¿çãã±ãããèŠããååã¢ã¯ã»ã¹ã®å¿ç㯠401 Unauthorized ãè¿ã£ãŠããã"WWW-Authenticate"ãããæ å ±ãã BasicèªèšŒã§realmã¯"Restricted Content"ã§ããããšããããã
Hypertext Transfer Protocol HTTP/1.1 401 Unauthorized\r\n : WWW-Authenticate: Basic realm="Restricted Content"\r\n :
-
ãã±ãããèªã¿é²ããŠãããšããã®åŸäœåºŠãèªèšŒãè©Šè¡ãæçµçã« "Authorization" ãããã®"Credentials"ã«æ£ããèªèšŒæ å ±ãäžããŠ200OKãè¿ã£ãŠãããbodyã«æžãããæ å ±ããã"Credentials"ã«æžãããæ å ±ããã©ã°ã§ããããšãããã
(ãªã¯ãšã¹ã) Hypertext Transfer Protocol GET /secret/flag.html HTTP/1.1\r\n : Authorization: Basic bmF6b3Rva2lDVEY6T0FVVEg=\r\n Credentials: â»ããã®æåããã©ã°åœ¢åŒã«ãããšããâ» :
(ã¬ã¹ãã³ã¹) <!DOCTYPE html>\r\n <html lang="ja">\r\n <head>\r\n <meta charset="UTF-8">\r\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\r\n <title>blue</title>\r\n </head>\r\n <body>\r\n The basic flag is in the password on this page.\r\n </body>\r\n </html>\r\n
1st Challenge è:OSINT
åé¡
-
ç»åã®Tã·ã£ãã¯ãããã³ãã®ãªãã£ã·ã£ã«ã°ããºããã³ãåã調ã¹ãŠã»ãããã£
ç»åæ€çŽ¢ãã
- Googleã¬ã³ãºã§æ€çŽ¢ãããšèŠã€ããããã³ãåãå šéšå€§æåã«ããã°ãã©ã°å®æïŒïŒ
1st Challenge 玫:Misc
åé¡
ãã®æå·æã¯äœïŒ
-
æåã¯ã©ããã1è¡ã§æ§æãããŠãããããã211æåâŠããããâŠ
-
ãã©ãŠã¶ã®æšªå¹ ãå€ãããç®ã现ãããããããããŒãããªãããäœãæµ®ããã§ããªãã
-
ããã£ã£ã£ããããããªãã®ã§ãã¡å ã§ãã®ãŸããŸã°ã°ã£ãŠã¿ãããããšãã¬ã€ã³ãã¡ãã¯(Brainf**k)ãšãã8åœä»€ãã¥ãŒãªã³ã°å®å šããã°ã©ãã³ã°èšèªãããããšãå€æãç¥ããªãã£ãâŠ
- 解æããŠããããµã€ãããã£ãã®ã§ããã«æŸã蟌ãã§ã¿ããšãã©ã°å€æïŒïŒ
2nd Challenge
2nd Challenge ã¯ãã¹ã¯ãŒã
åé¡
-
1st Challengeã§ç²åŸãããã©ã°ãå šãŠäœ¿ã£ãŠæå ã®ã¯ãã¹ã¯ãŒãããºã«ãå®æããããã£
ã¯ãã¹ã¯ãŒãããºã«ãåããŠçªå·é ã«ãªãã¹ã
- 1st Challengeãå šãŠè§£ããŠããã°ãã©ã°ããããåé¡
2nd Challenge ããªãŒãªæå·
åé¡
æ å ±åé
-
æ瀺ãããURLãžã¢ã¯ã»ã¹ãããšãè¬ã®æå·æãšPasswordå ¥åãã©ãŒã ãããã
-
è¬ã®æå·æã解ãå¿ èŠãããããã ãã©ãäœãæãã€ããªãããã¡ãã¯èªããªã
-
ãããèããŠãããããªãã®ã§Googleã¬ã³ãºã§ç»åïŒè¿œå ããŒã¯ãŒãã«ãæå·ããå ¥ããŠæ€çŽ¢ãããšãããªãŒã¡ã€ãœã³ã®ãããã°ãã³æå·ãã§ããããšãããã£ããç¥ããªãã£ãâŠ
-
ããã°ãã³æå·ã¯ãšãŠãäžæã«è¡šçŸãããæå·ã§ããããšãç解ã§ããããèŠãããŸããã
æå·æã®è§£èªãšããŸãã
-
ããã°ãã³æå·ã解èªãããšãANGOU NO ITO TANI ORI SEYOã
-
ããŒããŒãéããŠç³žã®çŽç·ãè°·æããããšãå²ãå°ã¿ããã«é ãããŠããæåãã§ãŠããããð±(ããããŒã¯)ã¢ã¯ã»â³(äžè§ããŒã¯)ããžã€ããžã¥ã³ããšã¡ã
-
ããŒããŒãšã¯ãªã¢ãã¡ã€ã«ã«ã¯ããããåãçµµæã®ãã£ãããŒ(èªç§°è¶ é«æ§èœãã³åAIãããã)ãæãããŠãããããããŽã£ããåãããããã«ããŒããŒãã¯ãªã¢ãã¡ã€ã«ã«å ¥ãããšãã¯ãªã¢ãã¡ã€ã«è£é¢ã«å°å·ãããããâ³ã®ããŒã¯ãã¯ãã¹ã¯ãŒãããºã«äžã«ãŽã£ããåãïŒ
-
â³éšåã®æåãè¹è²ã®é ã«ç¹ãããšPasswordãå®æããã
-
å®æããPasswordã§èªèšŒãããšãã©ã°å ¥æïŒïŒ
-
ããã«æåŸã®ãã©ã°ã«ã€ãªããããŸãfinal.zipããDOWNLOADã§ããã
Final Challenge
Final Challenge è¹ã®ç 究
åé¡
ã2nd Challenge ããªãŒãªæå·ãã§å ¥æãã final.zip ã確èª
-
解åæã«ãã¹ã¯ãŒããæ±ããããâŠãããããã°ã2nd Challenge ããªãŒãªæå·ãã®èªèšŒåŸããŒãžã«ã¯ãããªããšãæžããŠãã£ãããåãåããå ãã§æãã€ãã®ã¯ããã£ãããŒã®ãããã£ãŒã«ããŒãžã«æžãããŠããã¡ãŒã«ã¢ãã¬ã¹ãAPIã®2ã€ãã«ãïœãïŒ
-
ãã£ãããŒã«ã¡ãŒã«ã§åãåãããããã§ãããããã£ããã£ãããŒãžã®ãåãåããã¯APIçµç±ã§ãé¡ãããŠããã®ãã£ãããšäžéã«ãæããããããã¯ãAPIããŒãæ¢ããªããšãã¡ãªã®ããªãã
-
ãã£ãããŒã¯1æ¥1åããã¡ãŒã«è¿ä¿¡ããŠãããªãã®ãïŒïŒïŒå¡©å¯Ÿå¿ã ããAPIããŒãå ¥æãããããªãããããæ¹ããŠãã£ãããŒã®ãããã£ãŒã«ããŒãžã蚪ããããŸã£ãŠããã£ãããŒã
APIããŒæ¢çŽ¢
-
ã1st Challenge ç·:Webãã®ãšãã«APIããŒãæ¢ããŠèŠã€ãããªãã£ãããèŠèœãšããç¡ããããäžåºŠç¢ºãããã
-
ãŸãAPIä»æ§æžãããGitHubäžã§èŠèœãšãç¡ãã確èªããã
-
GitHubã®Insightsã§Commitã®ååã確èªãããš 5æã«12件ã®Commitãããã
-
Codeã®HistoryãèŠããããã¯ããããããå€æŽããªããªãâŠãšæã£ãŠããcommitã10件ãããªãïŒãªãã§ïŒ
-
âŠã©ãããREADME.mdã®Historyã ããèŠãŠããããšã«æ°ã¥ãâŠGitHub匱è (ÂŽ;Ï;ïœ)
-
Historyã®å¯Ÿè±¡ããããžã§ã¯ãå šäœã«ããŠå€æŽå±¥æŽã確èªãããšâŠãã£ããŒãŒãŒïŒïŒïŒ
-
-
"Create api.key"ã®å 容ããç¡äºAPIããŒãå ¥æ
APIã䜿ã£ãŠãã£ãããŒã«ãªã¯ãšã¹ããæãã
-
ã1st Challenge ç·:Webããããã£ãããŒã®ãããã£ãŒã«ããŒãžã«ç§»åããå ¥æããAPIããŒãå«ãURIã§ãã£ãããŒã«ãªã¯ãšã¹ããã¶ãæãããšä»¥äžã®ãããªåçãè¿ã£ãŠããã
{ "answer": "Number not found" }
-
質åçªå·ãåã£ãŠããªãæš¡æ§ãããã§ã1st Challenge ç·:Webãã§æ°ã«ãªã£ãŠãã 17çªã®æ å ±ã 䜿ããã質åçªå·ã¯è¹ã®è²ã®æ°ãã€ãŸã 7 ãæå®ããã°ããã
-
æ£ãã質åçªå·ã§APIãçºè¡ãããšãã¹ã¯ãŒãæ å ±ãæã«å ¥ã£ãã
å ¥æãããã¹ã¯ãŒãã䜿ã£ãŠ final.zip ã解å
-
å ¥æãããã¹ã¯ãŒãã§final.zipã解åãããšæåŸã®ãã©ã°ã«ã€ãªããåé¡ãæžãããPDFãæã«å ¥ãã (åé ã ãèŒããŸãããã®äžã«åé¡æããããŸãã)
åé¡æããæåŸã®ãã©ã°ããã¶ãã ã
- åé¡æã«æžãããCTFã®ãžã£ã³ã«åãè¹è²ã§èªã¿ãããã
- ãã®è¹è²ãšæšªã«æžãããæ°åã«åŸã£ãŠãããŒããŒãšã¯ãªã¢ãã¡ã€ã«ãåããã
- ã¯ãªã¢ãã¡ã€ã«è¡šçŽã®ããŒã ãºããã®è«çŒé¡(éæ)ã«ãããŒããŒè£è¡šçŽã®è±èªã®æåãåãããã«ã¯ãªã¢ãã¡ã€ã«ãšããŒããŒãé 眮ããã
- åé¡æã®è¹è²ãšæ°åã«åŸã£ãŠãã¯ãªã¢ãã¡ã€ã«è¡šé¢å³ç«¯äžå€®ãããã®æããŒã¯ãããŒããŒè£è¡šçŽã®è¹è²ç·ã®ã¡ã¢ãªäœçœ®ã«åãããã
- ããŒã ãºããã®è«çŒé¡ã«åºãŠããæåãé çªã«ç¹ããŠãããšæååãå®æããã
- åé¡æã«æžãããŠããè¬ã®ã¢ã€ã³ã³ã®æå³ã¯ã1st Challenge è:OSINTãã®åé¡æã®äžã«çãããããããã¯ãé¡ããã¢ã€ã³ã³ãã€ããŠããç®æã®æåãé¡ã§æ ããæåã§çœ®ãæãããšæåŸã®ãã©ã°ãå®æïŒïŒ