Why Improper Asset Management Threatens Your APIs and How to Fix It

April 24, 2024
min to read

What Is Improper Asset Management?

Improper asset management in the context of APIs refers to the inadequate handling, tracking, and safeguarding of API-related resources, including the APIs themselves, their documentation, and the servers they interact with. Most commonly, outdated APIs are forgotten by developers, and attackers can exploit them because they are unpatched or don’t have basic security measures in place.

The consequences of such mismanagement may include security vulnerabilities, inefficiencies in API utilization, and potential data breaches. Proper asset management is therefore critical to maintaining the integrity, availability, and confidentiality of API services.

Improper asset management is listed in the Open Web Application Security (OWASP) list of top 10 API security vulnerabilities for 2023, ranked #9 in order of severity.

How Do Improper Asset Management Flaws Affect APIs?

Improper asset management flaws can severely impact APIs by exposing them to unauthorized access and cyber-attacks. Without accurate tracking and control of API assets, organizations may inadvertently leave old, deprecated, or experimental APIs accessible online, becoming prime targets for attackers. 

These flaws can lead to data leakage, service disruption, and compromise of backend systems. inefficient management practices may also result in wasted resources and increased maintenance costs, affecting the overall quality of service and user experience.

What Does Improper Inventory Management Look Like?

Here are some examples of common asset management issues.

Forgotten API Endpoints

Forgotten API endpoints refer to API interfaces left behind unintentionally. These are often remnants of development projects, experimental features, or deprecated endpoints that were not properly decommissioned. 

Forgotten API endpoints pose a significant security risk because they are not monitored and typically unprotected by standard security measures. Attackers can exploit them to gain unauthorized access, extract sensitive data, or inject malicious code, leading to potential breaches and data loss.

Shadow APIs

Shadow APIs are APIs that are deployed or used without the explicit approval or knowledge of an organization's IT or security teams. These APIs often emerge when developers or teams bypass standard development and deployment protocols to meet project deadlines or experiment with new features. While shadow APIs can sometimes accelerate development and innovation, they lack the necessary security measures and oversight, making them vulnerable to attacks.

One significant challenge with shadow APIs is their invisibility to security teams. Since these APIs are not part of the official inventory, they do not undergo regular security assessments or compliance checks. This oversight can lead to critical vulnerabilities being overlooked. Additionally, because shadow APIs are not documented or known to the IT department, they are not considered in the organization's security architecture, resulting in gaps that attackers can exploit.

Shadow Parameters

Shadow parameters are undocumented or hidden parameters within an API that can be manipulated to alter the behavior of the API. These parameters may have been used during testing phases or left in accidentally by developers. 

Unlike standard parameters, shadow parameters are not included in official documentation, making them invisible to security audits and controls. This obscurity allows attackers to experiment with these parameters, potentially uncovering vulnerabilities that can lead to unauthorized data access, data manipulation, or full-scale API exploitation.

Parameter Definition Discrepancies

Parameter definition discrepancies occur when there is a mismatch between the documented behavior of an API parameter and its actual functionality or when updates to the API lead to changes that are not reflected in the documentation. These discrepancies can create confusion among developers and users, leading to improper API calls or unexpected outcomes. 

More critically, discrepancies can be exploited by attackers who leverage the misunderstanding or lack of clarity to manipulate the API in unintended ways. This allows them to bypass security controls or access restricted data.

Example Attack Scenarios for Improper Asset Management

Let’s look at two examples of attacks that exploit inadequate asset management. These are adapted from the official OWASP cheat sheet.

Scenario #1: Unprotected Legacy API

Consider a local service that underwent a redesign but neglected to secure or decommission an outdated API version. The old version, identified as api.localservice.com/v1, remained operational and continued to provide unrestricted access to an internal database. 

An attacker, initially targeting the service's most recent application version (api.localservice.com/v2), discovers the older API by simply altering the version number in the URL to v1. By manipulating the old API, the attacker can now retrieve sensitive data from the production database.

Scenario #2: Beta API Without Rate-Limiting

