Cyber Breaker Competition Quals

Challenge
Category
Points
Solves

Early

Binary Exploitation, Heap, UAF, FSOP

371 pts

7

lz1

Binary Exploitation, Linux Userland, Compression, Stack Based.

1000 pts

1

pagevault

Binary Exploitation, Linux Kernel, Page UAF, DirtyPage.

1000 pts

0

Early

Description

Author: Linz

Description: This is just an early challenge from me :) HOPE YOU GET INTO MAINSTAGE!!!

Solution

Given only a binary, a stripped x64 ELF with minimal protections:

$ file early
early: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=243f080d527b653bf04877a2d531d8600356d392, for GNU/Linux 3.2.0, stripped
$ pwn checksec early
    Arch:       amd64-64-little
    RELRO:      Full RELRO
    Stack:      Canary found
    NX:         NX enabled
    PIE:        PIE enabled
    SHSTK:      Enabled
    IBT:        Enabled
$ ./early

== menu ==
1) add_note
2) edit_note
3) print_note
4) resize_note
5) delete_note
0) exit
>

The following are the decompilations with the function renamed by us, first the main which is a simple switch controller, taking input and routing to the function handlers depending on our input:

This is a generic CRUD style heap pwn where the player are able to perform operations on the heap. In add, we’re able to allocate a chunk with controllable size:

Below the delete function to free allocation, here lies an UAF however due to the nature of the program, we’re unable to perform modification or take advantage of it since there’s flag denoting that the pointer should not be used, still the pointer is left dangling:

Here’s the edit and view function, there’s nothing interesting other than that they check for the used flag to determine if the chunk is freed:

There’s an additional option to resize a chunk, here lies the vulnerability:

If the user specified a size bigger than 0x400, it will error and free the chunk, however it did not update the flag to be not used and didn’t remove the pointer thus resulting an exploitable UAF.

to exploit this we perform the following:

  1. allocate a chunk big enough to be allocated to the unsorted bin for a libc address leak

  2. perform a tcache poisoning to arbitrary allocate to IO_2_1_stdin achieving arbitrary write

  3. corrupt _IO_2_1_stdin_ to gain huge arbitrary write through stdin to corrupt _IO_2_1_stdout_ to gain RCE using FSOP

  4. profit

More details can be inspected by analysing the exploit code below:

circle-check

lz1

See

the same challenge as starlabs summer pwnables, see:

Starlabs Summer Pwnableschevron-right

pagevault

Description

Analysis

I will eventually write this

Exploitation

I will eventually write this