Blog
Application security

All you need to know about API security

James Harrison
Author
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
APIs are everywhere and agile innovation isn't possible unless they're secure.
back to BLOG

All you need to know about API security

James Harrison

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.

Release Date
Level of Ideal
Comments
Before CVE details are published
🥳
Limited public information is available about the vulnerability.

Red teamers, security researchers, detection engineers, threat actors have to actively research type of vulnerability, location in vulnerable software and build an associated exploit.

Tenable release checks for 47.43% of the CVEs they cover in this window, and Greenbone release 32.96%.
Day of CVE publish
😊
Vulnerability information is publicly accessible.

Red teamers, security researchers, detection engineers and threat actors now have access to some of the information they were previously having to hunt themselves, speeding up potential exploit creation.

Tenable release checks for 17.12% of the CVEs they cover in this window, and Greenbone release 17.69%.
First week since CVE publish
😐
Vulnerability information has been publicly available for up to 1 week.

The likelihood that exploitation in the wild is going to be happening is steadily increasing.

Tenable release checks for 10.9% of the CVEs they cover in this window, and Greenbone release 20.69%.
Between 1 week and 1 month since CVE publish
🥺
Vulnerability information has been publicly available for up to 1 month, and some very clever people have had time to craft an exploit.

We’re starting to lose some of the benefit of rapid, automated vulnerability detection.

Tenable release checks for 9.58% of the CVEs they cover in this window, and Greenbone release 12.43%.
After 1 month since CVE publish
😨
Information has been publicly available for more than 31 days.

Any detection released a month after the details are publicly available is decreasing in value for me.

Tenable release checks for 14.97% of the CVEs they cover over a month after the CVE details have been published, and Greenbone release 16.23%.

With this information in mind, I wanted to check what is the delay for both Tenable and Greenbone to release a detection for their scanners. The following section will focus on vulnerabilities which:

  • Have CVSSv2 rating of 10
  • Are exploitable over the network
  • Require no user interaction

These are the ones where an attacker can point their exploit code at your vulnerable system and gain unauthorised access.

We’ve seen previously that Tenable have remote checks for 643 critical vulnerabilities, and OpenVAS have remote checks for 450 critical vulnerabilities. Tenable release remote checks for critical vulnerabilities within 1 month of the details being made public 58.4% of the time, but Greenbone release their checks within 1 month 76.8% of the time. So, even though OpenVAS has fewer checks for those critical vulnerabilities, you are more likely to get them within 1 month of the details being made public. Let’s break that down further.

In Figure 10 we can see the absolute number of remote checks released on a given day after a CVE for a critical vulnerability has been published. What you can immediately see is that both Tenable and OpenVAS release the majority of their checks on or before the CVE details are made public; Tenable have released checks for 247 CVEs, and OpenVAS have released checks for 144 CVEs. Then since 2010 Tenable have remote released checks for 147 critical CVEs and OpenVAS 79 critical CVEs on the same day as the vulnerability details were published. The number of vulnerabilities then drops off across the first week and drops further after 1 week, as we would hope for in an efficient time-to-release scenario.

Figure 10: Absolute numbers of critical CVEs with a remote check release date from the date a CVE is published

While raw numbers are good, Tenable have a larger number of checks available so it could be unfair to go on raw numbers alone. It’s potentially more important to understand the likelihood that OpenVAS or Tenable will release a check of a vulnerability on any given day after a CVE for a critical vulnerability is released. In Figure 11 we can see that Tenable release 61% their checks on or before the date that a CVE is published, and OpenVAS release a shade under 50% of their checks on or before the day that a CVE is published.

Figure 11: Percentage chance of delay for critical vulnerabilities

So, since 2010 Tenable has more frequently released their checks before or on the same day as the CVE details have been published for critical vulnerabilities. While Tenable is leading at this point, Greenbone’s community feed still gets a considerable percentage of their checks out on or before day 0.

I thought I’d go another step further and try and see if I could identify any trend in each organisations release delay, are they getting better year-on-year or are their releases getting later? In Figure 12 I’ve taken the mean delay for critical vulnerabilities per year and plotted them. The mean as a metric is particularly influenced by outliers in a data set, so I expected some wackiness and limited the mean to only checks released 180 days prior to a CVE being published and 31 days after a CVE being published. These seem to me like reasonable limits, as anything greater than 6 months prior to CVE details being released is potentially a quirk of the check details and anything after a 1-month delay is less important for us.

What can we take away from Figure 12?

  • We can see that between 2011 and 2014 Greenbone’s release delay was better than that of Tenable, by between 5 and 10 days.
  • In 2015 things reverse and for 3 years Tenable is considerably ahead of Greenbone by a matter of weeks.
  • But, then in 2019 things get much closer and Greenbone seem to be releasing on average about a day earlier than Tenable.
  • For both the trendline over an 11-year period is very close, with Tenable marginally beating Greenbone.
  • We have yet to have any data for 2021 for OpenVAS checks for critical show-stopper CVEs.
Figure 12: Release delay year-on-year (lower is better)

With the larger number of checks, and still being able to release a greater percentage of their remote checks for critical vulnerabilities Tenable could win this category. However, the delay time from 2019 and 2020 going to OpenVAS, and the trend lines being so close, I am going to declare this one a tie. It’s a tie.

The takeaway from this is that both vendors are getting their checks out the majority of the time either before the CVE details are published or on the day the details are published. This is overwhelmingly positive for both scanning solutions. Over time both also appear to be releasing remote checks for critical vulnerabilities more quickly.

Written by

James Harrison

Recommended articles

Ready to get started with your 14-day trial?
try for free