Skip to content

03 API Security

Welcome to:

Module 03 — API Security

Modern applications increasingly depend on APIs.

A user may interact with:

Web Application
Mobile Application
Desktop Application

but behind these interfaces you will often find:

API Endpoints
Application Logic
Databases
Cloud Services

For a Bug Bounty Hunter, this creates an important principle:

Do Not Test
Only the UI
Test the APIs
That Power It

In this module, you will learn how to discover, understand and systematically assess APIs while remaining within authorized scope.

By the end of this module, you will understand how to:

  • explain modern API architecture.

  • understand REST APIs.

  • understand GraphQL fundamentals.

  • identify API endpoints.

  • analyze API requests and responses.

  • understand HTTP methods in API workflows.

  • analyze JSON request bodies.

  • understand API authentication.

  • analyze API keys and bearer tokens.

  • understand JWT fundamentals.

  • test API authorization.

  • identify Broken Object Level Authorization.

  • understand Broken Function Level Authorization.

  • analyze object ownership.

  • test role boundaries.

  • identify excessive data exposure.

  • understand mass assignment.

  • analyze hidden API parameters.

  • assess API rate limiting.

  • understand resource consumption risks.

  • investigate pagination and filtering.

  • analyze API versioning.

  • identify undocumented endpoints.

  • understand GraphQL authorization risks.

  • analyze GraphQL queries and mutations.

  • assess API business logic.

  • understand API security misconfiguration.

  • collect API evidence.

  • build API attack-surface inventories.

  • write professional API vulnerability reports.

API stands for:

Application
Programming
Interface

An API allows software components to communicate.

For example:

Mobile App
API
Application Server
Database

Instead of returning HTML, APIs commonly return structured data such as:

{
"id": 1001,
"name": "Alice",
"role": "user"
}

2 — Why APIs Matter to Bug Bounty Hunters

Section titled “2 — Why APIs Matter to Bug Bounty Hunters”

APIs frequently expose:

Authentication
User Profiles
Payments
Files
Orders
Messages
Administration
Cloud Services
Business Workflows

The API may therefore represent:

The Actual
Security Boundary

behind the application.

Suppose the UI shows:

My Profile

but the browser sends:

GET /api/users/1001

The important security question becomes:

Can User A
Request User B's
Object?

not simply:

Can the UI
Display Another
Profile?

A simplified architecture:

Client
API Gateway
Authentication
Application Service
Database

More complex environments may contain:

Web Client
Mobile Client
API Gateway
Microservices
Identity Provider
Databases
Cloud Services
Third-Party APIs

REST APIs commonly expose resources through endpoints such as:

/api/users
/api/orders
/api/files
/api/projects

Individual objects may be accessed using:

/api/users/1001

REST APIs frequently use:

GET
Read
POST
Create
PUT
Replace
PATCH
Modify
DELETE
Delete

But never assume the method alone determines authorization.

GET /api/v1/profile HTTP/1.1
Host: api.example.com
Authorization: Bearer <token>
Accept: application/json
{
"id": 1001,
"username": "research-user",
"plan": "premium"
}

APIs commonly accept:

{
"name": "Research User",
"email": "research@example.test"
}

Each field creates a question:

Can I Modify It?
Should I Control It?
Does the Server
Validate It?
Does Authorization
Apply to It?

Create an inventory of:

Hosts
Versions
Endpoints
Methods
Parameters
Objects
Roles
Tokens
Business Workflows

Think:

API Host
Endpoint
Method
Parameter
Object
Identity
Authorization

Within authorized environments, endpoints may be discovered from:

Browser Traffic
Mobile Traffic
JavaScript
API Documentation
Application Routes
Network Requests
Error Messages

Modern applications frequently make API calls using:

Fetch
XHR
GraphQL

Inspecting application traffic can reveal:

Endpoints
Methods
Parameters
Headers
Response Structures

Application JavaScript may contain references such as:

/api/v1/users
/api/v2/orders
/graphql
/api/admin

These references help build:

API Attack
Surface

Discovery does not automatically mean authorization.

APIs may expose documentation through technologies such as:

OpenAPI
Swagger
GraphQL Schema

Documentation can reveal:

