3.
Agenda
ï OWASP Top 10 API Security Vulnerabilities (2019 and 2023)
ï Open Authorization
ï OpenID Connect
ï Vulnerable API design
ï Vulnerabilities around the API
ï Automating API security testing
4.
OWASP Top 10 API Vulnerabilities (2023)
1. Broken Object Level Authorization
2. Broken Authentication
3. Broken Object Property Level Authorization
4. Unrestricted Resource Consumption
5. Broken Function Level Authorization
6. Server-Side Request Forgery
7. Security Misconfiguration
8. Lack of Protection from Automated Threats
9. Improper Assets Management
10. Unsafe Consumption of APIs
5.
Broken Object Level Authorization (BOLA)
BOLA happens when attackers get access to information that
belongs to other users. This type of attack is commonly done
by manipulating resource URIs on the API. For example, if our
API has a /blog/{blogId} endpoint, an attacker can play with
different IDs to try and get access to different resources (APIs
with predictable IDs, such as integers, are more vulnerable).
7.
Broken Authentication
When user authentication is incorrectly implemented, like weak
passwords or token signatures, weak token validation (such as
lack of signature, expiry date, or audience validation, or
allowing to set âalgâ to ânoneâ), lack rate-limiting on the login
endpoints, and so on.
9.
Broken Object Property Level Authorization
Broken Object Property Level Authorization brings together
two different vulnerabilities from the 2019 edition: âExcessive
Data Exposureâ and âMass Assignmentâ. The main idea is
allowing a malicious user access object properties that they
shouldn't be able to read or change.
12.
Unrestricted Resource Consumption
This vulnerability implies lack of rate-limiting and the inability
to detect malicious activity. Malicious users can exploit this
vulnerability to launch a DDoS attack, to impact the service
providerâs billing, or to perform brute force attacks that bypass
authorization (by launching requests with different tokens and
so on).
14.
Broken Function Level Authorization
Most APIs and applications have a concept of user groups and
functions. Broken Function Level Authorization happens when
a malicious user can bypass the constraints of their user group.
16.
Server-Side Request Forgery
Most APIs and applications have a concept of user groups and
functions. Broken Some APIs allow users to send URLs from
which our service must retrieve a resource (for example to
retrieve a user profile photo), or as part of some configuration
(for example to configure a webhook). A malicious user may
use this feature to include malicious URLs, or to obtain
information from the system.
17.
Security Misconfiguration
Security misconfiguration refers to improper configuration at
any level of the stack, including infrastructure, configuration
management, or application configuration. Some examples are
missing TLS, leaking stack trace in error responses, CORS
misconfiguration, exposing more HTTP methods than are
needed, missing security patches and updates, improperly
configured cloud permissions, etc.
19.
Lack of Protection from Automated Threats
Means malicious users can harm the business model through
the API. It involves knowledge of the underlying business
model behind the API.
21.
Improper Assets Management
This refers to management of API, servers, and resources.
When we roll out a new version of the API, itâs important to
ensure deprecation of the older versions, especially if the
newer versions come with security improvements. Itâs also
important to keep API documentation up to date, as obsolete
documentation makes it difficult to monitor and test the APIs.
We also need to ensure that non-production servers arenât
accessible to unauthorized users.
23.
Unsafe Consumption of APIs
Most APIs use third-party integrations, for example for
authentication and authorization, for mapping and
geolocation, for emailing, and so on. Most of the time, we tend
to trust data that comes from third-party applications, and we
donât subject it to validation and sanitisation. This is a mistake,
since an attacker can inject malicious code into the third-party
application.
24.
Injection (2019)
Injection happens when an attacker injects malicious code
through the API, such as SQL/noSQL injection queries that get
executed in the database, or command injection statements
that get executed in the server. An attacker can leverage any
input field in the API to launch an injection attack, including
URL query and path parameters, request payloads, header
values, field values in a JWT, and so on.
26.
Authentication vs
Authorization
Authentication is the
process of verifying a user
identity, while authorization
is the process of verifying
that they have access to
something.
27.
Open Authorization (OAuth)
OAuth is a standard for access delegation.
ï Resource owner
ï Resource server
ï Client
ï Authorization server
32.
JSON Web Tokens (JWTs)
JSON Web Tokens (JWT, pronounced âJOTâ) are JSON documents that contain
information about a user. We call the properties of a JWT claims. Two types:
ï ID tokens
ï Access tokens
34.
OpenID Connect (OIDC)
OpenID Connect (OIDC) is an open authentication protocol built on top of
OAuth that allows users to authenticate on a website using a third-party
provider.
36.
Vulnerable API design
ï Unbound arrays
ï Leaking objects
ï Free-form strings
ï Integer IDs
ï Exposing server-side properties in user input
ï Flexible schemas with unknown properties
ï Too many IDs
ï Improper pagination
ï Unrestricted filters
ï Very flexible schemas with optional parameters
37.
Vulnerabilities around the API
ï Protect the database
ï Restrict outbound traffic
ï Collect detailed logs and actively monitor them
ï Use a WAF
ï Rate-limit requests
ï Restrict resource consumption
ï Use safe packages and libraries