Api Penetration Test

Application Programming Interfaces (API) penetration tests focus on evaluating the security posture of environments which utilize API and require the transmission of data. The engagement’s goals are to subvert application logic and cause an exposure of sensitive information by accessing restricted functionalities and levels of access. The testing activities are conducted using mainly manual enumeration and exploitation techniques outlined in the OWASP API Testing Guide.

Process of API testing
Penetration testers focus on identifying classes of vulnerabilities within the Open Web Application Security Project’s (OWASP) top 10 most critical API application security risks:

Broken object level authorization – APIs tend to expose endpoints that handle object identifiers, creating a wide attack surface level access control issue. Object level authorization checks should be considered in every function that accesses a data source using an input from the user.

Broken user authentication – Authentication mechanisms are often implemented incorrectly, allowing attackers to compromise authentication tokens or to exploit implementation flaws to assume other user’s identities temporarily or permanently. Compromising a system’s ability to identify the client/user, compromises API security overall.

Excessive data exposure – Looking forward to generic implementations, developers tend to expose all object properties without considering their individual sensitivity, relying on clients to perform the data filtering before displaying it to the user.

Lack of resources & rate limiting – Quite often, APIs do not impose any restrictions on the size or number of resources that can be requested by the client/user. Not only can this impact the API server performance, leading to Denial of Service (DoS), but they also leave the door open to authentication flaws such as brute force.

Broken function level authorization – Complex access control policies with different hierarchies, groups, roles, and an unclear separation between administrative and regular functions, tend to lead to authorization flaws. By exploiting these issues, attackers gain access to other users’ resources and/or administrative functions.

Mass assignment – Binding client provided data (e.g., JSON) to data models, without proper properties filtering based on an allowlist, usually leads to mass assignment. Either guessing objects properties, exploring other API endpoints, reading the documentation, or providing additional object properties in request payloads, allows attackers to modify object properties they are not supposed to.

Security misconfiguration – Security misconfiguration is commonly a result of unsecure default configurations, incomplete or ad-hoc configurations, open cloud storage, misconfigured HTTP headers, unnecessary HTTP methods, permissive cross-origin resource sharing (CORS), and verbose error messages containing sensitive information.

Injection – Injection flaws, such as SQL, NoSQL, Command Injection, etc., occur when untrusted data is sent to an interpreter as part of a command or query. The attacker’s malicious data can trick the interpreter into executing unintended commands or accessing data without proper authorization.

Improper assets management – APIs tend to expose more endpoints than traditional web applications, making proper and updated documentation highly important. Proper hosts and deployed API versions’ inventory also play an important role in mitigating issues such as deprecated API versions and exposed debug endpoints.

Insufficient logging & monitoring – Insufficient logging and monitoring, coupled with missing or ineffective integration with incident response, allows attackers to further attack systems, maintain persistence, pivot to more systems to tamper with, extract or destroy data. Most breach studies demonstrate the time to detect a breach is over 200 days, typically detected by external parties rather than internal processes or monitoring.

EN