Endpoints
Parameters
Data Types
Authentication
Response Models

Create:

API_Inventory.csv

with:

Endpoint Method Authentication Role Object Purpose

Example:

/api/users
├── GET
└── POST
/api/users/{id}
├── GET
├── PATCH
└── DELETE

Each combination represents a separate:

Security
Testing Scenario

Authentication identifies:

Who Is
Making the Request?

APIs may use:

Session Cookies
API Keys
Bearer Tokens
JWT
OAuth Tokens

Example:

Authorization: Bearer <access-token>

Possession of the token may represent:

Authenticated
Identity

Treat tokens as sensitive credentials.

API keys may identify:

Application
Client
Integration
User

Do not assume:

API Key
=
User Authorization

The security model depends on implementation.

Questions include:

Does Token Expire?
Can Token
Be Reused?
Does Logout
Invalidate It?
Are Permissions
Embedded?
Can Revoked Tokens
Still Work?

JWT stands for:

JSON Web Token

A JWT commonly contains:

Header
Payload
Signature

Conceptually:

Header.Payload.Signature

A payload might contain claims such as:

{
"sub": "1001",
"role": "user",
"exp": 1780000000
}

Remember:

Readable
Editable

A properly validated signature should prevent unauthorized modification.

Assess:

Signature Validation
Expiration
Issuer
Audience
Token Type
Key Management
Claim Enforcement

Do not assume a token is vulnerable merely because its contents are readable.

Authentication:

This Token
Belongs to
User A

Authorization:

Can User A
Access Object 5001?

Many serious API vulnerabilities occur because:

Authentication Works
but
Authorization Fails

Broken Object Level Authorization is commonly abbreviated:

BOLA

It occurs when an API fails to properly verify whether the authenticated user is allowed to access a particular object.

Account A owns:

/api/orders/5001

Account B owns:

/api/orders/5002

Account B requests:

GET /api/orders/5001

If the API returns Account A’s private order without authorization:

Potential BOLA

Use:

Research Account A
Research Account B

where possible.

Workflow:

Account A
Creates Object
Record Object ID
Account B
Requests Object
Observe Authorization

Objects may use:

Sequential IDs
UUIDs
Names
Email Addresses
Tokens
Composite IDs

Important:

Hard-to-Guess ID
Authorization

A UUID may make an object difficult to guess.

But if:

User B Obtains
User A's UUID

the server must still enforce:

Authorization

Do not test only:

GET

Authorization may differ for:

GET
PATCH
PUT
DELETE

Example:

Cannot Read
Another User's Object
but
Can Modify It

Create:

Object_Ownership_Matrix.csv

with:

Object Owner User A User B Admin

32 — Broken Function Level Authorization

Section titled “32 — Broken Function Level Authorization”

BFLA stands for:

Broken Function
Level Authorization

It concerns access to:

Restricted
Functions

rather than individual objects.

Normal user:

GET /api/profile

Administrator:

POST /api/admin/users/1001/disable

Ask:

Can Normal User
Call the Admin
Endpoint Directly?

The frontend may hide:

Admin Menu

but API endpoints may still exist.

Remember:

Hidden UI
Authorization

Compare requests from:

Guest
User
Premium User
Moderator
Administrator

where these roles exist in an authorized lab.

Create:

API_Authorization_Matrix.csv

with:

Function Guest User Premium Admin

This helps identify:

Expected
Security Boundaries

Authorization may also apply to individual object properties.

Example:

{
"name": "Researcher",
"email": "user@example.test",
"role": "user"
}

The user may be allowed to change:

name

but not:

role

Mass assignment can occur when an application automatically maps user-provided properties into internal objects without sufficiently restricting sensitive fields.

Example:

{
"name": "Research User",
"role": "admin"
}

The security question is:

Does the Server
Accept Sensitive
Properties the User
Should Not Control?

Compare:

GET Response

with:

PATCH Request

You may discover fields such as:

role
verified
account_status
discount
permissions

Do not assume they are writable.

Test safely.

An API may return more information than the client needs.

Example:

{
"name": "User",
"email": "user@example.test",
"internal_id": "12345",
"private_field": "..."
}

The key question is:

Should This User
Receive This Data?