This scenario highlights the dangers of inconsistent security measures across API versions. Consider a high-traffic website that implements a rate-limiting mechanism to prevent brute-force attacks on password resets. However, this mechanism was applied externally to the main API (api.hightraffic.com) and not integrated within the API's code. 

A new beta version of the API (api2-beta.hightraffic.com), intended for testing, lacked this crucial rate-limiting protection but was accessible by attackers. An attacker accesses this beta API, which uses the same production server, and is able to perform a brute-force attack to identify and steal user credentials. 

5 Ways to Prevent Improper Asset Management Vulnerabilities

Here are some useful practices for ensuring proper asset management.

1. Focus on Inventory Management

Effective inventory management involves creating and maintaining a detailed record of all API assets, including live, deprecated, and experimental APIs, their locations, and their dependencies. This inventory should be dynamic, reflecting real-time changes in the API ecosystem to ensure that every API, regardless of its stage in the lifecycle, is accounted for. 

Automated API discovery tools can help identify all API assets across the organization’s infrastructure. Regular audits should be conducted to identify and remove orphaned or unused APIs, minimizing potential attack surfaces. By establishing a comprehensive API inventory, organizations can track usage patterns, detect anomalies, and promptly address security risks.

2. Ensure Comprehensive Documentation

Good documentation includes detailed descriptions of API endpoints, parameters, expected behaviors, and security measures. Documentation should be kept up to date, reflecting any changes to the API or its environment. It acts as a guide for developers and users to interact with the API correctly, while also providing a tool for security teams to identify and assess potential vulnerabilities. 

Ensuring that all APIs, including internal, experimental, and external ones, are thoroughly documented, can significantly reduce the chances of shadow endpoints and parameters becoming gateways for attackers.

3. Perform Risk Analysis and Version Management

Conducting regular risk analyses and implementing strict version management policies are essential for preventing asset management issues. Risk analysis helps in identifying potential security threats and vulnerabilities within the API ecosystem, allowing for the prioritization of mitigation efforts based on the severity of identified risks. 

Version management ensures that API updates and changes are systematically tracked, and old versions are deprecated in a controlled manner. This process includes notifying users of deprecated APIs, providing clear migration paths to newer versions, and eventually, securely retiring outdated versions to prevent unauthorized access.

4. Implement External Protection Measures

Implementing external protection measures such as firewalls, API gateways, and intrusion detection systems (IDS) adds another layer of security to safeguard against improper asset management vulnerabilities. These tools can monitor and control the traffic coming into and going out of the API environment, detecting and blocking malicious activities, even if they are related to unknown APIs. 

An API gateway can enforce policies like rate limiting and authentication across the environment, further reducing the risk of unauthorized access or exploitation of unknown APIs.

5. Establish an API Retirement Plan

A clear retirement plan for APIs should outline the steps for deprecating and safely retiring APIs that are no longer needed or have been replaced by updated versions. It includes notifying users well in advance, providing alternatives or migration paths, and ensuring that all data associated with the retiring API is securely handled. 

A methodical retirement process helps in minimizing loose ends and reducing the risk of leaving unused APIs as open doors for attackers.

Discovering Improper Asset Management Flaws in APIs With Automated API Security Testing

Protecting your APIs against OWASP Top 10, including Improper Asset Management Flaws through API security testing is critical in the threat climate of 2024. 'Shifting-left', and focusing your efforts on early discovery and resolution of vulnerabilities is proven to be the most effective way to handle such vulnerabilities. This proactive stance in the software development life cycle allows for:

  • Early Detection: Identifying API vulnerabilities early in the development process, reducing potential security risks.
  • Leverages functional tests to detect complex business logic scenarios, providing targeted security insights.
  • Seamless Integration: Facilitating easy integration with existing development tools and pipelines, enhancing developer productivity without compromising security.
  • Comprehensive API Discovery: Automated discovery of APIs, ensuring complete visibility from development to production, crucial for identifying shadow APIs and other hidden risks.

These aspects collectively enhance the overall security posture by addressing API vulnerabilities at their inception, rather than as an afterthought.

Learn more about Pynt API Security Testing 

Want to learn more about Pynt’s secret sauce?