content-image
ARTICLES | 02 March 2021

SANS Holiday Challenge 2017 Write-up Part 4 (Final part)

author-image

Incognito Lab

คำถามข้อที่ 6

The North Pole engineering team has introduced an Elf as a Service (EaaS) platform to optimize resource allocation for mission-critical Christmas engineering projects at http://eaas.northpolechristmastown.com. Visit the system and retrieve instructions for accessing The Great Book page from C:\greatbook.txt. Then retrieve The Great Book PDF file by following those directions. What is the title of The Great Book page?

ข้อนี้ต้องใช้เทคนิค XXE ซึ่งมาแรงมากเลย อยู่อันดับ 4 ใน OWASP Top 10 2017 A4:2017-XML External Entities (XXE)

แนะนำให้อ่านเพิ่มใน link ของ SANS ที่ https://pen-testing.sans.org/blog/2017/12/08/entity-inception-exploiting-iis-net-with-xxe-vulnerabilities

การทำข้อนี้เริ่มจากทำ SSH tunneling เหมือนเดิมไปที่ http://eaas.northpolechristmastown.com จะพบว่ามีหน้าตาเป็น Web application ที่มี function ให้ upload XML file ขึ้นไปได้

ทำการสร้าง file upload.xml ซึ่ง file นี้จะ upload ไปที่ server และหน้านี้ของ file นี้คือให้ไปเรียก file xxx.dtd ที่เครื่อง 10.142.0.11 (l2s)

ที่เครื่อง 10.142.0.11 (l2s) ซึ่งเราสามารถ SSH เข้าไปได้อยู่แล้ว ทำการสร้าง file ที่มี content ตามรูปด้านล่าง ซึ่งหน้าที่ของ file นี้คือให้อ่าน content ของ C:/greatbook.txt และเอามา append เป็นส่วนหนึ่งของ HTTP request ที่จะส่งมาที่เครื่อง l2s ถ้าทำสำเร็จเราจะสามารถเห็น content ของ file นั้นใน web server access log

ทำการเปิด web server service ที่เครื่อง 10.142.0.11 โดยในที่นี้จะใช้ python -m SimpleHTTPServer หลังจากนั้นทำการ upload upload.xml ไปที่ EaaS application

พบว่ามี access log เพิ่มขึ้นมา ซึ่งเป็น content ของ file C:/greatbook.txt ที่เราระบุไว้ใน xxx.dtd เมื่อทราบ path แล้วเราสามารถ access เพื่ออ่าน The Greatbook page 6 ได้

โดยคำตอบของข้อนี้คือ The dreaded inter-dimensional tornadoes

คำถามข้อที่ 7 Like any other complex SCADA systems, the North Pole uses Elf-Machine Interfaces (EMI) to monitor and control critical infrastructure assets. These systems serve many uses, including email access and web browsing. Gain access to the EMI server through the use of a phishing attack with your access to the EWA server. Retrieve The Great Book page from C:\GreatBookPage7.pdf. What does The Great Book page describe?

ข้อนี้ต้องทำความรู้จัก DDE (Dynamic Data Exchange) ซึ่งเป็นเทคนิคที่เป็นข่าวดังในปี 2017 ซึ่งปกติ Hacker มักใช้ file ตระกูล MS Office เช่น Word, Excel ในการปล่อย malware ต่าง ๆ ผ่าน Phishing Campaign โดยปกติก็จะมีการใช้ macro function เพื่อเขียนอะไรไม่ดีๆ แต่ด้วย function DDE ทำให้ไม่ต้องใช้ macro ก็สามารถที่จะ run คำสั่งบนเครื่องได้ทันทีหลังจากเปิด file

โดยในข้อนี้เราต้องสร้าง file DOCX เพื่อโจมตี โดย file นี้จะถูกส่งผ่าน email ซึ่งจะต้องระบุให้ถูกต้องด้วยว่าต้องตั้ง subject email ว่าอย่างไร

