01204223/natas
- หน้านี้เป็นส่วนหนึ่งของ 01204223
Natas https://overthewire.org/wargames/natas/ เป็นเกมสงครามสำหรับฝึกเกี่ยวกับความปลอดภัยบนเว็บ (ฝึก hack เว็บ)
รายละเอียดที่บอกในเว็บ
- Each level of natas consists of its own website located at http://natasX.natas.labs.overthewire.org, where X is the level number. There is no SSH login. To access a level, enter the username for that level (e.g. natas0 for level 0) and its password.
- Each level has access to the password of the next level. Your job is to somehow obtain that next password and level up. All passwords are also stored in /etc/natas_webpass/. E.g. the password for natas5 is stored in the file /etc/natas_webpass/natas5 and only readable by natas4 and natas5.
เราต้องหารหัสผ่านของ user natasX จากหน้า natas(X-1) จากในเพจบ้างหรืออื่น ๆ
ให้เริ่มที่ http://natas0.natas.labs.overthewire.org จะเข้าหน้าดังกล่าวต้องใช้ user natas0 รหัสผ่าน natas0
เครื่องมือที่ใช้ในการทำ
นอกจากการกดดู source code ของ page แล้ว การ inspect รายละเอียด รวมถึงการดู request ที่ส่งไปยัง server ก็เป็นเครื่องมือสำคัญที่เราจะได้เรียนรู้ ตัวอย่างหน้าจอการ inspect ส่วน network แสดงด้านล่าง เราจะได้เห็น request และ response ของการเรียกใช้งานเว็บ
ในการเรียก request นั้น นอกจากจะกดทาง browser แล้ว เรายังสามารถใช้เครื่องมือพวก browser extension ที่เราใช้ตอนพัฒนา backend api ก็ได้
แต่เครื่องมือที่นิยมใช้กันมากจะเป็นเครื่องมือ แบบ command line ชื่อ curl ซึ่งนิยมใช้ทั้งในสายนักพัฒนาซอฟต์แวร์และด้านอื่น ๆ จึงควรลองนำมาติดตั้งและหัดใช้อย่างยิ่ง
ตัวอย่างการเรียกไปหน้า http://natas0.natas.labs.overthewire.org/ แบบไม่ใส่รหัสผ่าน
curl http://natas0.natas.labs.overthewire.org/
ได้ผลลัพธ์เป็น
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>401 Unauthorized</title> </head><body> <h1>Unauthorized</h1> <p>This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p> <hr> <address>Apache/2.4.58 (Ubuntu) Server at natas0.natas.labs.overthewire.org Port 80</address> </body></html>
ถ้าใส่ basic authentication จะเรียกเป็น
curl http://natas0.natas.labs.overthewire.org/ -u natas0:natas0
จะเห็นข้อความจากเพจ
Curl ยังมี option อีกมากมาย สามารถตั้งค่าการ request ได้ครบถ้วน และเป็นเครื่องมือที่สามารถใช้ในการแก้ด่านต่าง ๆ ของ natas ได้อย่างดี
