Developers Guide To The Owasp Top 10 For Api Security WP
Developers Guide To The Owasp Top 10 For Api Security WP
1
Developer Guide to the 2023 OWASP Top 10 for API Security
Refreshing its inaugural 2019 list, the 2023 API Security Top-10 list highlights the ten most
common and serious security risks created when developing applications that expose or
use APIs . Issues such as Broken Object-Level Authorization, a superset that includes IDOR
vulnerabilities, remains the same from the prior list . Yet, new categories—or reorganized
categories—now highlight issues overlooked in the past, such as Server-Side Request
Forgery (API7:2023) and Unrestricted Access to Sensitive Business Flows (API6:2023) .
2
Developer Guide to the 2023 OWASP Top 10 for API Security
Definitions
API Endpoint—The point of communication between two systems, typically a URL of a
container or server running a microservice . Using an URL, an application or developer
can request information from the server or execute an action on the API server or
microservice .
SOAP/WSDL—An XML-based protocol for creating Web APIs . SOAP is the protocol
itself and WSDL (Web Service Definition Language) is the format used to formally
describe services . Due to the heavy overhead, this API style has become unpopular
for new developments .
REST—A Web API style that involves exchanging messages directly over HTTP, using the
semantics of HTTP URLs and verbs, without using an additional “envelope” . The content
is usually encoded as JSON, although in some cases it is XML .
GraphQL—A query language designed to be used in APIs (with requests and responses
in JSON), together with server-side runtimes to execute these queries . It allows clients
to define the structure of data they need and then receive this from the server in
that format .
gRPC—An API protocol that is more high performant than REST . It uses HTTP/2 and the
performance advantages that offers over HTTP/1 .1 . The format of the individual messages
is usually binary and based on ProtoBuf, again creating performance advantages over
REST and SOAP .
3
Developer Guide to the 2023 OWASP Top 10 for API Security
In an example detailed by OWASP, a platform for online stores could allow access to shop
data using a simple call:
/shops/{shopName}/revenue_data.json
This is insecure because any user can replace the shopName with the name of another user’s
store, gaining access to data they should not have .
In 2021, a security researcher found that the web-application and back-end servers that 10 . Masters, Jan . “Tour de
Peloton: Exposed user
provided data to Peloton exercise bikes had several API endpoints—such as https://api.
data .” Pen Test Partners
onepeloton.co.uk/stats/workouts/details—that allowed unauthenticated users to access Blog . Pen Test Partners .
private data . In February 2021, Peloton implemented a partial fix for the issue, limiting API Web Page . 5 May 2021 .
www.pentestpartners.
access to authenticated users, but still allowing those users to access any private data for com/security-blog/tour-de-
other members . A full fix came in May 2021 .10 peloton-exposed-user-data/ .
4
Developer Guide to the 2023 OWASP Top 10 for API Security
API2:2023—Broken Authentication
What Is It?
Authorization checks limit access to data based on specific roles or users, but those
limitations are not sufficient to protect systems, data, and services . Developers and
application-security teams also must properly implement capabilities to check user identity
through authentication . Despite the critical nature of authentication, the components
are often poorly implemented or improperly used—the root causes of Broken User
Authentication . Broken user authentication allows attackers the ability to assume other
user’s identities temporarily or permanently by exploiting insecure authentication tokens or
compromising implementation flaws .
5
Developer Guide to the 2023 OWASP Top 10 for API Security
In February 2022, a misconfigured cloud storage bucket left 1 GB of sensitive data from email
marketing service Beetle Eye without password protection or encryption . The data included
contact information and tourism-related information collected by various tourist agencies and
US states .12 Misconfigured authentication mechanisms are considered a variant of the Broken
User Authentication category .
Fortify SAST by OpenText allows a wide range of checks relating to poor authentication
as well . The static analysis tool includes detection for generic issues—such as credential
leakage—as well as highly API-specific problems like missing protection claims in JWT
tokens, or claims occurring in JWT headers .
6
Developer Guide to the 2023 OWASP Top 10 for API Security
Attack Examples
In January 2022, a bug bounty program discovered a flaw in Twitter that allowed a user to Fortify SAST helps to
submit an email address or phone number to Twitter’s system, which would then return the prevent both excessive
account name to which the information belonged .14 An unknown attacker used the flaw to data exposure and mass
assignment through data
compile a list of millions of user accounts linked to phone numbers and email addresses .
flow analysis. The system
By allowing anyone to link two properties, Twitter inadvertently allowed pseudonymous will highlight many
users to be more specifically identified . sources of private data,
such as those based
How to Prevent It as a Developer? on variables names or
Developers should always implement proper controls on the ability to access or change particular API calls, and
identify objects that
specific object properties . Rather than return a general data structure with every property—
allow mass assignment.
which often happens with generic methods, such as to_json() and to_string()—programmers
should be very specific in what information they return . As an extra measure of security,
applications should implement schema-based response validation that enforces security
controls on all data returned by API methods . Access should follow least privilege principles,
only allowing access if absolutely necessary . __________
14 . “An incident impacting
How Can Fortify Help? some accounts and private
information on Twitter .”
Fortify SAST helps to prevent both excessive data exposure and mass assignment through
Twitter Privacy Center .
data flow analysis . The system will highlight many sources of private data, such as those based Twitter . Web Page . 5 Aug
on variables names or particular API calls, and identify objects that allow mass assignment . 2022 . https://privacy.
twitter.com/en/blog/2022/
Fortify users may define sources of their own as well, tracking data through the program, an-issue-affecting-some-
and if it ends up in an inappropriate place, alerting the developer or operator of the risk . anonymous-accounts .
7
Developer Guide to the 2023 OWASP Top 10 for API Security
In addition, Fortify SAST has knowledge of the most important JSON and XML serialization
and deserialization mechanisms . Using this, the tool can detect code that does not properly
deserialize the domain transfer objects (DTOs), which could allow mass assignment of its
attributes . Some cases of information exposure and mass assignment can also be detected
using Fortify WebInspect . Finally, some countermeasures can be implemented through
adding rules to the web application firewall (WAF) .
Applications that do
API4:2023—Unrestricted Resource Consumption not limit the resources
assigned to satisfy
a request can be
What Is It? vulnerable, including
APIs expose many useful business functions . To do so, they use computing resources those that fail to restrict
like database servers or may have access to a physical component through operational allocable memory,
technology . Because systems have a finite set of resources to respond to API calls, attackers number of files or
can specially craft requests to create scenarios that result in resource exhaustion, denial of processes accessed,
or the allowed rate
service, or increased business costs . In many cases, attackers can send API requests that tie
of requests, among
up significant resources, overwhelming the machine or bandwidth resources and resulting in other attributes.
a denial-of-service attack . By sending repeated requests from different IP addresses or cloud
instances, attackers can bypass defenses designed to detect suspicious spikes in usage .
The server processing APIs needs to have limits in place to prevent excessive allocation of
memory and workloads, excessive requests for API-triggered operations, or excessive charges
for a third-party service without spending limits .
A common attack is to modify the arguments passed to the API endpoint, such as increasing the
size of the response and requesting millions of database entries, rather than, say, the first ten:
/api/users?page=1&size=1000000
In addition, if the attacker can access a backend service that charges for usage, resource
consumption attacks can be used to run up charges for the application owner . Another
OWASP example points to a reset-password feature that uses an SMS text message to verify
identity and which could be called thousands of times to increase expenses for the victim .
8
Developer Guide to the 2023 OWASP Top 10 for API Security
POST /sms/send_reset_pass_code
Host: willyo.net
{
"phone_number": "6501113434"
}
9
Developer Guide to the 2023 OWASP Top 10 for API Security
Code-level security is not sufficient to address this problem in the application . Resource
exhaustion and rate limiting are specific sub-segments of denial-of-service attacks that
should be mitigated at runtime . Fortify WebInspect can test servers and API functions for
vulnerability to denial-of-service attack without impacting the service . In addition, the very act
of running a DAST scan can stress test an environment enough to show potential resource-
consumption weaknesses .
In an example cited by OWASP, an attacker gains access to the API requests for adding an
invited user to a new mobile application, noting that the invite includes information on the
invitee’s role . Exploiting the weakness, the attacker sends a new invite:
POST /api/invites/new __________
{ 17 . Beeferman, Jason .
"email": "[email protected]", “Personal information of
1 .8 million Texans with
"role":"admin" Department of Insurance
} claims was exposed
for years, audit says .”
This allows them to gain administrative privileges on the system . The Texas Tribune . 17 May
2022 . www.texastribune.
org/2022/05/16/texas-
Attack Examples
insurance-data-breach/ .
In 2022, the Texas Department of Insurance notified the public that information of nearly 18 . Taylor, Josh . “Optus data
2 million Texans had been exposed through a part of the workers’ compensation application that breach: everything we know
so far about what happened .”
inadvertently allowed members of the public to access protected data .17 In a second incident The Guardian . 28 Sep 2022 .
in 2022, Australian telecommunications firm Optus acknowledged that personal and account www.theguardian.com/
information on as many as 10 million Australians had been exposed by an API that did not business/2022/sep/29/
optus-data-breach-
require any authentication or authorization . While Optus called the attack “sophisticated,” everything-we-know-so-
a security researcher familiar with the details of the attack described it as “trivial .”18 far-about-what-happened
10
Developer Guide to the 2023 OWASP Top 10 for API Security
API6:2023—Unrestricted Access to
Sensitive Business Flows
What Is It?
From sneakerbots to ticket bots, attacks on the inventory of online retailers through their
APIs has become a significant problem for e-commerce sites . By understanding the business
model and the application logic, an attacker can create a series of API calls that can
automatically reserve or purchase inventory, thus preventing other, legitimate consumers
from gaining access to the businesses’ products or services . Any API that allows access to
a business process can be used by an attacker to impact the business and falls under the
definition of Unrestricted Access to Sensitive Business Flows.
11
Developer Guide to the 2023 OWASP Top 10 for API Security
Attack Examples
When Taylor Swift tickets went on sale on Ticketmaster in November 2022, 1 .5 million
customers had pre-registered, but more than 14 million requests—including three times as
much bot traffic—swamped the purchasing links and APIs as soon as ticket sales opened .
The site crashed, preventing many customers from purchasing tickets .19
The onslaught of reseller bots resembled those that ruined the launch of the PlayStation 5
Preventing Unrestricted
in November 2020 . Supply-chain issues had already limited supply prior to the launch of the
Access to Sensitive
latest Sony gaming console, but the automated bots made finding available units even harder Business Flows is more
and led to astronomical resale prices . In one e-commerce site’s case, the number of “add to about a holistic approach
cart” transactions grew from an average of 15,000 requests per hour to more than 27 million, to application security
using the store’s API to directly request products by SKU number .20 and less about finding
a specific technology.
Operations teams should also review any APIs designed to be used by other machines,
such as for B2B use cases, and ensure that some defenses are in place to prevent attackers
from exploiting machine-to-machine interactions .
12
Developer Guide to the 2023 OWASP Top 10 for API Security
13
Developer Guide to the 2023 OWASP Top 10 for API Security
The risk of SSRF weaknesses cannot always be completely eliminated, so companies should
closely considered the risk of using calls to external resources .
The API endpoint does not restrict the data stored in the cache, resulting in private
conversations being cached by the web browser . Attackers could retrieve the information
from the browser, exposing the victim’s private messages .
__________
14
Developer Guide to the 2023 OWASP Top 10 for API Security
In 2022, a vulnerability management firm discovered that 12,000 cloud instances hosted on
Amazon Web Services and 10,500 hosted on Azure continued to expose Telnet, a remote
access protocol considered “inappropriate for any internet-based usage today,” according
to a 2022 report .25 The inclusion of unnecessary and insecure features undermines these
security of the APIs and applications .
Fortify SAST scans can check application code for misconfiguration issues . During the static
analysis check, Fortify SAST can evaluate configuration files for security errors, including
__________
those for Docker, Kubernetes, Ansible, Amazon Web Services, CloudFormation, Terraform,
and Azure Resource Manager templates . 25 . Beardsley, Todd . “2022
Cloud Misconfigurations
Report .” Rapid7 . PDF Report .
Configuration errors can also be caught during runtime . Fortify WebInspect allows p . 12 . 20 Apr 2022 .
Accessed through:
DevSecOps teams to regularly test for common security misconfigurations . One of the
www.rapid7.com/blog/
biggest strengths of DAST scanning is that it runs on the application server in a configured post/2022/04/20/2022-
environment, which means that the full environment—application, server, and network— cloud-misconfigurations-
report-a-quick-look-at-the-
are tested all at once, giving the dynamic analysis platform a comprehensive view of the latest-cloud-security-
production environment is configured . breaches-and-attack-trends/ .
15
Developer Guide to the 2023 OWASP Top 10 for API Security
First, a documentation blindspot is when the details of the API’s purpose, functioning, and
versioning are unclear because of a lack of documentation detailing these important attributes .
Second, a data-flow blindspot happens when APIs are used in ways that lack clarity, resulting
in capabilities that should not necessarily be allowed without a strong business justification .
Sharing sensitive data with a third party without security guarantees, lacking visibility of the
end result of a data flow, and failing to map all data flows in chained APIs are all blindspots .
As an example, the OWASP report cites a fictional social network that allows integration with
third-party independent applications . While consent is required from the end user, the social
network does not maintain enough visibility into the data flow to prevent downstream parties
from accessing the data, such as monitoring the activity of not just the user, but their friends .
__________
Attack Examples
26 . Rosenberg, Matthew and
In 2013 and 2014, as many as 300,000 people took an online psychological quiz on the
Dance, Gabriel . “‘You Are
Facebook platform . The company behind the quiz, Cambridge Analytica, not only collected the Product’: Targeted by
information on those users, but their linked friends as well—a population that totaled as Cambridge Analytica on
Facebook .” The New
many as 87 million people, the vast majority of whom gave no permission to have their York Times . News article .
information collected . The company then used the information to tailor ads and messaging to 8 April 2018 . www.nytimes.
those people on behalf of their clients, including sending political ads supporting the Trump com/2018/04/08/us/
facebook-users-data-
campaign in the 2016 election .26 Facebook’s lack of visibility into how third parties used the harvested-cambridge-
information harvested from its platform is an example of improper inventory management . analytica.html .
16
Developer Guide to the 2023 OWASP Top 10 for API Security
17
Developer Guide to the 2023 OWASP Top 10 for API Security
Attack Examples
In December 2021, a set of vulnerabilities in a commonly used open-source software
component, Log4J, allowed an attacker to provide unsanitized input, such as an encoded
script, and use vulnerable versions of Log4J to execute the script on the server . The issue
behind the Log4J vulnerability originated in a lack of input validation, specifically the failure to
conduct security checks on deserialized user-supplied data . By sending serialized malicious
code, attackers could exploit the vulnerability and execute an attack on a server with the
vulnerability . Developers should check all input provided by third-party APIs and other
external sources .27
When receiving data from external users and machines, the inputs should always be sanitized
to prevent the inadvertent execution of code . Finally, for cloud services integrated through __________
APIs, allow lists should be used to lock the address of the integrated solution, rather than 27 . Microsoft Threat Intelligence .
blindly allowing any IP address to call the application’s API . “Guidance for preventing,
detecting, and hunting for
exploitation of the Log4j 2
How Can Fortify Help? vulnerability .” Microsoft . Web
page . Updated: 10 January
By combining the static code and API analysis features of Fortify SAST with the runtime
2022 . www.microsoft.com/
checks of the Fortify WebInspect dynamic application security testing (DAST) suite, en-us/security/blog/
DevSecOps teams can check their application’s use of third-party APIs and test common 2021/12/11/guidance-for-
preventing-detecting-
attack types . To find unsafe APIs, Fortify’s Secure API Manager can build a repository of all APIs and-hunting-for-cve-2021-
called by the system as well as which external applications can use your application’s APIs . 44228-log4j-2-exploitation/ .
18
Developer Guide to the 2023 OWASP Top 10 for API Security
The release of the 2023 OWASP API Security Top 10 list is a good starting point for
companies and developers to educate themselves on the risks of API-based infrastructure
and to assess their own applications . Along with the more well-known Application Security
Top-10 list, the pair of rankings can help DevSecOps teams toward developing a holistic
approach to the overall security of their applications .
DevSecOps teams need to be aware of the security implications of APIs, how to reduce
an implementation’s vulnerabilities and security weaknesses, and how to harden their
development pipeline and the resulting API server to make it more difficult for attackers to
compromise an application through its APIs .
19
Developer Guide to the 2023 OWASP Top 10 for API Security
Where to Go Next
Here are the products mentioned in this document:
• Fortify API Security
• Fortify Static Code Analyzer (SAST)
• Fortify WebInspect (DAST)
• NetIQ Secure API Manager
Additional Resources
• OWASP Top 10 API Security Risks—2023
• Gartner Magic Quadrant fo Application Security Testing
• Fortify Code Security Webinar Series
• Fortify Application Security
20
Connect with Us
www .opentext .com
OpenText Cybersecurity provides comprehensive security solutions for companies and partners of all sizes . From prevention, detection and response to recovery, investigation and compliance,
our unified end-to-end platform helps customers build cyber resilience via a holistic security portfolio . Powered by actionable insights from our real-time and contextual threat intelligence,
OpenText Cybersecurity customers benefit from high efficacy products, a compliant experience and simplified security to help manage business risk .