What Is API Security? OWASP Risks and Best Practices

API security protects APIs from unauthorized access, misuse, and attack. OWASP API Top 10 risks, core controls, shadow API discovery, and testing.
Published on
Wednesday, September 9, 2026
Updated on
September 9, 2026

API security is the practice of protecting application programming interfaces from unauthorized access, misuse, and attack. It covers authentication and authorization on every endpoint, validation of the data flowing through them, rate controls that prevent abuse, and monitoring that catches misuse in progress.

APIs now carry the traffic, business logic, and sensitive data that once sat behind web applications, which moves the security problem with them. An endpoint that returns another customer’s records when the object ID is changed represents a broken authorization decision rather than a software defect, and no firewall signature catches it.

Why API Security Differs From Web Application Security

Traditional application security assumes a human using a browser, with a rendered interface constraining what gets requested. APIs remove that constraint entirely. Every parameter is directly addressable, every endpoint is callable in isolation, and the client is under the attacker’s control.

Failure modes shift accordingly, away from payloads and toward logic. Analysis of API breach incidents during 2025 found that broken authentication accounted for 52% of them, with unsafe consumption of third-party APIs behind a further 27%. Both are logic and trust failures rather than payload-based attacks, which is why signature-matching tools miss them and why authorization design carries more weight in APIs than anywhere else in application security.

Sheer volume compounds the problem in a way web applications never did. A web application has a finite number of pages, while an API estate grows with every microservice, integration, and version, and each addition is another set of endpoints somebody has to inventory and protect.

OWASP API Security Top 10

The industry standard framework for categorizing API risk comes from OWASP. Its API Security Top 10, updated in 2023, supersedes the 2019 edition and remains the current guidance. Three of the ten categories concern authorization failures directly, which reflects where real incidents concentrate.

ID Risk What Goes Wrong
API1 Broken Object Level Authorization (BOLA) An endpoint returns or modifies an object belonging to another user when the identifier is changed
API2 Broken Authentication Weak token handling, credential stuffing exposure, or flawed session logic lets attackers impersonate users
API3 Broken Object Property Level Authorization Responses expose fields the caller has no right to see, or requests write fields the caller has no right to set
API4 Unrestricted Resource Consumption Absent rate limits or quotas allow denial of service and cost-driven abuse
API5 Broken Function Level Authorization Administrative or privileged operations are reachable by ordinary users
API6 Unrestricted Access to Sensitive Business Flows Automation abuses legitimate functionality such as purchasing, booking, or account creation
API7 Server-Side Request Forgery The API fetches a user-supplied URL, letting attackers reach internal services and cloud metadata
API8 Security Misconfiguration Permissive CORS, verbose errors, missing headers, and unpatched components
API9 Improper Inventory Management Undocumented, deprecated, and forgotten endpoints stay live without controls
API10 Unsafe Consumption of APIs Data from third-party APIs is trusted without validation

Anyone working from the 2019 list needs to account for three changes. Excessive Data Exposure and Mass Assignment merged into API3, since both describe property-level authorization failures. SSRF and Unsafe Consumption of APIs joined the list as separate entries. Unrestricted Access to Sensitive Business Flows was added to capture abuse that uses an API exactly as designed, where no vulnerability exists to patch.

How Does API Security Work?

API security works by validating identity, filtering malicious traffic, and enforcing strict access controls to protect API interactions. It ensures that only legitimate, authorized requests reach backend services.

how does api security work

1. Authentication and Authorization

Authentication establishes who is calling, and authorization determines what that caller reaches. OAuth 2.0 handles delegated access, JSON Web Tokens carry claims between parties, API keys identify clients, and mutual TLS provides certificate-based verification on both ends. Authorization is where most API breaches originate, because identity gets checked once at the gateway while object-level permissions go unverified at the endpoint.

2. Request Validation and Traffic Inspection

Schema validation checks that each request matches the structure and data types the API declares, rejecting anything malformed before it reaches business logic. Input sanitization and content-type enforcement close the injection paths that survive schema checks.

3. Runtime Monitoring and Response

Behavioral monitoring establishes what normal traffic looks like per endpoint and per client, then flags deviations such as sequential object ID enumeration, unusual response sizes, or a client suddenly calling endpoints it never touched. Runtime protection blocks those patterns without waiting for a signature.

Core API Security Controls

