Top 5 Most Common API Vulnerabilities You Should Know About
Tags: cybersecurity, api, devops, programming
Published: 2022-08-30 18:22:50

**Application programming interface (APIs) allows different applications to communicate with each other, exchange data, and react to set commands. They open up applications' to external [third-party](https://www.reflectiz.com/blog/what-is-tprm/) developers, making them easy to integrate, excellent when it comes to automation, and allowing the application to leverage another app's data and functionality.**

**Yet, APIs can quickly turn from a convenient asset to a liability, posing API vulnerabilities to your business.**

From Alexa and Google Assistant to Spotify and Salesforce, APIs have seen a Compound annual growth rate of [32.9%](https://nordicapis.com/20-impressive-api-economy-statistics/#:~:text=API%20Management%20Market%20Valued%20at,by%20Europe%20and%20then%20APAC.) and show no sign of slowing down. Global Internet traffic now totals 7.7 exabytes per day---over 7 billion gigabytes. **APIs account for up to [83%](https://www.akamai.com/newsroom/press-release/state-of-the-internet-security-retail-attacks-and-api-traffic) of this traffic. **

With APIs distributed throughout multi-cloud IT [infrastructures,](https://spectralops.io/blog/developers-guide-to-iac-scanning/) organizations face the **difficult task of adequately securing these interfaces. **

From sensitive data breaches, web scraping, account takeovers, and more, *APIs can quickly turn from a convenient asset to a liability, posing vulnerabilities to your business. *

**How API security works? **
----------------------------

Since APIs are often accessible via the Internet and can be reverse-engineered, it's crucial to take their security seriously. **Important network and application security concepts are just as relevant for APIs as they are for applications and internal network traffic.** Among these critical security considerations are strong access controls, data governance, rate limiting, input validation, and threat detection. 

Malicious actors are likely to find and exploit shortfalls in any aspect of API security. High-profile attacks in recent years have shown that APIs are firmly in the sights of cybercriminals; two examples include:

-   **Ride-sharing app [Uber](https://www.forbes.com/sites/daveywinder/2019/09/12/uber-confirms-account-takeover-vulnerability-found-by-forbes-30-under-30-honoree/)** was found to have two critical security flaws in an API endpoint that exposed personal data belonging to drivers and users. 

-   **Social networking platform LinkedIn** saw [92%](https://www.cpomagazine.com/cyber-security/data-scraping-yields-700-million-linkedin-profiles-for-sale-on-dark-web-about-92-of-platform-users-but-mostly-public-information/) of its 800 million+ users have their data scraped through a public API with insufficient security controls. 

**Top 5 API Vulnerabilities **
------------------------------

Much of the effort to secure APIs should **concentrate on the most common vulnerabilities that consistently lead to breaches, stolen data, and other adverse outcomes, including financial costs to your business.** Let's look at the top five API vulnerabilities, their implications, real-world examples, and mitigation tips. 

### **1\. Weak Authentication**

Authentication verifies that users or devices are who they claim to be. **In some cases, weak authentication means that there is no authentication mechanism in place at all. **

In the more common scenarios, there are misconfigurations or improper settings that weaken authentication, including 

-   **weak password complexity**

-   **high account lockout thresholds**

-   **relying on API keys as the only way to authenticate. **

The potential outcomes of exploiting weak authentication are that outsiders can control user accounts/sessions, steal their data, or engage in fraudulent transactions. A relevant example was the 2021 Experian incident, where a security researcher identified weak authentication that used publicly available information to authenticate users. Hackers could've easily used this information to masquerade as legitimate users and get their credit scores through API calls. 

**Mitigation recommendations:**

-   Enforce strong passwords 

-   Don't rely on API keys to authenticate users

-   Consider multi-factor authentication to strengthen against the possibility of account takeover

### **2\. Security Misconfiguration**

The API ecosystem is a complex interplay of virtual machines, containers, on-premise, and cloud infrastructure. From the specification of each API to its associated infrastructure, there is a wide scope for security misconfigurations within each layer. 

**Misconfigurations include:**

-   **Missing security patches**

-   **Forgetting to encrypt data in motion**

-   **Overly detailed error messages**

-   **Leaving cloud storage buckets open and unsecured**

Security misconfigurations can pose a diverse range of threats, such as [sensitive data](https://www.polar.security/post/how-to-protect-sensitive-data) leaks or compromises of internal systems. In a recent example from 2022, threat actors began targeting misconfigured Docker APIs to run a crypto-mining botnet. 

**Mitigation recommendations:**

-   [Shift security left](https://lightrun.com/debugging/shift-left-testing/) to ensure APIs are tested for vulnerabilities coinciding with DevOps workflows, not at later stages.

-   Set controls over request volumes (rate limiting) so that you can limit DDoS attacks 

-   Periodically assess and review API security configurations, ideally using an accurate and up-to-date inventory of all your APIs

### **3\. Excessive Data Exposure**

**Excessive data exposure occurs when the API responses provide too much information to the client application.** This reliance on the client-side can lead to excessive information being presented to end users. 

Unfortunately, threat actors are privy to these [data exposures](http://www.polar.security/post/sensitive-data-exposure) and can attempt to circumvent the client or analyze traffic to intercept API responses containing excessive information.

Excessive data exposure could **compromise sensitive user information, particularly the kind of personal data protected by compliance regulations for which harsh fines apply.**

In 2019, a computer science student [accessed sensitive transactions](https://techcrunch.com/2019/06/16/millions-venmo-transactions-scraped/) carried out on the services of digital wallet company Venmo. The student found a public API endpoint that was returning transaction data. He quickly compiled a Python script of simple GET requests to download over 100,000 transactions per day without even being authorized.  

** Mitigation tips:**

-   Filter response data at the API level rather than the client level

-   Only provide information in API responses that are strictly necessary for meeting a client's request

-   Carefully control the use cases for transmitting sensitive personal information

### **4\. Broken Object Level Authorization (BOLA)**

[

![](https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F0121a7db-446d-4784-a535-2fd32735140f_300x131.jpeg)

](https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F0121a7db-446d-4784-a535-2fd32735140f_300x131.jpeg)

**BOLA is a simple API vulnerability in that it happens when outsiders tweak the IDs of objects that are listed in API requests.** There is no check in place to determine ownership of those objects. By simply changing the ID in a request, the malicious actors get access to information they shouldn't have. 

The consequences of BOLA include:

-   **Unwanted disclosure of information**

-   **The ability to modify or delete information**

-   **Account takeover**

In the 2019 Uber API breach, one of the critical API security flaws was BOLA; client requests weren't validated, so simply changing a user ID provided access to that user's details.  

** Mitigation tips:**

-   Combine identifiers with a check that the current user can access that resource. 

-   Use random and unpredictable values for IDs rather than easily guessable values.

-   Consider obfuscating resource identifiers altogether. 

### **5\. Injections **

[

![](https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F097b1257-0008-42ae-bfa3-48dc76f44001_300x169.jpeg)

](https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F097b1257-0008-42ae-bfa3-48dc76f44001_300x169.jpeg)

**Injection vulnerabilities allow hackers to send malicious data or commands to an API through user input fields, passing them as parameters or file uploads. **

Attackers use a range of injections, including [Javascript](https://www.reflectiz.com/blog/essential-guide-to-preventing-javascript-injection/), SQL, NoSQL, and OS command lines. When there are injection flaws in the code, such as directly linking client-supplied data to SQL/[NoSQL](https://spectralops.io/blog/nosql-databases/), Javascript queries, or OS commands, the API's interpreter bypasses any security and executes the malicious commands. 

**Mitigation tips:**

-   Use a library to validate data so that the API only allows valid values.

-   Implement JavaScript dependency injection

-   Use automated security solutions that identify anomalous client-side behavior, including unexpected scripts, parameters, or other code injections. 

### **API Vulnerabilities and Security Failures: What To Do Instead**

**Breaches and other serious cyber incidents continue to highlight [API security flaws](https://www.reflectiz.com/blog/common-api-vulnerabilities/).** Despite increasingly widespread recognition of the top API vulnerabilities, the same issues are still causing problems. Part of the reason is that modern CI/CD pipelines and DevOps processes still emphasize development agility over security.

Another cause is the overreliance on legacy perimeter-based security approaches. Unfortunately, these aren't sufficient in infrastructures with highly distributed APIs, cloud services, and containerization. 

**To proactively strengthen API security, consider the following approaches:**

-   **Implement a zero-trust strategy** that removes any implicit trust for users, clients, devices, or services. This strategy requires authentication, authorization, and monitoring at all times.

-   **Decouple user identity from the API's design** through an abstraction method that can facilitate declarative authorization policy and authentication scopes as code.