Login
ChallengesLearn
Scoreboard
Teams
Profile

Preferences

Truesapiens

LearnAPI SecurityAPI Security Overview
API Security·Lesson 1 of 11

API Security Overview

The OWASP API Security Top 10: BOLA, broken auth, excessive data exposure, mass assignment, and rate limiting. How APIs differ from browser-based apps — no session, no CSRF token, no trust boundary at the HTTP level.

Beginner12 min
APIOWASPOverview
Loading lesson…
NextAPI Reconnaissance

© 2026 Truesapiens.

Terms of ServicePrivacy PolicyCookie Policy

APIs are the connective tissue of modern applications. Mobile apps, single-page applications, IoT devices, and microservices all speak API - and each one is a potential entry point. Unlike browser-based apps with session cookies and Same-origin Policy, APIs rely on tokens, keys, and headers that attackers can forge, replay, or simply omit.

What you'll be able to do
  • Identify the top API security risks from the OWASP API Security Top 10.
  • Explain how Broken Object Level Authorization (BOLA) differs from missing authentication.
  • Recognise excessive data exposure and mass assignment in API responses.
  • Describe why rate limiting is critical for API availability and account security.
Prerequisites
Read these lessons first:
  • L1How the Web Works
  • L2HTTP Basics
Key terms
BOLA
Broken Object Level Authorization - when an API fails to verify that the requesting user owns or is authorised to access the requested object. OWASP API #1.
Excessive data exposure
When an API response includes more fields than the client needs, often leaking sensitive data like password hashes, internal IDs, or PII. OWASP API #3.
Mass assignment
A vulnerability where an API binds user-supplied input directly to internal object fields, allowing attackers to modify properties they should not control. OWASP API #6.
API surface
The total set of endpoints, parameters, and data models exposed by an API. A larger surface means more potential attack vectors.
Rate limiting
A mechanism that restricts how many requests a client can make in a given time window. Absent rate limiting enables brute-force and DoS attacks. OWASP API #4.
What is it?

The API attack surface

Traditional web applications benefit from browser-enforced security boundaries. Cookies are automatically scoped to the origin, the Same-origin Policy prevents cross-site reads, and Content Security Policy restricts script execution. APIs have none of these. An API is a programmatic interface - every request is made by code, and that code can come from anywhere. The authentication token is just a string, and if the API does not validate it correctly, or does not check whether the token holder is allowed to access the specific resource, the data is exposed.

The OWASP API Security Top 10 catalogues the most common and impactful API vulnerabilities. The top three alone account for the majority of real-world API breaches:

  • API #1 - Broken Object Level Authorization (BOLA): Happens when an API uses user-supplied IDs (like /api/users/123) without verifying that the current user owns that object. The attacker simply changes the ID.
  • API #2 - Broken Authentication: Weak token generation, missing expiry, or endpoints that accept requests without any authentication at all.
  • API #3 - Excessive Data Exposure: The API returns the full database object instead of a view-model, leaking fields like passwordHash, ssn, or internalNotes.
  • API #4 - Lack of Resource & Rate Limiting: Without rate limits, attackers can brute-force credentials, enumerate user IDs, or overwhelm the backend.
  • API #6 - Mass Assignment: When API frameworks automatically bind request body fields to model properties, an attacker can set role: "admin" or isAdmin: true.

The attack surface also varies by API style. REST APIs expose resources through URL paths and HTTP methods - each endpoint is a potential target. GraphQL APIs consolidate data access into a single endpoint, but expose the full schema through introspection, letting attackers query any field. RPC-based APIs (like gRPC or JSON-RPC) often expose internal method names and may skip HTTP-level security controls entirely.

API request lifecycle
Mini Map
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Try it

API Playground

Use the API Playground below to explore how BOLA and excessive data exposure work in practice. Send requests as an authenticated user and try changing the user ID in REST URLs or GraphQL queries to access data you should not have permission to see.

API Playgrounddev
Ssecurity
Get authenticated user profile
Tip:Try changing the user ID in the URL or querying another user's data via GraphQL. Without object-level authorisation, the API returns data it should not — this is Broken Object Level Authorization (BOLA).
Real-world relevance

Peloton 2021 - API auth bypass leaked user data

In March 2021, security researcher David Paulovsky discovered that Peloton's API exposed any user's private profile data through a simple IDOR (Insecure Direct Object Reference) - a textbook BOLA vulnerability (OWASP API #1). The Peloton mobile app called an API endpoint like /api/user/123456/profile to display profile information. The API checked that the request carried a valid authentication token but never verified that the token belonged to the user whose profile was being requested.

An attacker could create a free Peloton account, capture their own auth token, and then iterate through user IDs to scrape private data including full name, age, weight, workout history, and location. The vulnerability affected millions of users. Peloton fixed it by enforcing object-level authorisation - the API now verifies that the authenticated user is the owner of the requested profile before returning any data.

The Peloton case is a classic example of a broken authorisation model: the API trusted that the authenticated user was requesting their own data simply because they had a valid token. Authentication (who are you?) is not the same as authorisation (are you allowed to do that?). BOLA happens when an API conflates the two.

Mitigation

Securing your API surface

Defending against the OWASP API Top 10 requires a layered approach that starts at the API design phase and continues through deployment:

typescriptsafe
// VULNERABLE — BOLA via direct object reference
app.get('/api/users/:id', (req, res) => {
  const user = db.users.find(req.params.id);
  res.json(user); // no ownership check
});

// SAFE — object-level authorisation
app.get('/api/users/:id', (req, res) => {
  const user = db.users.find(req.params.id);
  if (user.id !== req.auth.userId && req.auth.role !== 'admin') {
    return res.status(403).json({ error: 'Forbidden' });
  }
  res.json(toViewModel(user)); // strip sensitive fields
});

// SAFE — rate limiting middleware
const limiter = rateLimit({
  windowMs: 60_000, max: 100,
  keyGenerator: (req) => req.ip,
});
app.use('/api/', limiter);

// SAFE — mass assignment prevention
const safeFields = ['username', 'email', 'avatarUrl'];
const update: Record<string, unknown> = {};
for (const field of safeFields) {
  if (body[field] !== undefined) update[field] = body[field];
}
db.users.update(req.auth.userId, update);

Key mitigation strategies include: always enforce object-level authorisation checks in the handler, never return full database entities directly (use a view-model or a projection), implement rate limiting on every public endpoint, whitelist bindable fields instead of using blanket deserialisation, and disable GraphQL introspection in production.

Further reading
  • OWASP API Security Top 10(OWASP)
  • Peloton API vulnerability disclosure(BleepingComputer)
  • GraphQL security best practices(GraphQL Foundation)
  • Rate limiting strategies for APIs(NGINX)
Key takeaways

What to remember

  • APIs lack browser-enforced security boundaries - every request must be authenticated and authorised independently.
  • BOLA (OWASP API #1) is the most common API vulnerability: the API checks authentication but not object-level ownership.
  • Excessive data exposure happens when APIs return raw database objects instead of filtered view-models.
  • Rate limiting is not optional - without it, attackers can brute-force credentials and enumerate resources.
  • REST, GraphQL, and RPC APIs have different attack surfaces; know your protocol before you defend it.

Knowledge check

0/3 answered · 0 correct
  1. 1.What is the difference between authentication and authorisation in the context of APIs?

  2. 2.Which OWASP API Security Top 10 category does the Peloton 2021 vulnerability fall under?

  3. 3.How does mass assignment (API #6) differ from excessive data exposure (API #3)?