API Hacking 101: Part 1 – Intro to API Testing Like a Hacker


Introduction
APIs are everywhere — they're in the apps you use every day, from social networks to your smart fridge. They're the invisible thread connecting the frontend and the backend, and they’re often one of the biggest attack surfaces in modern applications.
In this series, we’ll walk through how to test and exploit APIs. It’s not about random hacking for the sake of it; it's about learning how attackers think and how they find vulnerabilities in APIs.
Let’s dive into some practical techniques — no fluff, just the good stuff.
Finding the API Documentation
First things first: You need to figure out how the API works. Without that, you're pretty much flying blind. Luckily, some devs leave their docs lying around like an open book — you just need to know where to look.
The most common API docs endpoints are:
/api
/api/v1
/api/v1/docs
/api/v1/swagger
/openapi.json
You might get lucky and hit one of these, or you'll end up finding swagger.json
or openapi.json
exposed somewhere on the app, revealing everything from endpoints to response codes.
But if you don’t have docs, no worries — you can still reverse-engineer the API traffic. Just open up your browser's dev tools (Network tab) and see what requests the frontend is making to the backend. Tools like Burp Suite or ZAP Proxy can intercept traffic, while mitmproxy can help you analyze requests from mobile apps.
Playing Around with HTTP Methods
Once you've found an endpoint, it’s time to see how much you can break it. The most common method is GET
, but just because that’s what’s used in the frontend doesn’t mean there aren’t other methods waiting to be explored. Try a couple of these on the same endpoint:
GET: The typical method for fetching data.
POST: Try adding some data to the server — maybe even change something.
PUT or PATCH: Update resources with new values. You might be able to change someone’s email or profile pic, for example.
DELETE: This one’s a bit scary, but if a dev hasn’t restricted it properly, you might delete resources you shouldn’t be able to.
For example, let’s say you find an endpoint:
GET /api/user/123
Now, try sending a POST
request to it:
POST /api/user/123
Body: {"name": "newName"}
What happens? If it accepts that, you might have just changed someone’s info without authorization.
Similarly, try a DELETE
on the same endpoint:
DELETE /api/user/123
If that works, you’ve just deleted a user. But, again, no authentication checks? Something’s up.
You’d be amazed how often developers forget to secure these methods properly.
Mass Assignment Vulnerabilities
Mass assignment is one of those classic API flaws that can lead to serious problems. Here’s the deal: When a backend blindly trusts the data coming from the frontend and automatically updates the database, bad things can happen.
Let’s say you find an endpoint designed to update a user’s profile:
POST /api/user/update
Body: {
"name": "newUser",
"bio": "exploring API hacking"
}
Everything works fine — until you start adding extra fields to your payload:
POST /api/user/update
Body: {
"name": "newUser",
"bio": "exploring API hacking",
"isAdmin": true,
"role": "superuser"
}
If the backend doesn't check if these fields should be updated, you might just upgrade yourself to an admin.
Here’s why this happens: Many frameworks automatically map incoming data to backend models without properly validating what’s allowed. So if the backend doesn’t whitelist which fields can be updated, you can inject your own — like isAdmin
.
This kind of vulnerability can lead to:
Privilege escalation (hello, admin panel)
Unauthorized access to restricted data
Account hijacking (changing passwords, emails, etc.)
It’s an easy way to break into systems if you can get the right endpoint.
Putting It All Together
Let’s connect the dots with a practical example. Imagine this:
You find an API endpoint for viewing a user profile, say
/api/user/42
.You test a
DELETE
request and realize you can delete this user without authentication.Then you find a
POST /api/user/update
endpoint and inject some additional fields ("isAdmin": true
,"role": "superuser"
).Next thing you know, you’re in as an admin and can access everything.
This is a simplified example, but it shows how finding misconfigured endpoints and blind trust in user input can lead to privilege escalation, data theft, and more.
By testing various HTTP methods, looking for weaknesses in field validation, and messing around with parameters, you’ll be able to identify risky spots in an API.
Final Thoughts
API hacking isn’t just about breaking things for fun — it’s about learning how vulnerabilities form and how to protect against them. You don’t need fancy tools to start, just some curiosity and persistence. Postman, Burp Suite, and even just browser dev tools are all you need to begin your journey.
In the next part, we’ll dive deeper into:
How to hack api’s using Server Side Parameter Pollution.
Also we’ll going to look into the mitigations of these problems.
Until then, go out there and start breaking things responsibly. The best way to learn is by doing.
Subscribe to my newsletter
Read articles from Mohak Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