Do not inspect only the fields displayed by the UI.

Inspect:

Complete
API Response

because JavaScript may ignore sensitive fields that are still returned.

Secure APIs should generally return:

Only the Data
Required

for the authorized operation.

APIs may expose list endpoints such as:

GET /api/users
GET /api/orders
GET /api/files

Determine:

Who Can List?
What Can They See?
How Much Data
Is Returned?

Typical pagination parameters include:

page
limit
offset
cursor

Example:

/api/users?page=1&limit=20

Ask:

Can Limits
Be Excessive?
Does Pagination
Bypass Authorization?
Can Hidden Records
Be Retrieved?

Use safe values to avoid unnecessary resource consumption.

APIs may support:

?user_id=1001
?status=active
?account=123

Filters should not replace authorization.

Parameters such as:

sort
order
field

may reveal unexpected application behavior.

Treat them as user-controlled input.

APIs often require rate limits for operations such as:

Authentication
OTP
Password Reset
Search
Messaging
Coupon Redemption

Determine whether:

Limits Exist
Limits Apply
Per Account
Per Token
Per IP
Per Endpoint

Do not create excessive traffic.

Some API requests may be computationally expensive.

Examples:

Large Search
Complex GraphQL Query
Large Export
File Processing

Avoid stress testing unless explicitly authorized.

Applications may expose:

/api/v1/
/api/v2/
/api/v3/

Older versions can be interesting because:

Security Controls
May Differ

Example:

/api/v2/profile

enforces authorization.

But:

/api/v1/profile

may behave differently.

Do not assume old versions are in scope merely because they exist.

Applications may retain:

Legacy Endpoints
Development Endpoints
Internal Routes
Deprecated APIs

These can appear in:

JavaScript
Documentation
Traffic
Historical References

Errors may reveal:

Internal Object Names
Database Fields
Framework Information
Service Names
Internal Paths

Determine whether disclosure creates meaningful security impact.

Potential examples include:

Verbose Errors
Public Documentation
Weak CORS
Debug Endpoints
Unnecessary Methods
Exposed Internal APIs

Impact must always be validated.

APIs may process:

application/json
application/xml
application/x-www-form-urlencoded
multipart/form-data

Different parsers may enforce security controls differently.

If an endpoint expects:

POST

understand how it behaves with other supported methods.

Do not assume:

Method Restriction
=
Authorization

The same value might appear in:

URL
Header
Cookie
JSON Body

Map where the server obtains:

Identity
Object ID
Role
State

Applications and intermediary systems can sometimes interpret duplicate parameters differently.

This becomes relevant when:

Multiple Layers
Parse the Request

Focus on understanding behavior rather than blindly mutating requests.

API testing is not only about technical vulnerabilities.

APIs implement:

Business Rules

such as:

Purchases
Refunds
Subscriptions
Invitations
Approvals
Credits
Rewards

Workflow:

Create Order
Pay
Complete
Refund

Ask:

Can Order
Complete Without
Payment?

Map:

Pending
Approved
Completed

Then ask:

Can User Move
Directly from
Pending to Completed?

Example:

{
"status": "approved"
}

Ask:

Should the Client
Control This Field?

Example:

{
"product_id": 100,
"quantity": 1
}

Investigate whether the server independently calculates:

Price
Discount
Total

Some operations should be:

Single Use

Examples:

Coupon
Invite
Reset Token
Payment Action

Determine whether replay creates unauthorized effects.

Certain workflows may behave incorrectly when requests occur concurrently.

Potential areas:

Coupons
Inventory
Rewards
Withdrawals
Invitations

Only test concurrency in safe training environments or where explicitly permitted.

For every resource ask:

Who Can Create?
Who Can Read?
Who Can Update?
Who Can Delete?

This gives:

CRUD
Authorization Matrix

Create:

Resource Create Read Update Delete
Profile User Owner Owner Owner
User Admin Admin Admin Admin
File User Owner Owner Owner

Then validate server behavior.

GraphQL provides a flexible query interface commonly exposed through an endpoint such as:

/graphql

Unlike REST:

Many Operations
May Share
One Endpoint

Conceptually:

query {
profile {
id
username
}
}

Mutations modify state.

