blog

Why API Security

Introduction to APIs

API stands for Application Programming Interface. Often referred to as “websites for machines,” APIs are present in almost everything we do online today.

Here are a few everyday examples:

sequenceDiagram
    autonumber
    actor User as "User (Browser/App)"
    participant Kayak as "Kayak Platform"
    participant AirlineA as "Airline A API"
    participant AirlineB as "Airline B API"
    
    User->>Kayak: Search Flights (NYC to LON)
    par Fetch Airline Fares
        Kayak->>AirlineA: GET /fares?from=NYC&to=LON
        AirlineA-->>Kayak: Fare: $450
    and
        Kayak->>AirlineB: GET /fares?from=NYC&to=LON
        AirlineB-->>Kayak: Fare: $420
    end
    Kayak-->>User: Display Combined Results

APIs are the engines powering how the modern internet works, enabling seamless integrations across organizations, mobile apps, and platforms.


The Perfect API Storm

The current state of API security and adoption forms what can be described as a Perfect API Storm. Consider these key statistics:


What is Being Targeted?

APIs act as direct gateways to:

Attackers target APIs to steal credit card information, harvest personal data, perform transaction fraud, and scrape proprietary datasets.


Why Focus Specifically on APIs?

APIs are the connective tissue of modern software. They sit directly between the outside world and internal application logic:

graph LR
    subgraph zone1 ["Public Internet (Untrusted Zone)"]
        UI["User Interface / Client App"]
        Attacker["Attacker / Script"]
    end

    subgraph zone2 ["API Gateway / Router"]
        API["API Endpoint / Backend Router"]
    end

    subgraph zone3 ["Internal Network (Trusted Zone)"]
        App["Application Logic"]
        DB[("Database")]
        Tx["Transaction Engine"]
    end

    UI -->|Legitimate API Request| API
    Attacker -->|Direct API Call / Custom Payload| API
    API --> App
    App --> DB
    App --> Tx

Every user action—logging in, depositing a check, transferring money—typically triggers a distinct API call. Because APIs connect the outside world directly to backend systems, any vulnerability in their configuration, logic, or implementation can be exploited to bypass UI-level security controls.

APIs are Publicly Exposed

A common misconception is that APIs are “hidden” or “invisible” because they run in the background. However, APIs are trivial to discover.

By simply opening a browser’s Developer Tools (right-clicking, selecting Inspect, and moving to the Network tab) while performing an action on a website (like searching for flights), anyone can capture, view, and analyze the underlying API requests and their payloads.


How an API Attack Works

In a typical web application, the User Interface (UI) restricts what a user can do. However, the API layer removes these guardrails.

  1. Reconnaissance: An attacker explores the target application, registers an account, and uses all available features.
  2. Traffic Capture: They monitor the network requests to identify the API endpoints powering the application.
  3. Bypassing the UI: The attacker bypasses the frontend entirely, writing custom requests to hit the API endpoints directly (using tools like Postman, cURL, or custom scripts).
sequenceDiagram
    actor Attacker as "Attacker (Postman/cURL)"
    participant UI as "Client UI (Control Guardrails)"
    participant Backend as "Backend API (Target)"

    Note over Attacker,UI: Normal User Flow
    UI->>Backend: Validated & constrained requests
    Backend-->>UI: Sanitized response

    Note over Attacker,Backend: Bypassed UI Attack Flow
    Attacker->>Backend: Manipulated Request (e.g. customized user_id, direct DB field edit)
    Note right of Backend: Backend must validate requests!<br/>If validation fails, vuln is exploited.
    Backend-->>Attacker: Unfiltered Data / Execution Result

[!NOTE] UI vs. API Control

Attackers scan the API layer for:


The Simplified API Kill Chain

Exploiting APIs is often significantly easier than executing traditional network attacks.

Traditional Cyber Attack Kill Chain

A complex, multi-stage process requiring high sophistication: \(\text{Reconnaissance} \rightarrow \text{Infiltration} \rightarrow \text{Weaponization} \rightarrow \text{Lateral Movement} \rightarrow \text{Privilege Escalation} \rightarrow \text{Exfiltration / Breach}\)

API Attack Kill Chain

A direct path to exploitation: \(\text{Find API Vulnerability} \rightarrow \text{Direct Breach}\)

graph TD
    subgraph chain1 ["Traditional Kill Chain (Complex)"]
        T1["1. Reconnaissance"] --> T2["2. Infiltration"]
        T2 --> T3["3. Weaponization"]
        T3 --> T4["4. Lateral Movement"]
        T4 --> T5["5. Privilege Escalation"]
        T5 --> T6["6. Exfiltration / Breach"]
    end

    subgraph chain2 ["API Attack Kill Chain (Direct)"]
        A1["1. Probe / Find API Vulnerability"] --> A2["2. Direct Breach"]
    end

    style T6 fill:#f9f,stroke:#333,stroke-width:2px
    style A2 fill:#f9f,stroke:#333,stroke-width:2px

Once an attacker identifies a vulnerability in an exposed API, they can often access sensitive backend systems or exfiltrate data immediately without needing to move laterally or escalate privileges.


Regulatory and Compliance Pressures

Global regulators have recognized the severe risks associated with insecure APIs:

Key Regulations Addressing APIs


The Three Regulatory Challenges

API compliance generally balances three overlapping requirements:

  1. Security: Ensuring that APIs are configured, deployed, and operated securely to prevent unauthorized access.
  2. Privacy: Protecting personal data (GDPR, CCPA, PIPEDA). If APIs handle sensitive user data, they must be included in threat models and risk profiles.
  3. Accessibility: Mandating data portability and open integration (e.g., Open Banking, HIPAA interoperability rules). While laws mandate that organizations expose APIs to share data, they must do so without compromising security.

What’s Next?

In the next section, we will examine the OWASP API Security Top 10 and walk through real-world breach examples to see exactly how these attacks are executed.