Enforcement work is split across five control types, and each covers gaps the others leave open.

  • API gateway. Centralizes authentication, routing, and policy enforcement, giving one place to apply controls consistently across services.
  • WAF and API firewall. Filters known malicious request patterns, adding a layer beyond gateway policy for payload-based attacks.
  • Token and certificate controls. OAuth 2.0 scopes, short-lived JWTs with proper signature validation, and mTLS for service-to-service calls.
  • Schema and input validation. Enforcement of the OpenAPI or GraphQL schema on every request, covering headers and hidden fields rather than only visible parameters.
  • Rate limiting, throttling, and quotas. Per-client and per-endpoint limits that constrain enumeration, scraping, and resource exhaustion.

Underneath all five sits the question of how credentials are handled. Keys committed to repositories, tokens embedded in mobile applications, and secrets left in build pipelines hand attackers authenticated access that no gateway policy will question. CloudSEK’s BeVigil team found a working example at a healthcare diagnostic chain, where a publicly accessible JavaScript file exposed API keys, authentication tokens, and undocumented endpoints. Names, addresses, mobile numbers, and medical reports were reachable without authentication, from a file the browser downloads on every page load.

Securing REST, GraphQL, gRPC, and Cloud APIs

Architecture determines which controls matter most, because each API style exposes data and accepts requests differently.

REST APIs

REST exposes resources through predictable URL patterns and standard HTTP methods, which makes object identifiers easy for an attacker to guess and iterate. Resource-level authorization checked on every request, not only at login, is the control that matters most here. Schema validation and per-client rate limits handle the rest.

GraphQL APIs

A single GraphQL endpoint accepts client-defined queries, so traditional endpoint-level controls apply poorly. Authorization has to be enforced at the field and resolver level rather than at the route. Query depth limits, complexity scoring, and disabled introspection in production prevent a single nested query from consuming disproportionate backend resources.

gRPC APIs

gRPC uses binary Protocol Buffers over HTTP/2, which most inspection tooling cannot parse without specific support. Security depends more heavily on mTLS between services and on interceptors that apply authorization consistently, since a WAF sitting in front provides little visibility into the payload.

Cloud Provider APIs

Cloud APIs control infrastructure rather than application data, so an over-permissioned credential grants the ability to create, modify, or delete resources. Identity and access management carries the security model here, with least-privilege roles, signed requests, short-lived credentials, and periodic permission review doing more than any network control. Because a single exposed key undoes all of it, checking whether API keys have already leaked belongs in the same review cycle.

Shadow APIs and Inventory Management

Improper inventory management sits at API9 in the OWASP list because an organization cannot protect endpoints it has not recorded. Shadow APIs are undocumented endpoints deployed outside security review. Zombie APIs are deprecated versions left running after their replacement shipped.

Neither category accumulates through negligence so much as through ordinary delivery pressure. Version rollouts leave old endpoints live for backward compatibility, test and staging APIs get exposed during development and never withdrawn, and teams ship integrations without registering them. Each one runs whatever controls existed when it was deployed, which is in many cases none.

BeVigil scanning surfaced a clear illustration at a major technology service provider, where unauthenticated REST endpoints exposed records for more than 33,000 employees. The endpoints carried no OAuth validation and no API key check, so any HTTP request returned employee names, corporate email addresses, business unit assignments, hardware configurations, and internal project structures. Nothing had to be exploited, because the authorization decision was never implemented.

That case maps to API2 and API9 at the same time. Broken authentication describes the missing control, and improper inventory management describes why nobody noticed, since an endpoint absent from the API register receives no review and appears on no security dashboard.

API Security in Microservices and Cloud Architecture

Distributed architectures multiply the number of API boundaries an organization has to defend. Microservices communicate almost entirely through internal APIs, so every service boundary becomes an authorization decision point and internal traffic can no longer be treated as trusted by default.

Kubernetes environments depend on APIs for cluster operations, which makes network policies and workload identity central rather than optional. Service meshes address the same problem by placing sidecar proxies alongside each service to enforce mutual TLS, identity, and traffic policy uniformly. Applying zero trust principles to internal API calls closes the gap that flat service networks create.

AI and Agentic API Endpoints

AI systems reach the outside world through APIs, which places model-serving endpoints, agent frameworks, and Model Context Protocol servers inside the same attack surface. CloudSEK’s AIVigil team documented a customer running a fully unauthenticated MCP server exposed to the internet, with internal tools callable without credentials. Its URL-fetching utility accepted any scheme, chaining into server-side request forgery against the AWS metadata endpoint, local file inclusion, and exfiltration of live IAM credentials and database secrets.

Agentic endpoints deserve particular scrutiny because they exist to take actions on behalf of a caller. An API that only returns data leaks records when it fails, while an API that executes tools on request hands over capability, which raises the consequence of every missing authorization check.

Boundaries extend further still once third-party APIs enter the picture. Data consumed from an external provider arrives with whatever trust the integrating application grants it, which is what API10 addresses, and a compromised upstream provider becomes an entry path into every organization consuming it.

