AUCTF-2020
Fri, 03 April 2020, 21:00 CST — Mon, 06 April 2020, 12:00 CST
An AUCTF event.
Format: Jeopardy
Official URL: https://ctf.auburn.edu/
This event’s weight is subject of public voting!
Rating weight: 0
Event organizers
This writeup has been collected to my pwn notebook. Link
Easy as Pie!
Description
My friend just spent hours making this custom shell! He’s still working on it so it doesn’t have much. But we can do some stuff! He even built a custom access control list for controlling if you can access files.
Check it out!
nc challenges.auctf.com 30010
Author: kensocolo
Analysis
access to the python shell and type help
:
1 | nc challenges.auctf.com 30010 |
try ls
command:
1 | ls |
here are 3 files, try to cat
them:
1 | cat flag.txt |
we can find two hidden files after
cat acl.txt
the owner of both flag.txt
and .acl.txt
are root
and the privileges are 600
, so only user root
can read them.
type help write
, we can find that the write
command can add lines to the beginning of files
1 | help write |
Solution
maybe
acl.txt
means access control?
so, try to add access control rules to acl.txt
1 | write flag.txt:user:666 acl.txt |
cat
works after rules added :D
1 | cat flag.txt |
Thanksgiving Dinner
Description
I just ate a huge dinner. I can barley eat anymore… so please don’t give me too much!
nc challenges.auctf.com 30011
Note: ASLR is disabled for this challenge
Author: nadrojisk
Attachment
Analysis
buffer overflow
1 | void vulnerable(void){ |
here is a buffer overflow obviously:
1 | fgets(local_30,0x24,stdin) |
local_30
is only 16 bytes
so, our input will overwrite to local_20
… local_10
after 16 bytes of any char.
Solution
1 | offset = 16 |
More
you can download full exp from my github
House of Madness
Description
Welcome to the House of Madness. Can you pwn your way to the keys to get the relic?
nc challenges.auctf.com 30012
Note: ASLR is disabled for this challenge
Author: kensocolo
Edit: this challenge’s binary was originally a little weird. try this again!
Attachment
Analysis
we can unlockHiddenRoom4
by entering room4 and inputing key Stephen
1 | void room4(void){ |
buffer overflow
we got a buffer overflow gets(local_1c)
after hidden room 4 is unlocked.
disabled ASLR
In the Description we know that:
Note: ASLR is disabled for this challenge
ASLR is disabled means the base address of text
and libc
is a constant:
1 | text = 0x56555000 |
so we can get shell directly by overwrite the return address to one gadget.
Solution
leak libc
before the attack, we should know the version of remote libc
. leak it:
1 | offset = cyclic_find('haaa')-8 |
output: puts: 0xf7e78b80
find libc version by libc_database
:
1 | ./find puts b80 |
one gadget
search one gadget by one_gadget
:
1 | one_gadget libc6_2.23-0ubuntu3_i386.so |
get shell
the constraints is [esp+0x28] == NULL
, so we should fill stack with \x00
:
1 | # gadget |
More
you can download full exp from my github
Remote School
Description
Dear Student,
Due to COVID-19 concerns our curriculum will be moving completely to online courses… I know we haven’t even started our school year yet so this may come as a shock. But I promise it won’t be too bad! You can login at challenges.auctf.com 30013.
Best, Dean of Eon Pillars
Note: ASLR is disabled for this challenge
Author: nadrojisk
Attachment
Analysis
hidden function
class_hacker
is not in the list, but we can input attend Hacker
to take this class :)
1 | void class_hacker(void){ |
1 | void test(char *param_1){ |
buffer overflow
bof in function test
:
1 | strncpy(local_814,param_1,2056); |
local_814
is only 2048 bytes
so, our input will overwrite to local_14
and local_10
after 2048 bytes of any char.
overwrite memory
also in function test
:
1 | *local_10 = local_14; |
4 bytes of arbitrary memory can be overwrote, and both local_14
and local_10
can be assigned by buffer overflow.
disabled ASLR
ASLR is still disabled.
In addition, the version libc is same as House of Madness, so we can know the address of any function in libc directly.
Solution
GOT overwrite attack
we can overwrite the GOT of strtok
to system
1 | libcbase = 0xf7e19000 |
WHY strtok?
after class_hacker
, we will back to the menu to input next cmd string
strtok
called in cmd_dispatch
shared the first args which we input in cmd string
so we can trigger strtok("/bin/sh")
by input "/bin/sh"
as cmd string
1 | # strtok(cmd) -> system(cmd) |
in fact, system("/bin/sh")
was executed.
More
you can download full exp from my github