Conceptually:

mutation {
updateProfile(name: "Research User") {
id
name
}
}

Map:

Queries
Mutations
Objects
Fields
Arguments
Roles

Authorization must still apply to:

Objects
Fields
Functions

GraphQL does not automatically provide access control.

Suppose:

user(id: "1001")

returns another user’s private information.

The underlying problem may still be:

Broken Object
Authorization

A user may be allowed to access:

name

but not:

internalNotes

Field-level authorization therefore matters.

GraphQL may support schema introspection.

It can reveal:

Types
Queries
Mutations
Fields
Arguments

Whether introspection exposure itself is a vulnerability depends on context.

GraphQL allows flexible queries.

Complex queries can potentially create:

Resource
Consumption

risks.

Do not perform stress testing without explicit authorization.

Mobile applications frequently communicate with the same or similar APIs used by web applications.

Therefore:

Mobile UI
API

should be understood as part of the broader application architecture.

Compare:

Web API
Mobile API

Security controls may differ because of:

Different Versions
Different Clients
Legacy Implementations

Identify where trust changes:

Client
API Gateway
Service
Database

Ask:

Which Layer
Authenticates?
Which Layer
Authorizes?
Which Layer
Validates Input?

Modern APIs may call multiple internal services.

Example:

API Gateway
Order Service
Payment Service
Notification Service

Security assumptions between services can create vulnerabilities.

An API gateway may provide:

Authentication
Rate Limiting
Routing
Logging

but backend services should not blindly assume every request is trustworthy.

Suppose request contains:

{
"user_id": "1001"
}

Ask:

Does the Server
Trust This Value
or
Derive Identity
from Authentication?

Determine whether identity comes from:

Session
JWT
API Key
Request Parameter
Header

This is fundamental to authorization testing.

Determine how the server identifies the resource:

URL ID
JSON ID
Query Parameter
Token Claim

Then compare:

Identity
vs
Object Ownership

For every request ask:

Who Am I?
What Am I
Requesting?
Do I Own It?
What Role
Do I Have?
What Input
Can I Control?
What Should
the Server Enforce?

Compare:

Account A Request
vs
Account B Request

Then compare:

User Request
vs
Admin Request

Look at:

Endpoint
Method
Headers
Body
Response

Always preserve:

Known-Good
Request

before modifying:

Token
Object ID
Role
Method
Parameter

Example:

Baseline
User A + Object A

Change only:

Object A
Object B

This makes the authorization test easier to understand.

Compare:

Status
Length
Fields
Values
Headers
Timing

Do not rely only on:

200
403
404

Response:

HTTP/1.1 200 OK

may contain:

{
"error": "Access denied"
}

Always inspect the actual response.

Likewise, inspect whether a denied response accidentally contains:

Sensitive
Information

Strong evidence includes:

Account A Identity
Account B Identity
Object Ownership
Baseline Request
Unauthorized Request
Response
Security Impact

Document:

Account A
owns object 5001.
Account B
is authenticated separately.
Account B requests
object 5001.
API returns
Account A's private object.

This clearly demonstrates:

Ownership
+
Unauthorized Access

Weak:

Changing ID
Returns 200

Strong:

Changing Account B's
object ID to Account A's
object ID returns Account A's
private billing record.

Your report should contain:

Title
Endpoint
Method
Authentication
Affected Role
Prerequisites
Reproduction
Request
Response
Impact
Remediation

Weak:

API IDOR

Better:

Broken Object-Level
Authorization Allows
Authenticated Users
to Access Other Users'
Private Documents

Explain:

What Data
Can Be Accessed?
What Action
Can Be Performed?
Who Is Affected?
What Privilege
Is Required?

Depending on the issue, recommendations may include:

Server-Side
Authorization
Object Ownership
Validation
Role Validation
Property Allowlisting
Data Minimization
Rate Limiting

Create:

API_Security_Notebook.md

with:

# API Hosts
# Versions
# Authentication
# Roles
# Endpoints
# Objects
# Parameters
# Authorization
# Business Logic
# GraphQL
# Vulnerability Candidates
# Evidence
# Reports

Create:

API_Endpoint_Register.csv

with:

Endpoint Method Auth Role Object Parameters

Create:

API_Object_Register.csv

with:

Object Identifier Owner Sensitivity Operations

Create:

API_Parameter_Register.csv

with:

Parameter Endpoint Location Type Security Relevance

Create:

API_Role_Matrix.csv

with:

Endpoint Guest User Premium Admin

Create:

API_Hypotheses.csv

with:

ID Endpoint Hypothesis Test Result Status
Can User B
Read User A's
Object?
Can User
Call Admin
Function?
Can Sensitive
Property Be Modified?
Can Revoked Token
Still Work?
Can Legacy API
Bypass New Control?

Create:

API_Vulnerability_Candidates.csv

with:

Finding Endpoint Evidence Impact Status

Use:

Discover
Inventory
Authenticate
Understand Objects
Map Roles
Build Baseline
Create Hypothesis
Modify Request
Compare Response
Validate
Document
Report

Instead of asking:

Is This API
Vulnerable?

ask:

What Objects
Exist?
Who Owns Them?
Who Can Read Them?
Who Can Modify Them?
Who Can Delete Them?

Then ask:

What Functions
Exist?
Which Roles
Should Access Them?
Can Lower Roles
Call Them Directly?

Then:

Which Fields
Can Users Control?
Which Fields
Should Be
Server-Controlled?

Finally:

What Business
Process Does
This API Implement?
Can Steps
Be Skipped?
Can Actions
Be Replayed?
Can State
Be Manipulated?

Practical Exercise 1 — Build an API Inventory

Section titled “Practical Exercise 1 — Build an API Inventory”

Using an authorized training application, identify:

API Host
Version
Endpoints
Methods
Authentication

Create:

API_Inventory.csv

Practical Exercise 2 — Map 20 API Endpoints

Section titled “Practical Exercise 2 — Map 20 API Endpoints”

Document at least:

20
Endpoint + Method
Combinations

where available.

Classify each by:

Authentication
Role
Object
Function

Practical Exercise 3 — Build Object Inventory

Section titled “Practical Exercise 3 — Build Object Inventory”

Identify:

Users
Files
Orders
Projects
Messages

where available.

Document:

Identifier
Owner
Operations
Sensitivity

Practical Exercise 4 — Two-Account BOLA Test

Section titled “Practical Exercise 4 — Two-Account BOLA Test”

Using your own training accounts:

Account A
Creates Object
Account B
Attempts Read
Account B
Attempts Update

Document the authorization behavior.

Practical Exercise 5 — Function Authorization

Section titled “Practical Exercise 5 — Function Authorization”

Create:

Normal User
Admin User

in an authorized lab.

Compare:

Admin Functions
Normal Functions

and validate that restricted API operations enforce authorization server-side.

Take an editable profile object.

Identify:

User-Controlled Fields
Server-Controlled Fields

Test whether sensitive fields are appropriately protected.

Document:

Token Creation
Expiration
Logout
Password Change
Revocation

and observe expected token behavior.

Practical Exercise 8 — API Version Comparison

Section titled “Practical Exercise 8 — API Version Comparison”

If your training environment exposes:

v1
v2

compare:

Authentication
Authorization
Response Fields
Methods

In an authorized GraphQL lab, identify:

Queries
Mutations
Objects
Fields
Arguments

and create:

GraphQL_Attack_Surface.md

Practical Exercise 10 — API Business Logic

Section titled “Practical Exercise 10 — API Business Logic”

Select one workflow:

Order
Coupon
Invite
Subscription
Approval

Document:

Normal Sequence
State Changes
Security Boundaries
Potential Abuse Cases

Practical Exercise 11 — Build Authorization Matrix

Section titled “Practical Exercise 11 — Build Authorization Matrix”

Create:

API_Authorization_Matrix.csv

for:

Guest
User A
User B
Admin

across at least ten operations.

Practical Exercise 12 — Write an API Vulnerability Report

Section titled “Practical Exercise 12 — Write an API Vulnerability Report”

Create a professional report for a fictional:

Broken Object
Level Authorization

finding.

Include:

