Skip to content

Capture The Flag Game Platform empathize on Web Vulnerability based on OWASP

Notifications You must be signed in to change notification settings

sahussawud/CTF_Web_Vulnerability

Repository files navigation

CTF_Web_Vulnerability

Question on CTF !!!

ชื่อโจทย์ : API Hacking <พร้อมทดสอบ>

ความยาก(10) : 3
Description : use bearer token
Hint : เอาเเฟลกมาจาก admin.ให้ได้
Format answer : CTF{}
URL : http://borrabeer.ddns.net:4000

สิ่งที่ต้องทำ :

  • Page Web api docs /index
  • Path /auth เพือ authen ใส่ชื่อเพื่อ
  • Path /user
  • Path /admin

ควานรู้ที่ต้องใช้

  • JWT token
Key เฉลย:
  1. discover a document page that inform 3 api api/admin, api/user, api/auth
  2. gain authentication JWT token from api/auth pass query parameter username to gain bearer token
  3. try to use bearer token, it works to access user endpoint, but not with admin endpoint.
  4. Try decode JWT token with www.jwt.io, then you will see payload data, name as username and role as User.
  5. Try to change role in JWT.io, I will occur 401 Unauthorize, because a JWT Token is invalid signature key to make change to a token.
  6. You try to temple token by jwtcat(recommmend) or jwtcrack, I use jwtcat to find a secret it would occur pungpondzard
  7. You could use secret to temper token, and putting it into autorization header as bearer token, and now you could get a FLAgz OLA.

answer : Q_api{JwT_ExploiTi0n_Is_C0ol}

ชื่อโจทย์ : Token Is Have Something Wrong? <พร้อมทดสอบ>

ความยาก(10) : 6
Description : there is someting wrong with token, look it carefully.
Hint : flag is in front of your screen !!!
answer format : Q_token{}
URL : http://borrabeer.ddns.net/Q_CSRF_ATTACK

สิ่งที่ต้องทำ :

  • เว็บไซต์ที่มีการส่ง ajax request เเล้วถูกอีก domain หนึ่งนั้นไป execute request เรา่โดยที่เราไม่รู้ตัว วิธีการนี้เรียกว่า CSRF Attack

ควานรู้ที่ต้องใช้:

  • ajax
  • csrf token
Key:
  1. เว็บไซต์เเสดงหน้าตาฟอร์ม Reset password เเต่ไม่เกี่ยวกับการเเก้โจทย์ข้อนี้
  2. key is on ajax request to index.php that occur message in response that "try to send post request by another host, this is concept behind CSRF" ดูที่ network tab ที่ browser ปรากฎคำใบ้ให้ลองส่งฟอร์มเเละ token ให้ไปลอง request ไปที่ index.php โดยใช้ client อื่นที่ไม่ใช่ ตัวเว็บไซต์
  3. จากนั้น "Failed Comparison ( incoming CSRF token != Session CSRF token )" ปรากฎ เเละมีการใบ้ต่อว่า มีช่องโหว่ที่ weak comparison
  4. break to if checking bypass "_token": true instread, now flag is appearing.

answer Q_token{ThlsC5RFi5Sup3REzy}

ชื่อโจทย์ : AMAZING SEARCH ENGINE <ยังไม่เสร็จ>

ความยาก(10) : 4 Description :
Hint : persistency is key สิ่งที่ต้องทำ : ขโมย key จากอีกฝั่ง 1 ผ่านโปรเเกรมเเชท จากช่องโหว่ XSS ควานรู้ที่ต้องใช้ Javascripts

answer : C_Flag{TsC4_Eal0ptRaf8z6R}

ชื่อโจทย์ : Cookies Attack <พร้อมทดลอบ>

ความยาก(10) : 2 Description : Cookies Attack Hint : เข้าถึงข้อมูลของ Role Admin และเอาเเฟลกข้อมูล ออกมาให้ได้ Answer format : C_Flag{} URL : http://borrabeer.ddns.net/Q_Cookie_Attack

สิ่งที่ต้องทำ :

  • ทำการหา Username และ Password ที่สามารถเขาสู่ระบบและทำการเปลี่ยน role เพื่อ เข้าถึง ข้อมูลflag

ควานรู้ที่ต้องใช้:

  • Cookie
Key เฉลย:

https://drive.google.com/file/d/1QXTSvstw5em_yDes1VLnCgkE2-lTeL4N/view?usp=sharing

  1. หา username และ Password ที่ถูกซ่อนไว้
  2. view page source ดูเพื่อนำรหัสที่ถูกซ่อนไว้ใน script และนำรหัส ASCII ที่อยู่ในรูปแบบตัวเลขฐาน 8 นำมาแปลงตัวอักษร
  3. เมื่อได้ username และ password แล้วทำการ login
  4. รหัสที่ได้มา ไม่มีสิทธิ์ในการเข้าถึง ข้อมูลลับหรือแฟลกข้อมูลได้ ให้เรา Inspect (Ctrl+Shift+i)หน้าเว็บไซต์
  5. Application>Cookies จากนั้นสังเกต column ที่มีชื่อว่า Value ซึ่งค่า Role ของ user นี้มีค่า เป็น support จึงไม่มีสิทธิ์ในการเข้าถึง Flag
  6. ทำการ edit"Value" เป็น admin หลังจากนั้นก็ Refresh หน้าเว็บไซต์
  7. นำ Fleg หรือรหัสลับ ที่แสดงไปตอบ

answer : C_Flag{TsC4_Eal0ptRaf8z6R}

ชื่อโจทย์ : Admin's notes <พร้อมทดสอบ>

ความยาก(10) : 3
Description : ใช้ SQL injecttion กับ sqlite database
Hint : เข้าถึงรายการ note ของ Admin ให้ได้ แล้วเอา Flag มา Format answer : Flag{}
URL : http://borrabeer.ddns.net/Q_SQL_injection_sqlite

ควานรู้ที่ต้องใช้

  • SQL injection
Key เฉลย:

https://drive.google.com/file/d/1egm81qcDKFZ8PvR99v1yS0CXtvOMJLxI/view?usp=sharing

  1. จาก Description ได้บอกว่าใช้ database sqlite
  2. ลองใส่ a' เพื่อให้ลองว่า field นี้สามารถทำการ SQL injection ได้หรือไม่
  3. add note a' || (select sqlite_version()));-- จะได้ version ของ sql และรู้ว่าเป็น sqlite
  4. จากการรู้ว่าเป็น sqlite สามารถไปดูตารางพื้นฐานของ database ได้ที่ document ของ sqlite https://sqlite.org/fileformat.html
  5. Injected ‘ || (SELECT name FROM sqlite_master WHERE type ='table' AND name NOT LIKE 'sqlite_%'));-- จะได้ ชื่อ table
  6. Injected ' || (SELECT sql FROM sqlite_master WHERE name='USER'));-- จะได้ column ของตารางนั้นๆ
  7. select เอา username และ password ของ admin แล้วนำไป login
  8. เอา flag ใน note ไปตอบ

answer : Flag{B0SSMANHateSQL}

About

Capture The Flag Game Platform empathize on Web Vulnerability based on OWASP

Resources

Stars

Watchers

Forks