Skip to content

AdityaBhatt3010/OWASP-Top-10-API-THM-Part-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ OWASP API Security Top 10 (Part 1) β€” TryHackMe Walkthrough

Lab: https://tryhackme.com/room/owaspapisecuritytop105w


πŸ“Œ Task 1 β€” Introduction

🧠 What’s Happening

You’re basically spinning up a Windows VM + Talend API Tester + vulnerable Laravel app.

➑️ This environment is pre-configured for testing API vulnerabilities.

βœ… Outcome

  • Connected to VM successfully
  • Tools auto-launched
  • Ready for API testing

πŸ“Œ Task 2 β€” Understanding APIs

🧠 Key Idea

API = bridge between applications.

  • Client sends request
  • Server responds
  • Defined via API documentation

πŸ‘‰ APIs are core building blocks of modern apps


🚨 Real Breaches (Important Insight)

  • LinkedIn β†’ 700M users scraped via API
  • Twitter β†’ 5.4M users exposed
  • PIXLR β†’ 1.9M records leaked

➑️ Lesson: APIs = high-value attack surface


βœ… Answers

  • Sample records β†’ 1 million
  • API docs useless? β†’ No (nay)

πŸ“Œ Task 3 β€” BOLA (Broken Object Level Authorization)

🧠 Concept

API exposes data using IDs but doesn’t check who is requesting.

➑️ ID change = data leak


βš”οΈ PoC

Step 1 β€” Hit Vulnerable Endpoint

GET /apirule1_v/user/1

➑️ Returns user data without any auth check.


Step 2 β€” ID Enumeration

GET /apirule1_v/user/2

➑️ Just increment ID β†’ access other users.


Step 3 β€” Extract Data

  • Total employees β†’ 3
  • Flag (ID=2) β†’ THM{838123}
  • Username (ID=3) β†’ Bob

⚠️ Why Vulnerable

  • No authorization check
  • Predictable IDs
  • Direct object reference

πŸ” Fix

  • Authorization tokens
  • Role validation
  • Use UUIDs

πŸ“Œ Task 4 β€” Broken User Authentication (BUA)

🧠 Concept

Login system is flawed β€” password not validated.


βš”οΈ PoC

Step 1 β€” Login with Only Email

POST /apirule2/user/login_v
email=hr@mht.com&password=anything

➑️ Login works even with wrong password πŸ’€


Step 2 β€” Get Token

cOC%Aonyis%H)mZ&uJkuI?_W#4&m>Y

➑️ Token issued without proper auth.


Step 3 β€” Use Token

GET /apirule2/user/details
Authorization-Token: <token>

➑️ Full account takeover.


⚠️ Why Vulnerable

  • SQL checks only email
  • Password ignored
  • Token issued blindly

πŸ” Fix

  • Validate password properly
  • Use hashing (bcrypt)
  • MFA + JWT

βœ… Extra Answer

  • GET request for creds? β†’ No (nay)

πŸ“Œ Task 5 β€” Excessive Data Exposure

🧠 Concept

API returns too much information, expecting frontend to filter.

➑️ Attacker intercepts raw response β†’ gets secrets.


βš”οΈ PoC

Step 1 β€” Fetch Comment

GET /apirule3/comment_v/2

➑️ Returns full dataset including hidden fields.


Step 2 β€” Extract Sensitive Data

  • Device ID β†’ iOS15.411

Step 3 β€” Another Record

GET /apirule3/comment_v/3

➑️ Username β†’ hacker#!


⚠️ Why Vulnerable

  • Backend sends everything
  • No filtering
  • Trusting frontend

πŸ” Fix

  • Return minimal data
  • Avoid generic serializers
  • Validate API responses

βœ… Answer

  • Network-level fix only? β†’ No (nay)

πŸ“Œ Task 6 β€” Lack of Resources & Rate Limiting

🧠 Concept

No request limits β†’ attackers can spam endpoints.

➑️ Leads to DoS or financial abuse.


βš”οΈ PoC

Step 1 β€” Send OTP

POST /apirule4/sendOTP_s
email=hr@mht.com

➑️ Response β†’ 200


Step 2 β€” Invalid Email

POST /apirule4/sendOTP_s
email=sale@mht.com
Invalid Email


⚠️ Why Vulnerable

  • No rate limiting
  • Unlimited requests
  • Resource exhaustion

πŸ” Fix

  • Rate limiting (time-based)
  • CAPTCHA
  • Request quotas

βœ… Answer

  • Rate limiting at network level? β†’ Yes (yea)

πŸ“Œ Task 7 β€” Broken Function Level Authorization

🧠 Concept

User can escalate privileges by manipulating request parameters.


βš”οΈ PoC

Step 1 β€” Send Admin Request

GET /apirule5/users_v
Authorization-Token: YWxpY2U6dGVzdCFAISM6Nzg5Nzg=
isAdmin: 1

➑️ Normal user accesses admin data 😢


Step 2 β€” Extract Data

  • Alice mobile β†’ +1235322323
  • Admin flag β†’ THM{3432$@#2!}

⚠️ Why Vulnerable

  • Trusting client input (isAdmin)
  • No backend role validation

πŸ” Fix

  • Enforce RBAC server-side
  • Ignore client-controlled role fields

βœ… Answer

  • isAdmin in hidden field safe? β†’ No (nay)

πŸ“Œ Task 8 β€” Conclusion

🧠 What You Learned

This lab basically drills 5 core API failures:

  1. BOLA β†’ ID-based data leaks
  2. BUA β†’ Broken login logic
  3. Data Exposure β†’ Too much data returned
  4. No Rate Limiting β†’ Abuse possible
  5. Function Auth β†’ Privilege escalation


🧾 Final Take (Important)

πŸ‘‰ APIs fail mainly due to trust assumptions:

  • Trusting IDs β†’ BOLA
  • Trusting login β†’ BUA
  • Trusting frontend β†’ Data leak
  • No limits β†’ Abuse
  • Trusting user roles β†’ Admin bypass

πŸ‘‹ Outro

If this helped, connect here:

More writeups soon β€” cleaner, deeper, and slightly unhinged πŸ—ΏπŸ”₯


About

Practical walkthrough of OWASP API Top 10 vulnerabilities with real exploitation steps and effective security fixes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors