SunshineCTF 2024 writeup-by.naup96321
Author: 堇姬Naup
WAN - r.k.10
This is myself some solve script and easy writeup. Just record some questions
My solve list
My team score board
Scripting
This catagory challenge give you one git bundle
Use
1 | git clone <git bundle> <folder path> |
can get git.
Guessy Programmer 0
Just one file which have many many sun...
,just use regex find sun\{.*?\}
and then we will get flag.
script
1 | import re |
Guessy Programmer 1
It has many many git commit history and all commit have file(adventure_novel_2.txt) which have many sun...
words.
First, I write git log to log.txt.
And then fetch all commit history and git show
.
Final, using regex filter sun\{.*?\}
script
1 | import subprocess |
Guessy Programmer 2
Add some base64 confuse my regex.
I add [A-Za-z0-9+/=]{20,}
. If it may base64 word, it will be decoded.
Last part same as Guessy Programmer 1.
script
1 | import subprocess |
Guessy Programmer 3
It is .gif.
but if i cat .git, it has flag(base64 or not)
Use .sh
fetch all commit git’s word.
Last part same as Guessy Programmer 1.
script
1 | !/bin/bash |
1 | import subprocess |
Pwn
This is my CTF templates, you can give my repo one star!!! if you like.
https://github.com/Naupjjin/MyCTFLib.git
Flag Shop
buffer overflow and use fmt read flag pointer(on stack) to screen.
buffer overflow can write isadmin, and then bypass admin panel’s if
.
%9$s -> rsp + 0x18(flag pointer) -> flag
script
1 | from pwn import * |
Adventure! On the High C!
glibc 2.39
We can look this, we can input row and column and then enter this place.
1 | printf( |
It have filter your input, but still print and write wrong index. It is oob read and oob write
1 | _BOOL8 __fastcall filter_row_column(unsigned int a1, unsigned int a2) |
oob read and oob write can leak PIE, write /bin/sh\x00
, and write ROP to ret address
pop rdi + /bin/sh address + ret + system plt (offset you can use 16 * row + column to caculate)
1 | __int64 savedregs; // [rsp+220h] [rbp+0h] BYREF |
script
remote can work, but local don’t work. so strange
1 | from pwn import * |
heap01
glibc 2.35
It has oob on heap(two times).
1 | puts("Index: "); |
We can write tcache_pthread_struct.
write tcache entry to stack(the binary give me stack) and tcache count(Must same as tcache entry size).
1 | tcache entry[1] -> stack address on ret address |
when malloc chunk, we will get fake chunk on stack.
write ret address to win function
1 | v5 = malloc(size); // malloc stack |
script
1 | rom pwn import * |
after
Last year, Aukro, WH, and I played our first CTF together, starting with SunshineCTF 2023. We stayed up late solving challenges, and the most memorable one was extracting a git bundle, which we worked on until the middle of the night. After all the discussions, we finally finished in 76th place.
A year later, we came back to SunshineCTF. After clearing the scripting challenges, I play with Aukro on pwn (as a weber, I spent the whole time watching pwn, haha). We managed to solve 3 out of 6 pwn challenges and finished all pwn challenge with Aukro.
WAN ended up taking 10th place, marking my first top 10 finish on CTFtime. This also brought back the pure joy I once felt playing CTFs.
I really love that feeling in CTFs where everyone works together, stays up late solving challenges, and cheers when we finally solve them. It feels like staying up late playing video games, lol.
In the future, I’ll keep walking down the path of cybersecurity and CTFs. Thanks to WAN, CakeisTheFake, and all the partners I’ve studied cybersecurity with, as well as the seniors who taught me so much.