รูปถัดไปเป็น content ของ file DOCX ที่ถูกฝังคำสั่งให้เรียก netcat command มาที่เครื่อง server ของผมที่ตั้งไว้บน Internet โดยเครื่องตั้งอยู่ที่ IP Address 188.166.238.140

บนเครื่อง 188.166.238.140 ทำการตั้ง netcat listener ไว้

ถ้าทำถูกต้อง รอซักพักจะมี connection วิ่งเข้ามา (เนื่องจากใน CTF นี้เค้าตั้ง schedule ในการมากวาด email ไว้เลยทำให้ต้องรอ)

เมื่อได้ shell ของ windows แล้วผมเลือกใช้ powershellempire (https://www.powershellempire.com)

เนื่องจากมี Function ต่าง ๆ มากมาย รวมถึง Function ที่ใช้ในการ download file จาก remote server ด้วย โดยที่เครื่อง server ของเราต้องมีการตั้ง listener ของ powershellempire ไว้แล้วนำ agent ไป run ที่เครื่องเป้าหมาย จากนั้นเราจะสามารถ control เครื่องเป้าหมายได้

รูปด้านล่างคือตอนที่ได้ shell จากเครื่องเป้าหมายและนำ agent ของ powershellempire ไป run โดยการ run นี้จะผ่านทางคำสั่งของ powershell ซึ่งคำสั่งยาว ๆ นี้จะถูกสร้างให้อัตโนมัติตอนที่เราใช้งาน powershellempire

รูปด้านล่างคือมี agent มา connect ที่เครื่องเราแล้ว

ขั้นตอนถัดไปเราสามารถที่จะ control เครื่องเป้าหมายได้ โดยในที่นี้เราจะทำการ download The Greatbook page

คำตอบของข้อนี้คือ Witches of Oz

คำถามข้อที่ 8

Fetch the letter to Santa from the North Pole Elf Database at http://edb.northpolechristmastown.com. Who wrote the letter?

เครื่อง edb.northpolechristmastown.com มีการเปิด LDAP port ไว้และมีการ configuration ที่ไม่ดีทำให้สามารถอ่านข้อมูลได้โดยไม่ต้อง authenticate ในข้อนี้ใช้ LDAP client เพื่อ connect ไปที่ Server ซึ่งตามรูปด้านล่างจะใช้ JXplorer

หลังจาก connect เข้าไปได้แล้วจะพบว่าแต่ละ user จะมีค่า userPassword ซึ่งเป็น MD5 hash เราสามารถนำค่านี้มาหาค่า plaintext ได้โดยใช้ rainbow table ใน case นี้ใช้ service จาก https://hashkiller.co.uk

พบว่ามี 1 hash ที่สามารถแกะได้ โดย plaintext คือ 1iwantacookie ซึ่ง password นี้เป็นของ Mr.Santa Claus

ใช้ credential นี้ Login เข้า http://edb.northpolechristmastown.com ผ่านทางหน้า web

ทำการเข้าเมนูเพื่ออ่านจดหมาย โดยก่อนที่จะอ่านได้จะมีให้ใส่ password ของ Mr.Santa Claus อีกครั้งหนึ่ง

ซี่งจากข้อมูลในจดหมายนี้พบว่า คำตอบของข้อนี้คือ The wizard of Oz

คำถามข้อที่ 9 Which character is ultimately the villain causing the giant snowball problem. What is the villain’s motive?

คำตอบคือ Glinda the Good Witch of Oz. The motive is to get the profit from the war between Oz and the North Pole. โดยคำตอบได้มาจากการ Solve ปัญหาต่าง ๆ ในเกม สุดท้ายจะมี conversation พิเศษแสดงออกมาที่ dashboard ในเกม

จบแล้วครับสำหรับ SANS Holiday Hack Challenge ประจำปี 2017 ซึ่งเป็น Challenge ที่น่าประทับใจเช่นเคย

logologo

INCOGNITO LAB CO., LTD.

38 Soi Petchakasem 30, Petchakasem Road, Pak Khlong Phasi Charoen, Phasi Charoen, Bangkok 10160

©2025 Incognito Lab Co., Ltd. All rights reserved

Terms & Conditions Privacy Policy