Testing and Automating API Security

Security testing that runs only before release finds problems too late to fix cheaply. Effective programs move most of it into the pipeline.

  1. Generate and maintain an API specification, since automated testing, schema validation, and inventory all depend on a machine-readable definition of what each endpoint accepts.
  2. Run schema validation and contract tests in the build pipeline, catching endpoints that drift from their declared behavior before deployment.
  3. Add authenticated dynamic scanning against a running instance, because authorization flaws such as BOLA appear only when a real session calls another user’s object.
  4. Fuzz inputs across headers, parameters, and body fields to surface validation and error-handling gaps that structured tests miss.
  5. Scan for exposed secrets in code and build artifacts on every commit, treating a committed key as a live credential rather than a code quality issue.
  6. Run periodic penetration testing focused on business logic, which automated tools cannot evaluate because abuse of intended functionality produces no error.

Finding exposure before an attacker does is the whole point of running these tests. CloudSEK documented a semiconductor manufacturer where exposed API endpoints and leaked authentication tokens were identified ahead of any attacker reaching them, which is the difference between a finding and an incident.

Authorization testing deserves particular attention because it resists automation. A scanner confirms that an endpoint requires a token and cannot know whether that token ought to reach the specific object requested, which is precisely the gap BOLA occupies.

Discovering Exposed APIs Across the External Attack Surface

Inventory gaps are what turn a manageable API estate into an unmanaged one, and the endpoints missing from internal records are the ones exposed without review. CloudSEK BeVigil fingerprints an organization’s internet-facing infrastructure and scans APIs as one of eight monitored surfaces, alongside web applications, mobile applications, cloud, CVE, DNS, SSL, and network exposure.

Scanning from the outside in reaches assets that internal tooling never sees. Endpoints extracted from mobile application binaries, forgotten staging environments, and API keys exposed in public code repositories all sit outside the documented inventory, which is the specific problem external attack surface management addresses. AIVigil extends the same discovery to AI-specific endpoints including MCP servers and model-serving APIs.

Gateway policy, runtime protection, and authorization design remain the enforcement layer. External discovery contributes the inventory those controls depend on, since a gateway protects only the endpoints routed through it.

Frequently Asked Questions

What is the difference between API security and API management?

API management covers publishing, versioning, documentation, and traffic routing. API security covers protecting those APIs from unauthorized access and abuse. Management platforms include some security features without replacing dedicated controls.

Can an API gateway replace dedicated API security tooling?

No. Gateways enforce authentication and rate limits on traffic routed through them. They cannot detect object-level authorization flaws, find shadow endpoints, or catch business logic abuse.

Do internal APIs need the same controls as public APIs?

Yes. Internal APIs are reachable once an attacker gains any foothold, and treating network position as authorization is what enables lateral movement across microservices.

Why is injection not in the OWASP API Security Top 10?

Injection appeared in the 2019 edition and was removed in 2023 because API breach data showed authorization and authentication failures dominating. Injection remains a real risk, ranking lower by prevalence.

How do API keys differ from OAuth tokens?

An API key is a static application identifier with no user context and no expiry. OAuth tokens are short-lived, scoped to specific permissions, and tied to an identity.

How often should APIs be security tested?

Automated schema and contract testing runs on every build. Dynamic authorization scanning runs on each release, and business logic penetration testing on a quarterly or annual cycle.

Building API Security Into the Development Lifecycle

API security fails at the design stage far more than at the deployment stage. Authorization logic decided when an endpoint is written determines whether BOLA exists, and no gateway policy or runtime tool added afterwards changes that decision.

Programs that hold up share three habits. They maintain a live inventory that includes shadow and deprecated endpoints rather than only documented ones. They verify authorization at the object and field level on every request instead of checking identity once at the perimeter. They test authorization behavior continuously, because it is the control that automated scanning is worst at evaluating and that attackers probe first.

Related Posts
Maritime Cybersecurity: Threats, Defenses, and Regulations
Why ships and ports are cyber targets: ransomware, GPS and AIS spoofing, the NotPetya attack on Maersk, IMO and USCG rules, and how the maritime sector defends.
What is CVE Scanner? How CVE Scanning Works
A CVE scanner matches software against the known-vulnerability catalog to find exploitable flaws. How CVE scanning works, CVSS and EPSS scoring, and how to prioritize.
What is Network Scanner? How Network Scanning Works
Network scanner discovers hosts, open ports, and running services across a network. How network scanning works, scan types, port states, tools, and legality.

Start your demo now!

Schedule a Demo
Free 7-day trial
No Commitments
100% value guaranteed

Related Knowledge Base Articles

No items found.