Application security

All you need to know about API security

James Harrison
James Harrison
Senior Content Writer

Key Points

APIs are certainly not new, but now they’re all around us. Every time you use a rideshare app like Uber, send a Monzo mobile payment, change your Hive thermostat from your phone, or check your iPhone weather app, you’re using an API.  

And securing them has never been more important as they’re a goldmine for personal information for social engineering. In this article, we’ll look at how APIs work and how to use tools like Intruder to monitor and protect your APIs.

What are web APIs?

A web API is an interface between two technical solutions like a Single Page Application and a web server, a mobile application and the backend system, between two containers, between a script that someone writes and the web server – anything that isn’t human interaction. Essentially, they provide a way for different digital applications and systems to communicate with each other, exchanging data and enabling functionalities.  

Today, most modern web APIs are REST APIs and the names are now used interchangeably, but SOAP APIs used to be prominent, and GraphQL APIs are becoming increasingly popular.  

How do APIs work?

Think of the API as the digital plumbing between systems. An application will call on the API to perform an action, which will then in turn process the request or gather information from other sources such as databases.

The API may also do its own processing, and then format the data back to the application to be displayed. Using the Uber example, when you book a ride, the application will send a request to the API asking to book a ride from A to B. The API will then communicate with databases and other systems to find a driver. Once a driver has been found it will create the ride, and finally send the details to the user and driver via the app.

Why API security matters

API security is a hot topic now and the next big thing in attack surface management, especially with the developer and DevOps user base who build their own APIs to enhance automation.  

Reports suggest that 95% of companies have had an API security incident in the past 12 months, with API attack traffic growing by 681%. Another study shows that API vulnerabilities cost businesses up to $75bn annually. And without secure APIs, agile innovation is impossible.

The cost of an API breach

Take the example of the social media platform Parler. It had its data exposed to the world in 2021 due to what Wired called “an absurdly basic bug.” The bug (actually, it was more of a design flaw than a coding bug) was due to a guessable parameter and a lack of authentication to see public posts via Parler’s API.

Because the API allowed third parties to request data without any type of authentication for those requests, malicious actors were able to guess the URLs where user posts were hosted on Parler, then download it without having to log in.

The lesson here is that if you’re going to create an API with IDs within the URL that lets people request data across your app, make sure the ID is non-guessable. Also consider gating the information behind authentication, and whether the API should check if a specific user is authorized to view this data.  

The Parler breach is just one recent example – here are a 5 more high profile API breaches to highlight the need for robust API scanning and security:

Recent API breaches

  • Australian telco Optus suffered a devastating data breach that exposed the details of 11 million customers. The breach occurred through an unprotected and publicly exposed API which didn't require user authentication so anyone that discovered the API on the internet could connect to it without submitting a username or password.
  • Experian suffered a data breach in 2021, with the credit scores of almost everyone in the U.S. exposed through an unprotected API. A security expert discovered that while visiting a lender’s website to check loan eligibility, the code behind the API allowed him to pull up anyone’s credit score without any authentication.
  • In January 2023, T-Mobile reported that a ‘bad actor’ obtained information on millions of its customers through an API earlier. It follows almost half a dozen other hacks into T-Mobile's systems, the most recent costing them at least $400 million.
  • The CVE-2019-5786 bug in the File Reader API in 2019 led to a vulnerability in almost all major browsers; hackers went to town, targeting Chrome users in particular.
  • A server of Hostinger (hosting service provider) was hacked in 2019 allowing attackers to access its internal API and disclose the personal data of its 14 million customers.

Find your weaknesses,
before the hackers do

Try Intruder for free

What are the most common API vulnerabilities?

Web APIs connect services and transfer data, so any breach will let hackers into your systems. Developers are broadly aware of the inherent vulnerabilities with APIs when developing apps – the OWASP API Security Top 10 is recognized by developers as the first step towards more secure coding – but here are 5 of the most common vulnerabilities:

1. Information disclosure

Date disclosure, also known as information leakage, is when an API unintentionally reveals sensitive information to its users such as usernames or financial information.

2. Injection attacks

This type of risk is caused by the injection of malicious code into the API. These attacks can allow hackers to directly steal data from servers or attack other systems within your estate.

3. Broken authentication

Broken or weak authentication allows unauthorized access to resources. Weak passwords, API keys, and other methods can then be used to gain unauthorized access.  

4. Misconfigurations

Security misconfigurations often leave API’s open to attack. Such mistakes can allow attackers to gain access to sensitive data or access privileged actions.  

5. Insecure endpoints

Unsecured endpoints are a major threat to APIs as this makes them vulnerable to broken authorization. So even users could gain access to resources that they should not be able to.

Want to know more? Check out OWASP’s complete API Security Top 10 list or find out more about our OWASP Top 10 vulnerability scanner.

How to protect your APIs

Even if you’re aware of these vulnerabilities, traditional security measures like penetration testing is often only focused on the website front-end and supporting APIs.  

This wasn’t a big deal when APIs were restricted to partner integrations or exposed publicly without whitelisting. But as we’ve seen, APIs are no longer niche: API calls now represent 83% of web traffic and should be the primary focus for securing every web estate. For many organizations, a central API gateway or loose collection of unrelated web APIs may now be its primary interface with customers and partners – and its primary attack surface. Get a feel for how easy it is to protect your APIs with Intruder with our interactive demo.

API security checklist

So, how do you go about securing your APIs? To use another analogy, you don’t keep your savings under the mattress. Most people keep their money in a trusted place (a bank) and use different ways to authorize and authenticate payments. API security is no different; you need a trusted environment with policies for scanning, authentication and authorization:

  1. Use tokens: establish trusted identities and then control access to services and resources by using tokens assigned to those identities.  
  1. Use encryption and signatures: encrypt your data using a method like TLS/SSL and require signatures to make sure that the right users are decrypting and modifying your data, and no one else.
  1. Identify vulnerabilities: regularly update your operating system, network, drivers, and API components. Know how everything works together and scan for weaknesses that could be used to break into your APIs. Automate this with a vulnerability scanner like Intruder to detect security weaknesses and track data leaks.
  1. Use quotas and throttling: place quotas on how often your API can be called, and track use. More calls on an API may indicate that it is being abused. It could also be a programming mistake such as calling the API in an endless loop. Make rules for throttling to protect your APIs from spikes and Denial-of-Service attacks.
  1. Use an API gateway: these act as the major point of enforcement for API traffic and allow you to authenticate traffic as well as control and analyze how APIs are used.

Introducing API scanning from Intruder

Every company has some level of cybersecurity risk, but modern, young companies that rely on APIs to do business are more at risk than most. But existing cybersecurity tools are built for large companies and often hard to use, needing security expertise.  

As a result, security providers are shifting their focus from ‘threat’ to ‘exposure’ management to cover APIs and scan what’s hosted on serverless infrastructure or in the cloud, rather than just focusing on the application layer.

Designed by developers, for developers, Intruder's API scanner is easy to use and always on. It keeps track of your entire tech stack including your API endpoints, showing you where and how you’re vulnerable, while prioritizing what matters most. Get started today with a 14 day free trial or get in touch with us for more information.

Get our free

Ultimate Guide to Vulnerability Scanning

Learn everything you need to get started with vulnerability scanning and how to get the most out of your chosen product with our free PDF guide.

Sign up for your free 14-day trial

7 days free trial