Title
Endpoint
Method
Accounts
Object Ownership
Baseline Request
Unauthorized Request
Response
Impact
Remediation
  1. What is an API?

  2. Why are APIs important in bug bounty hunting?

  3. What is REST?

  4. What are common REST methods?

  5. What is an API endpoint?

  6. What information can JavaScript reveal about APIs?

  7. What is OpenAPI?

  8. What is API authentication?

  9. What is a bearer token?

  10. What is an API key?

  11. What is a JWT?

  12. Why does readable JWT content not mean the token is editable?

  13. What is the difference between authentication and authorization?

  14. What is BOLA?

  15. Why should two controlled accounts be used for BOLA testing?

  16. Why are UUIDs not authorization controls?

  17. Why should read and write authorization both be tested?

  18. What is BFLA?

  19. Why does a hidden admin interface not provide authorization?

  20. What is property-level authorization?

  21. What is mass assignment?

  22. What is excessive data exposure?

  23. Why should complete API responses be reviewed?

  24. Why should filters not replace authorization?

  25. What is API rate limiting?

  26. Why must resource-consumption testing be controlled?

  27. Why are legacy API versions interesting?

  28. What are undocumented APIs?

  29. What information can API errors expose?

  30. What is API security misconfiguration?

  31. Why does Content-Type matter?

  32. What is API business logic?

  33. What is state-transition testing?

  34. Why can replayable actions create security issues?

  35. What is a CRUD authorization matrix?

  36. What is GraphQL?

  37. What is a GraphQL query?

  38. What is a GraphQL mutation?

  39. Why does GraphQL still require object-level authorization?

  40. What is field-level authorization?

  41. What is GraphQL introspection?

  42. Why can GraphQL complexity create resource risks?

  43. Why should mobile APIs be assessed?

  44. What is an API gateway?

  45. Why should backend services not blindly trust gateway assumptions?

  46. Why is determining the identity source important?

  47. What is differential API testing?

  48. Why should one request variable be changed at a time?

  49. What makes strong BOLA evidence?

  50. What should a professional API vulnerability report contain?

API security requires thinking in:

Identity
Objects
Functions
Properties
Roles
State
Business Logic

For every API request ask:

Who Am I?
What Object
Am I Accessing?
Do I Own It?
What Role
Do I Have?
What Action
Am I Performing?
Should the Server
Allow It?

Remember:

Authentication
Authorization
UUID
Authorization
Hidden Endpoint
Protected Endpoint
Hidden Field
Protected Property
HTTP 200
Successful Exploit
API Response
Only What
the UI Displays

A professional API testing methodology is:

Discover
Map
Understand Identity
Understand Objects
Understand Roles
Build Baseline
Create Hypothesis
Test
Compare
Validate
Report

API security skills are increasingly important for:

Bug Bounty Hunters
Security Researchers
Application Security Engineers
API Security Analysts
Penetration Testers
Cloud Security Engineers

During interviews, you should be able to explain:

How You
Discover APIs
How You
Map Endpoints
How You
Identify Objects
How You
Test BOLA
How You
Test BFLA
How You
Analyze Tokens
How You
Assess Properties
How You
Test Business Logic
How You
Validate Impact

Instead of saying:

I Test
API Endpoints

you should be able to explain:

I first map the API's
endpoints, methods,
objects and authentication
model.
I identify the relationship
between authenticated
identities and application
objects.
I then build authorization
matrices across users,
roles, functions and
properties.
Using controlled accounts,
I test whether server-side
authorization remains
enforced when object IDs,
roles, methods or
properties change.
Finally, I validate the
business impact and
document reproducible
evidence.

➡️ Next: 04 — Mobile Security

You now understand how applications expose functionality through:

APIs
Objects
Tokens
Roles
Endpoints
Business Workflows

The next module extends this knowledge into:

Mobile Applications

You will learn how Android and iOS applications interact with:

Application Packages
Local Storage
Configuration
Deep Links
Authentication
Tokens
WebViews
Mobile APIs
Backend Services

You will move from:

Testing
Web and API
Interfaces

to:

Understanding
the Mobile Client
+
Testing the
Backend Services
That Power It

using:

Mobile Application
Application Package
Configuration
Local Data
Network Traffic
API
Authentication
Authorization
Business Logic

➡️ Next: 04 — Mobile Security