API Security Best Practices Guide
API Security Best Practices Guide
API Security
Compliments
of
Michael Isbitski
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API
Security
Salt Security Special Edition
by Michael Isbitski
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API Security For Dummies®, Salt Security Special Edition
Published by
John Wiley & Sons, Inc.
111 River St.
Hoboken, NJ 07030-5774
[Link]
Copyright © 2022 by John Wiley & Sons, Inc., Hoboken, New Jersey
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any
form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise,
except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without
the prior written permission of the Publisher. Requests to the Publisher for permission should be
addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ
07030, (201) 748-6011, fax (201) 748-6008, or online at [Link]
Trademarks: Wiley, For Dummies, the Dummies Man logo, The Dummies Way, [Link],
Making Everything Easier, and related trade dress are trademarks or registered trademarks of John
Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used
without written permission. Salt Security and the Salt Security logo are trademarks or registered
trademarks of Salt Security, Inc. All other trademarks are the property of their respective owners.
John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
Publisher’s Acknowledgments
For general information on our other products and services, or how to create
a custom For Dummies book for your business or organization, please contact
our Business Development Department in the U.S. at 877-409-4177, contact
info@[Link], or visit [Link]/go/custompub. Some of the
people who helped bring this book to market include the following:
Project Manager: Chad R. Sievers Business Development
Acquisitions Editor: Ashley Coffey Representative: Matt Cox
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Table of Contents
INTRODUCTION................................................................................................ 1
About This Book.................................................................................... 1
Foolish Assumptions............................................................................. 2
Icons Used in This Book........................................................................ 2
Beyond the Book................................................................................... 2
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API5:2019 Broken Function Level Authorization........................ 22
API6:2019 Mass Assignment......................................................... 23
API7:2019 Security Misconfiguration........................................... 24
API8:2019 Injection........................................................................ 24
API9:2019 Improper Assets Management.................................. 25
API10:2019 Insufficient Logging & Monitoring........................... 26
Recognizing Automated Attack Patterns.......................................... 26
Brute forcing, credential stuffing, and account takeover,
oh my!.............................................................................................. 26
The plague of scraping.................................................................. 27
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Introduction
A
pplication programming interfaces (APIs) serve as the
building blocks of modern application architecture and sys-
tem design. They create the on-ramps to the digital world,
keep everyone connected, facilitate business, make digital transfor-
mation possible, and continuously evolve modern computing. In all
your digital activities — across employee business applications,
ecommerce sites, health services, connected cars, banking applica-
tions, home automation, and mobile apps — you’re using APIs. The
fact that APIs enable so much sharing of data and services makes
them prime targets for attackers. Security practitioners must adapt
for the world of APIs so they’re better equipped to secure their
organization’s applications and data.
Introduction 1
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Highlight the technological capabilities you need to secure
APIs throughout their life cycles, including discovery, protec-
tion, and remediation.
»» Present ten prioritized things you can do now to start
securing APIs for your organization.
Foolish Assumptions
Although this book is written primarily for technical readers with
some level of experience in modern computing, everyone can
benefit from the information. I make very few assumptions when
writing about the world of APIs and API security. I assume you’ve
browsed a website or used mobile application in recent years and
are inclined to dig deeper into some inner workings. Knowing
how your digital world functions and is built on the foundations
of APIs is interesting in its own right. And it’s also enlightening
as to how the digital world can be threatened by malicious actors.
This icon indicates that the information is useful and can save
time for a given activity.
When you see this icon, make sure you read and understand the
surrounding text. The tidbit points out important information
that’s worth reiterating.
This icon alerts you to a potential issue or pitfall. I point out where
others have made mistakes in the hopes that it saves you time and
spares some heartburn.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THIS CHAPTER
»» Taking a closer look at what APIs are
Chapter 1
Understanding APIs
I
f you’re looking for a primer and background on APIs, you’ve
landed on the right chapter. Here I arrive at a working defini-
tion of application programming interface (API), particularly as
it relates to the Internet and web design. I cover some resulting
impacts of APIs to modern application and cloud-native design.
Defining APIs
Understanding API consumer types and API protocols is key to
selecting the most effective security techniques and controls
available to you. Application programming interfaces (APIs) are
sometimes used as a synonym for functions or libraries refer-
enced regularly in code. For example, web APIs are a specific type
of API designed for use in web designs and communications. Web
API design patterns have existed for more than 20 years, emerging
from service-oriented architecture (SOA) and back-end services
powering applications via web protocols. The following sections
discuss in greater detail the types of APIs and how APIs work.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
The range of API types has evolved substantially over the years to
account for different business cases and usage models. Some of
the common API types include the following:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Identifying API protocols
API protocols impact choices around architecture, testing tools,
and runtime security controls. Protocols are also sometimes
intertwined with API schema definitions, which you must account
for as part of API documentation. Chapter 2 covers API documen-
tation and schema.
For now, think of the API protocol as the means for how you com-
municate with an API, whereas the API schema defines what data
should look like in those communications or what functionality
is available.
Here are some of the most common API protocols you’re likely
to see:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Simple object access protocol (SOAP): SOAP APIs are still
seen in some internal APIs and business applications.
However, SOAP API implementations are often viewed as too
heavyweight and have largely been supplanted by REST API
design.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Considering impacts from
microservices architecture
In some cases, the terms microservices and APIs are used inter-
changeably. However, to help you better understand, keep in
mind the following words and definitions:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Altering the API picture:
Cloud-native’s role
Cloud-native has a few meanings depending what IT circle you sit
in. The broadest definition is that a design or architecture exhibits
cloud traits and makes use of technologies that power cloud ser-
vice providers. Common cloud traits include web scale capacity and
elasticity, where the compute you need to run an application or
service is almost infinite, bound only by the available hardware in
a cloud provider’s data centers that is largely abstracted from you.
Cloud-native maps to the world of APIs in a few ways, but the two
most common are as follows:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THIS CHAPTER
»» Identifying problems with API
documentation and analysis
Chapter 2
Laying the Foundations
for API Security
T
raditional approaches to securing APIs are numerous,
including testing and mediation. This chapter examines
these approaches in greater detail.
Documenting APIs
API documentation serves a range of security and nonsecurity
purposes throughout the API life cycle. Documentation gives your
organization a couple of primary advantages:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Document APIs that you build and use that data to feed an API
inventory or catalog. Include third-party APIs where adequate
documentation is provided by the supplier. Mitigate gaps in your
API inventory by continuously scanning environments and ana-
lyzing traffic to discover new API endpoints and functions.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
definitions in the corresponding code repository (such as git) or
package manager (such as npm) you obtain them from.
Testing APIs
A specific focus within shift-left API security practices is
securing the build pipeline, which requires that teams get security
tooling plugged into continuous integration/continuous delivery
(CI/CD) build pipelines and git-based developer workflows.
Securing build pipelines requires a range of security-testing
tools including dependency analyzers, static analyzers, dynamic
analyzers, schema validators, fuzzers, and vulnerability scanners.
The type of security tooling that is needed varies based on what
artifacts are moving through the pipeline, what must be built, and
where must it be delivered.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
to your organization. As a result, the code that represents your
business logic rarely follows well-defined patterns where SAST or
DAST signatures can be built accordingly.
DAST tools are notorious for running for extended periods of time
for complex applications. Budget time accordingly for build pipe-
line scans to complete or make scans nonblocking so as not to
hold up releases.
SAST and DAST have always had their shortcomings. The prob-
lem is worsened in the world of APIs. Yes, you should run them
against your custom application and API code, but acknowledge
that these scanners aren’t designed to detect all types of issues.
The importance of behavior analysis in runtime for APIs can’t be
stressed enough (refer to Chapter 4 for more details).
However, you should be aware of a few issues that exist with the
schema validation approach:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Many organizations are lackluster at documenting.
Humans are notoriously bad at documenting and especially
documenting everything fully. A lack of documentation isn’t a
problem specific to developers. OAS can help in that it’s
self-documenting, but it still requires manual effort. Some
tooling may also be better at generating the OAS definition
than others.
»» API drift happens as a matter of course. Deviations from
the original specification and what is running in production
are common. API drift parallels one of the biggest problems
that organizations run into with secure design review and
threat modeling processes. Sometimes what you intend to
build ends up looking much different than the real-world
product.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
is critical to API security so you’re seeing all traffic, are able to
enforce as appropriate, and remediate quickly. The actual selec-
tion of a particular mediation mechanism or the point in an archi-
tecture where you’d elect to proxy API traffic is beyond the scope
of this book.
Business drivers and use cases will drive adoption of both proxy
deployment types. Mediation provides a wide range of benefits
including improved visibility, accelerated delivery, increased
operational flexibility, and improved enforcement capabilities,
particularly when it comes to API access control. Expect to see
both forward and reverse proxies in any given architecture. Prox-
ies are an area of API practice that quickly get into the realm of
infrastructure and operations, network engineering, and enter-
prise architecture rather than application development.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
they’re responsible for routing requests dynamically
between servers and services to balance network load.
»» Application delivery controllers (ADC): Application delivery
controllers (ADC) are like their NLB counterparts, though they
typically include more functionality focused on application-
specific routing, load-balancing, and caching. In some cases,
ADC and NLB are interchangeable and can just be a matter
of vendor language.
»» API gateways: API gateways are designed specifically for
mediating API traffic. They can also help with message
translation and bridging between different protocols for
inner and outer architecture.
»» API management (APIM): API management (APIM) suites
provide full life cycle capabilities on top of API gateways
alone. They typically enable an organization to unify policies
across gateways and API endpoints, provide rolled-up
monitoring, and enable developer or partner self-service.
APIM still relies on API gateways as a mediating proxy
mechanism to enable their functionality and enforce policies.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Authentication and authorization: Organizations often
enforce access control at API gateways so that API calls are
authenticated and authorized. Common protocols include
OIDC for authentication and OAuth2 for authorization.
Token translation is usually offered as well, such as where
an API implementation requires integration with older
protocols like security assertion markup language (SAML).
»» Basic threat protection: By design, the mediation
echanisms already offer message filtering and protocol
m
translation. Many APIM offerings provide basic rules to
block malicious character sets commonly used in injection
attacks. The other threat protection capability includes
restricting incoming API requests based on API schema
definitions or manual configuration. Restrictions can be
placed on parameter lengths, parameter values, array sizes,
and more.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THIS CHAPTER
»» Differentiating between API attacks
and application attacks
Chapter 3
Getting the Lowdown
on API Attacks
T
his chapter clarifies in plain English how API attacks differ
from application attacks. You also can read more about the
OWASP API Security Top 10, which is a good starting point
for understanding common API flaws. This chapter also covers
automated attack patterns like brute forcing, credential stuffing,
and scraping that almost always target APIs specifically.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Developers may lack expertise in infrastructure and security con-
cepts, which inevitably results in gaps in API security.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Attackers know this reality of distributed architectures and sup-
plier integrations, and they often target the weakest link. In fact,
attackers commonly exploit a weakness in an API as an initial
attack vector and then pivot to other networks, servers, work-
loads, applications, and APIs. These multistep attack sequences
often evade traditional security controls. The realities of API eco-
systems further emphasize the need for runtime behavior analy-
sis to detect novel exploits. Chapter 4 dives deeper into behavior
analysis and runtime protection.
The sphere of concern over APIs shouldn’t begin and end with
the OWASP API Security Top 10. Attackers chain together exploits
of flaws described in the OWASP API Security Top 10. They also
employ automation to increase their chances of success and cause
greater damage. For example, excessive data exposure and broken
authentication leave an API susceptible to automated attacks such
as enumeration and scraping. APIs designed in such a way are
sometimes referred to as leaky APIs.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API1:2019 Broken Object Level
Authorization
Object level authorization is an access control mechanism used to
validate an API caller’s ability to access a given object. Even if
an application implements proper authorization checks in infra-
structure, developers often forget to apply these checks before
allowing access.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Improper or misconfigured authentication: The mecha-
nism is used or implemented without considering the attack
vectors, or the mechanism isn’t appropriate for the use case.
For example, an authentication mechanism designed for IoT
devices typically isn’t the right choice for a web application
like an ecommerce site.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API4:2019 Lack of Resources &
Rate Limiting
API requests consume back-end resources such as network, CPU,
memory, and storage. APIs don’t always impose restrictions on
the size or number of resources that can be requested by the cli-
ent or user. Lack of rate and resource limiting doesn’t just poten-
tially impact performance of back-end compute though. Lack of
limiting also opens the door to many types of attacks including
Denial of Service (DoS), brute-forcing, enumeration, and creden-
tial stuffing.
Here is a closer look at how attackers exploit APIs that lack limits:
Attackers discover BFLA flaws because API calls are structured and
predictable. Finding vulnerable API endpoints is possible in the
absence of API documentation or schema definitions by reverse
engineering client-side code and intercepting application traffic.
Some API endpoints might also be exposed to regular, nonprivi-
leged users making BFLA flaws easier for attackers to discover.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Attackers exploit BFLA flaws by sending legitimate API requests
to an API endpoint that they shouldn’t have access to, or by inter-
cepting and manipulating API requests originating from client
applications. For example, attackers may change an HTTP method
from GET to PUT. Alternatively, attackers may also alter a query
parameter or message body variable such as changing the string
“users” to “admins.” Attackers exploit BFLA flaws to gain access
to unauthorized resources, take over other accounts, modify
accounts, or escalate privileges.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API7:2019 Security Misconfiguration
Security misconfigurations include insecure default configu-
rations, incomplete configurations, open cloud storage, mis-
configured HTTP headers, unnecessary HTTP methods, overly
permissive cross-origin resource sharing (CORS) policies, and
verbose error messages.
API8:2019 Injection
Injection flaws are common in the web application space, and they
also carry over to web APIs. Structured Query Language (SQL)
injection, or SQLi, is one of the most well-known types of injec-
tion flaws. Other varieties of injection flaws impact a range of
interpreters and parsers beyond just SQL including Lightweight
Directory Access Protocol (LDAP), NoSQL, operating system (OS)
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
commands, Extensible Markup Language (XML), and object-
relational mapping (ORM).
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API10:2019 Insufficient Logging &
Monitoring
Insufficient logging and monitoring of APIs enables attackers to
perform reconnaissance, abuse business logic, compromise sys-
tems, maintain persistence, and move laterally across environ-
ments without being detected. The longer attackers dwell or are
present in an environment, the higher the likelihood the attack
will result in a breach, brand or reputation damage, or some other
negative impact.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
STOPPING CREDENTIAL STUFFING
ATTACKS
Finastra, a leading FinTech platform provider, frequently defends
against credential stuffing attacks, with hackers automating account
ID info in an effort to succeed at account takeover. The Finastra team
has deployed API security from Salt Security to automatically detect
and block these attacks, which otherwise easily pass through the com-
pany’s WAFs and API gateways.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
design flaws all apply to a given API endpoint, you end up with a
leaky API that may inadvertently expose sensitive or private data.
It’s trivial for attackers to enumerate API endpoints and scrape
data en masse using even basic scripts.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THIS CHAPTER
»» Acknowledging the importance of
architecture
»» Remediating APIs
Chapter 4
Securing APIs
T
raditional approaches can be beneficial to API observability
and monitoring, and they also have usefulness for some
aspects of security. However, a new approach is needed to
protect APIs throughout their life cycles.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THEIR OWN WORDS
“Architecture is essential to effective API security. Only platforms with
the ability to capture and analyze all your API traffic can create the
context needed for full protection. You need a rich data engine and
time-proven AI and ML algorithms to identify APIs and their exposed
data, find and stop attackers, and distill the remediation details
needed to harden vulnerable APIs.”
— Curtis Simpson, CISO, Armis
Focusing on architecture
Any API security tooling you consider for your organization
should be built as a platform of capabilities. API security strategy
demands a full life cycle approach because security issues, vul-
nerabilities, logic flaws, and misconfigurations arise at different
stages of API design, development, delivery, and operation.
API security tooling should leverage Big Data to collect and store
large amounts of API telemetry, correlate API traffic, provide con-
text, and power fast attack detection and response. The tooling
should also use AI/ML to continuously extract useful, actionable
signals for IT teams. Time-in-market is another key considera-
tion because algorithms improve over time through training and
data sets are enriched by the network effect, with more users and
API calls.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Key architecture attributes that API security tooling should exhibit
include the following:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Evolving Your Catalog: A Continuous
Discovery of APIs
Your API catalog will continuously evolve due to API develop-
ment, API integration, and third-party API dependencies. DevOps
practices also complicate matters with increased release velocity.
You must continuously identify API endpoints and parameters,
classify sensitive data they expose, and catalog your APIs to drive
other API security activities.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Identify zombie APIs. API security tooling should identify
zombie APIs, which are outdated or deprecated APIs. Old
versions and old code of APIs often linger when building or
operating APIs at scale. Zombie endpoints can contain buggy
or vulnerable code, may expose excessive data or functional-
ity, may no longer be monitored, and may lack other
production mitigations.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
A common threat protection approach is to front-end API medi-
ation points with additional proxies such as next-generation
firewalls (NGFW) or WAFs. Such an approach adds latency and
provides minimal to no added protection beyond the message
inspection capabilities of most API gateways. Corresponding rules
aren’t designed for unique API business logic, and these mecha-
nisms can’t provide full context.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
security posture. Tooling should exhibit traits of user and
entity behavior analytics (UEBA) to detect a wide range of API
abuses and automated attacks where API consumption
patterns deviate from baselines.
»» Early attacker identification: API security tooling should
continuously detect API attacks early and quickly. Attackers
go through an early reconnaissance phase as they passively
and stealthily probe API targets. These passive analysis
techniques evade most detections because they typically
appear as legitimate traffic. API security tooling should
detect subtle variations in API consumption patterns that
result from automation scripts and reverse engineering tools
employed by attackers.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
exposes an API where authentication and authorization are
required. Even in cases where additional authentication
factors are used, attackers combine techniques to overcome
strong access controls.
»» Stop application-layer denial of service (DoS) attacks. API
security tooling should stop application-layer DoS attacks.
DoS and distributed DoS (DDoS) are often viewed from the
lens of excessive traffic or request rates, or volumetric
attacks. The more nefarious and stealthy form of DoS is
application-layer DoS, or layer 7 DoS. Application-layer DoS is
more difficult to stop because of application and API
uniqueness. Ensure that the security tooling doesn’t stop at
layer 3 and 4 DoS. Tooling should also cover layer 7 DoS and
for APIs specifically.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
Naming remediation capabilities
you need
Organizations frequently wrestle with common vulnerabili-
ties and exposures (CVE) IDs, often generated from vulnerabil-
ity scanning. However, design flaws, software weaknesses, and
business logic flaws don’t map neatly to CVE IDs. With respect to
API security, you need to seek remediation capabilities that can
check for a wide spectrum of API-related flaws, vulnerabilities,
and infrastructure misconfigurations. These remediation capa-
bilities should work continuously for the full life cycle of APIs in
development, build, and runtime phases.
A security fix may not always be code level, because it may not be
technically possible to fix a problem in code, it may not be feasible
to produce a code fix in a timely manner, or it’s more practical to
mitigate through other infrastructure components. Here are API
remediation capabilities you need:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Code repository and pipeline integration: API security
tooling should provide mechanisms to integrate with
development, build, and release systems. Integration may be
through VCS integration to statically analyze API code or
schema definitions. Integration may also be through CI/CD
integration to dynamically analyze APIs in runtime in
preproduction or production environments.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
crucial for building and operating secure APIs. The following sec-
tions detail a range of API security best practices you should con-
sider adopting.
Security testing
Traditional scanning technologies struggle with parsing custom-
developed code and business logic because design patterns and
coding practices vary per developer. Use traditional security test-
ing tools to verify certain elements of an API implementation such
as well-known misconfigurations, vulnerabilities, and exploit-
able conditions, but you must operate these tools with awareness
of the limitations. Testing best practices include the following:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
API mediation and architecture
API mediation provides for improved visibility, accelerated deliv-
ery, increased operational flexibility, and improved enforcement
capability. The latter is often used to enforce API access control.
An organization can commonly achieve mediation by deploying
API gateways and microgateways that function as reverse prox-
ies, forward proxies, or both. The following are mediation best
practices:
Network security
Traditional network perimeters erode as organizations move
toward highly distributed APIs and cloud services. Infrastructure
becomes more ephemeral, virtualized, and containerized. Con-
sequently, this evolution makes some traditional network access
control approaches ineffective. Modernized network security
begins to heavily intersect with identity and access management
(IAM), or “identity as the perimeter.” The following are network
security best practices:
Data security
Appropriate techniques for securing data include masking,
tokenizing, or encrypting. Many data security efforts focus on
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
securing data at rest in a back-end system, such as database
encryption or field-level encryption. These encryption approaches
don’t protect your data in cases where attackers obtain a creden-
tial or authorized session because the data will be decrypted for
them when accessed through an API. Data security best practices
include the following:
Runtime protection
Runtime protection, sometimes referred to as threat protection,
is often delivered through proxies like API gateways and WAFs.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
These mechanisms rely on message filters and static signatures,
which can catch some types of attacks that follow well-defined
patterns but miss most forms of API abuse. Runtime protections
are useful for identifying misconfigurations in API infrastructure
as well as behavior anomalies like credential stuffing, brute forc-
ing, or scraping attempts by attackers. Runtime protection best
practices include the following:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
IN THIS CHAPTER
»» Designating security leads and forming a
strategy
Chapter 5
Ten Things You Can Do
Now to Secure APIs
N
ot sure about what you can do to secure APIs in your
organization? What follows is a list of ten high-priority
items you should focus on to identify and protect your APIs:
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
»» Define API remediation process. As you discover, test, and
protect APIs, you’ll inevitably find code-level flaws or
misconfigurations that leave APIs vulnerable. Formalize your
remediation steps that also help power feedback loops
critical in DevOps. Remediation often requires a mix of roles
and can also include third parties.
»» Establish an API inventory. Build an initial API inventory
and plan to maintain it as your API landscape evolves. Your
API inventory is more than what is contained in asset
management databases or API management. You’ll need
discovery mechanisms that can identify API endpoints,
gather metadata, and classify potentially exposed data types.
»» Identify shadow and zombie APIs. API inventory and API
schema definitions will only carry you so far. You’ll need to
scan on-premises and cloud environments continuously for
shadow (undocumented) and zombie (outdated) APIs. These
APIs present a significant security risk and are quickly
uncovered by attackers.
»» Classify data types in APIs. API discovery is useful for
prioritizing where to place security controls or where to
monitor more heavily, and for identifying and classifying
potential data exposures. Data may be classified as sensitive
or private depending on regulation. This form of API-specific
data classification is critical for governance, risk, compliance,
and privacy initiatives.
»» Analyze API schema and code. Scanning for flaws early and
prior to production delivery is promoted as part of security best
practice. Such an approach can save IT cycles and reduce the
likelihood that an attacker will find exploitable conditions.
Continuously analyze API schema, scan code during build phases,
and/or scan deployed APIs in runtime for exploitable conditions.
»» Skill up on modern architecture. Understanding distinctions
between monolith and microservices, inner and outer APIs, and
cloud-native design patterns is useful for determining where
best to discover, mediate, and protect APIs. Your security
approach can’t rely on controlling a network perimeter,
because in modern architectures the perimeter has eroded.
»» Work toward a holistic API security strategy. Expand your
application security program (if you have one) to include network
and infrastructure elements. Establish a regular cadence with
security and development teams to review API roadmaps, best
practices, and issues. Document, iterate, and improve over time.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
These materials are © 2022 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited.
WILEY END USER LICENSE AGREEMENT
Go to [Link]/go/eula to access Wiley’s ebook EULA.