
SANS Holiday Challenge 2017 Write-up Part 3
Incognito Lab
ส่วนนี้จะยาวและยากกว่าที่ผ่านมาทั้งหมด เริ่มจากคำถามที่ 2
Investigate the Letters to Santa application at https://l2s.northpolechristmastown.com. What is the topic of The Great Book page available in the web root of the server? What is Alabaster Snowball’s password?
ทำการเข้า https://l2s.northpolechristmastown.com แล้วเปิดดู source code ของ page นั้นจะพบว่ามี link ไป development server ตามด้านล่าง
ลอง solve DNS ของทั้ง 2 servers ดูพบว่าชี้ไปที่ IP Address เดียวกัน
ซึ่ง Virtual host ตัว dev.northpolechristmastown.com นั้นใช้ Apache Struts
ปี 2017 มีช่องโหว่ Struts 2 อันที่น่าสนใจคือ CVE-2017-5638 และ CVE-2017-9805 ขั้นตอนถัดไปจะใช้ช่องโหว่ remote code execution เพื่อสร้าง webshell บน Server โดย
- ใช้ Exploit code จาก https://github.com/chrisjd20/cve-2017-9805.py
- ทำความเข้าใจเรื่องการ encode, decode string ต่างๆ ก่อนเพื่อไม่ให้ถูก interpret ผิดพลาด โดยศึกษาได้จาก https://pen-testing.sans.org/blog/2017/12/05/why-you-need-the-skills-to-tinker-with-publicly-released-exploit-code
- เลือกใช้ webshell ง่ายๆ https://gist.github.com/joswr1ght/22f40787de19d80d110b37fb79ac3985
- เราจะทำการ encode webshell ด้วย base64 ก่อนจากนั้นจะนำไป decode บน server และเขียน ลง File โดยใช้คำสั่ง echo, decode, tee
หน้าตาของ HTTP request ที่ถูกส่งออกไปเพื่อสร้าง webshell บนระบบ
ทำการเข้า webshell ที่เราเพิ่งสร้างที่ https://l2s.northpolechristmastown.com/1111111111.php
ลอง ls เพื่อ list file บนเครื่อง
ใช้คำสั่ง grep –r "pass" /opt/apache-tomcat/ เพื่อหาคำว่า pass ใน folder ดังกล่าว ทำให้พบ password คือ stream_unhappy_buy_loss
ตอบคำตอบข้อ 2 คือ On the topic of flying animals และ stream_unhappy_buy_loss
ถัดไปคำถามที่ 3
The North Pole engineering team uses a Windows SMB server for sharing documentation and correspondence. Using your access to the Letters to Santa server, identify and enumerate the SMB file-sharing server. What is the file server share name?
ใช้ SSH ไปที่ l2s.northpolechristmastown.com โดยใช้ credential ของ Alabaster คือ alabaster_snowball:stream_unhappy_buy_loss จากนั้นทำการ scan port โดยใช้ -Pn (หมายถึงว่าไม่ต้อง ping ก่อน scan เพราะปกติถ้า ping ไม่เจอแล้วจะไม่ scan หากเครื่องปิด Ping แล้วไม่ใส่ option นี้ก็จะ scan ไม่เจอ)
เจอ 2 servers ที่เปิด port 445 คือ 10.142.0.7 และ 10.142.0.8 ซึ่ง server ที่อยู่ใน scope ของข้อนี้คือ 10.142.0.7
เนื่องจาก Server นี้เป็นเครื่องที่อยู่ใน internal network และไม่สามารถ access ได้จาก Internet ทำให้ต้องใช้วิธีการทำ SSH Tunneling ผ่านเครื่อง l2s.northpolechristmastown.com (35.185.84.51) โดยใช้ command คือ
#ssh -L :
หลังจากทำ tunneling แล้วสามารถใช้ smbclient ในการ connect เข้า localhost ของเราผ่าน port 445 ได้
พบว่ามี share name ชื่อว่า FileStor ซึ่งเป็นคำตอบของข้อนี้
คำถามที่ 4 Elf Web Access (EWA) is the preferred mailer for North Pole elves, available internally at http://mail.northpolechristmastown.com. What can you learn from The Great Book page found in an e-mail on that server?
เริ่มจากทำ SSH tunneling ไปที่ http://mail.northpolechristmastown.com พบว่าเป็นหน้า email login ซึ่งไม่สามารถใช้ password ของ Alabaster ที่ใช้ก่อนหน้านี้ได้แล้ว
เข้าหน้า robots.txt พบ path ที่น่าสใจคือ /cookie.txt
ดูเหมือนว่าข้อมูลใน file นี้จะเป็นการตรวจสอบ cookie ของระบบ hint ในเกมมีการพูดถึงเรื่องของการสร้าง ciphertext ใน cookie ให้มีความยาว 16 bytes ทดลองสร้างและนับ โดยใช้ wc
หลังจากนั้นนำค่า ci[phertext นี้ไป set ใน cookie โดยเราสามารถใช้ name เป็นค่า email ของใครก็ได้
จะพบว่าสามารถ bypass เข้าสู่หน้า email ของ user นั้น ๆ ได้ทันที
พบว่ามีรายละเอียดของ The great book page หน้าที่ 4 ตามเมลด้านล่าง
คำตอบของข้อนี้คือ The rise of the lollipop guild
คำถามข้อที่ 5 How many infractions are required to be marked as naughty on Santa’s Naughty and Nice List? What are the names of at least six insider threat moles? Who is throwing the snowballs from the top of the North Pole Mountain and what is your proof?
ข้อนี้ไม่ค่อยแน่ใจในคำตอบเท่าไรนัก แต่ส่วนใหญ่ไม่เกี่ยวข้องกับด้านเทคนิค เป็นการวิเคราะห์ข้อมูลรวมถึงเรื่องสถิติซะมากกว่า ไว้รอ Official Answer จาก SANS ดีกว่าครับ 555
เดี๋ยวไว้มาต่อข้อที่เหลือใน post หน้านะครับ ?
Up Next

ARTICLES
Mar
01
2021
007 Skyfall : the untold story
สวัสดีปีใหม่ สำหรับในปี 2012 ที่ผ่านมาทางทีมงาน Incognito Lab ของเรา ขอขอบคุณทุก ๆ ท่านที่คอยติดตามเรา และ ส่งเมล์เข้ามาให้กำลังใจทีมงานอย่างมากครับ
READ MORE

ARTICLES
Mar
01
2021
Bangkok Governor Election
สิ่งที่อยากจะแชร์ในวันนี้คือ Security ในเขตเลือกตั้งครับ
READ MORE

ARTICLES
Mar
01
2021
Banking Trojan Hunting — g01pack's fundamental analysis
1-2 วันที่ผ่านมาผมคิดว่าหลาย ๆ คนที่เข้าไปดูข่าวออนไลน์บ่อย ๆ อาจจะตกใจเนื่องจาก Google และ Google Chrome มีการแจ้งเตือนภัยคุกคามว่า website ดังกล่าวอาจเป็นอันตรายต่อคอมพิวเตอร์ของผู้ใช้งาน
READ MORE