Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ OWASP API Top 10 (Part 2)

Keywords: OWASP API Top 10, API Security, Mass Assignment, Injection, Security Misconfiguration
Description: Hands-on exploitation and mitigation of advanced API vulnerabilities with real-world scenarios.


πŸ”— References & Previous Part

Before diving into Part 2, check out Part 1:


πŸ“Œ Introduction

In Part 1, we explored core API vulnerabilities like BOLA, Broken Authentication, and Data Exposure. These primarily revolved around authorization and authentication flaws.

Now in Part 2, things get more backend-heavy and dangerous β€” focusing on:

  • Improper data handling
  • Misconfigurations
  • Injection attacks
  • Legacy API exposure
  • Logging failures

πŸ‘‰ APIs are the backbone of modern applications, and misconfigurations here can lead to full system compromise


πŸ“Œ Task 1 β€” Environment Setup

We start by launching the machine which includes:

  • Windows VM
  • Talend API Tester
  • Laravel-based vulnerable APIs

This setup allows us to simulate real-world API exploitation scenarios instead of just theory.


πŸ“Œ Task 2 β€” Vulnerability VI: Mass Assignment

🧠 Understanding the Vulnerability

Mass Assignment occurs when backend frameworks automatically bind user input to database fields.

πŸ‘‰ If not filtered properly, attackers can inject extra parameters and manipulate data.


βš”οΈ Exploitation

We attempt to create a user but include a hidden field:

POST /apirule6/user
name=attacker&username=hacker&password=pass123&credit=1000

➑️ Here, credit should NOT be user-controlled. ➑️ But due to mass assignment, backend blindly accepts it.


πŸ’₯ Impact

  • Privilege escalation
  • Data tampering
  • Business logic abuse

πŸ” Fix

  • Use allowlist (fillable)
  • Block sensitive fields (guarded)
  • Never trust client-side input

βœ… Result

Even when we send credit=1000, secure endpoint enforces:

➑️ Final credit β†’ 50


πŸ“Œ Task 3 β€” Vulnerability VII: Security Misconfiguration

🧠 Understanding the Vulnerability

Security misconfiguration happens when:

  • Debug mode is enabled
  • Error messages expose internals
  • Default configs are not hardened

βš”οΈ Exploitation

Triggering an error:

GET /apirule7/ping_v

➑️ Instead of a clean response, we get full stack trace.


πŸ’₯ Impact

  • File paths exposed
  • Internal architecture revealed
  • Helps attackers plan targeted attacks

πŸ” Fix

  • Disable debug in production
  • Implement proper error handling
  • Hide stack traces

βœ… Result

  • HTTP Code β†’ 500
  • Error ID β†’ 1401

πŸ“Œ Task 4 β€” Vulnerability VIII: Injection

🧠 Understanding the Vulnerability

Injection occurs when user input is directly executed by backend queries.

πŸ‘‰ Classic example: SQL Injection


βš”οΈ Exploitation

We bypass login using:

POST /apirule8/user/login_v
username=admin&password=' OR 1=1--

➑️ ' OR 1=1-- makes condition always true ➑️ Authentication bypass achieved πŸ—Ώ


πŸ’₯ Impact

  • Authentication bypass
  • Data extraction
  • Remote Code Execution (in severe cases)

πŸ” Fix

  • Parameterized queries
  • Input validation
  • ORM usage

βœ… Result

Secure endpoint returns:

➑️ 403 Forbidden


πŸ“Œ Task 5 β€” Vulnerability IX: Improper Assets Management

🧠 Understanding the Vulnerability

Old API versions often remain active and become forgotten attack surfaces.


βš”οΈ Exploitation

We target deprecated API:

POST /apirule9/v1/user/login
username=Alice&password=##!@#!!

➑️ Old API leaks extra sensitive data.


πŸ’₯ Impact

  • Sensitive data leakage
  • Access to outdated insecure logic
  • Potential full system compromise

πŸ” Fix

  • Remove deprecated APIs
  • Maintain API inventory
  • Use proper versioning

βœ… Result

  • Balance β†’ 100
  • Country β†’ USA

πŸ“Œ Task 6 β€” Vulnerability X: Insufficient Logging & Monitoring

🧠 Understanding the Vulnerability

If logging is weak or missing:

➑️ Attacks happen silently ➑️ No traceability


βš”οΈ Exploitation

Trigger logging endpoint:

GET /apirule10/logging

➑️ Logs metadata like IP, browser, etc.


πŸ’₯ Impact

  • No forensic evidence
  • Delayed detection
  • Persistent attacker presence

πŸ” Fix

  • Implement SIEM systems
  • Log all critical actions
  • Monitor anomalies

βœ… Result

➑️ HTTP Response β†’ 200


πŸ“Œ Conclusion

This part highlights a crucial shift:

πŸ‘‰ From user-level vulnerabilities β†’ backend/system-level failures


🧠 Final Insights

Across both parts, a pattern emerges:

  • Trusting input β†’ Injection / Mass Assignment
  • Poor configs β†’ Info leaks
  • Legacy systems β†’ Hidden attack surfaces
  • No monitoring β†’ Undetected breaches

πŸš€ Final Take

APIs don’t fail because they’re complex β€” they fail because developers trust too much and validate too little.


πŸ‘‹ Connect With Me


About

Walkthrough demonstrating real-world exploitation and mitigation of critical API security flaws (Mass Assignment to Logging & Monitoring).

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors