The OWASP API Security Top 10 (2023) – API5:2023 – Broken Function Level Authorisation for Software Developers
In the modern era of web development, Application Programming Interfaces (APIs) have become the backbone of software architectures. APIs serve as the connectors between applications, allowing different systems to communicate and share data seamlessly. However, with the increased reliance on APIs, the security landscape has become more complex, leading to a growing number of vulnerabilities. One of the most critical concerns is Broken Function Level Authorisation (API5:2023), as identified in the OWASP API Security Top 10 2023. This flaw can have severe implications for the security of applications, exposing them to malicious attacks and potentially damaging an organisation’s reputation and bottom line.
For software developers, understanding the technicalities and nuances of this vulnerability is crucial for preventing security breaches and ensuring that applications remain resilient in an increasingly complex threat landscape. In this blog post, we will take a deep dive into Broken Function Level Authorisation (API5:2023), exploring its causes, impact, and best practices for mitigation. Along the way, we will provide detailed examples, real-world cases, and actionable insights to help software developers address this security risk effectively.
What is Broken Function Level Authorisation?
At its core, Broken Function Level Authorisation occurs when an attacker is able to access functions or data that they are not authorised to use. This happens due to inadequate enforcement of role-based access controls (RBAC) or a failure to properly segregate administrative and regular user functions. APIs often expose a variety of functions depending on the user’s role (e.g., regular user, administrator, manager, etc.). When these functions are not sufficiently protected or are poorly designed, attackers can bypass these restrictions to gain unauthorised access to sensitive information or perform malicious activities.
In simpler terms, this vulnerability is a result of poorly defined or misconfigured authorisation rules within the API endpoints, allowing attackers to exploit the API’s functionality and gain privileges that should only be available to specific roles or users.
Why Does Broken Function Level Authorisation Matter?
Business Impact:
API vulnerabilities, including Broken Function Level Authorisation, can result in significant financial losses. Attackers can exploit these flaws to gain access to sensitive data such as customer information, intellectual property, and proprietary business processes. This could lead to data breaches, financial fraud, or legal liabilities. For organisations, the consequences of such attacks may include substantial fines, lawsuits, and a tarnished reputation.
Reputation Damage:
In an era where customers and users expect their personal and sensitive data to be protected, any breach can severely damage an organisation’s credibility. If an attacker gains access to administrative functions, it could jeopardise not only data integrity but also customer trust.
Operational Risks:
Exploiting function-level authorisation flaws often leads to the exposure of critical business functionalities that can be misused for malicious purposes. Whether it’s manipulating user accounts, deleting vital records, or bypassing internal security measures, attackers can severely disrupt business operations.
Key Causes of Broken Function Level Authorisation
To properly address this vulnerability, software developers must first understand the root causes that lead to Broken Function Level Authorisation:
- Misconfigured Access Controls:
Access control configurations define which roles can access which functions within an API. When these configurations are improperly set, it can lead to unauthorised access. For instance, an API may allow a user with a basic role to access administrative functions, exposing the system to significant risks. - Role Mismanagement:
When role-based access control (RBAC) is not properly implemented or roles are poorly defined, users can be granted more privileges than necessary. This mismanagement can be a direct pathway for attackers to gain administrative rights by simply impersonating or exploiting the role structure. - Insecure Code Design:
Developers may inadvertently expose sensitive endpoints by placing them under incorrect access restrictions. For example, an API function that was intended to be accessible only to administrators may not be properly checked, allowing a regular user to access it. - Lack of Granular Access Control:
A lack of fine-grained access control policies is another major cause of Broken Function Level Authorisation. If access control is only based on broad user roles (e.g., ‘user’ or ‘admin’) without further differentiation, attackers may easily bypass such controls to access restricted functions.
How Attackers Exploit Broken Function Level Authorisation
Attackers can exploit this vulnerability in various ways. Here are a few common attack vectors:
- Function Elevation via Manipulation of Roles:
Attackers may manipulate API requests to elevate their privileges. This is often done by altering parameters such as a user ID, role, or token associated with the request to gain access to restricted functionalities. For instance, a user might change their user role to “admin” via a URL parameter or HTTP header to access privileged administrative functions. - API Endpoint Discovery:
Attackers may use automated tools or manual inspection to identify and map out the API’s endpoints, looking for those that are poorly secured. Once the attacker discovers these endpoints, they can exploit misconfigured access controls to gain unauthorised access to sensitive functions. - Brute Forcing Role Privileges:
In some cases, attackers may try brute-forcing to guess valid user roles or permission combinations. If the system does not enforce strong access control checks for every request, attackers could potentially gain unauthorised access to functions simply by guessing their way through different API endpoints. - Session Hijacking and Replay Attacks:
Attackers may hijack a session from a legitimate user who has the necessary permissions. By capturing and replaying requests, they can impersonate the user and access functions they shouldn’t be authorised to use.
Real-World Examples of Broken Function Level Authorisation
To understand the severity of this vulnerability, let’s look at a few real-world examples:
- Facebook – Misconfigured API Functions (2018):
In 2018, a vulnerability was discovered in Facebook’s API that allowed attackers to gain access to the personal data of users, including private messages. The issue arose due to a failure in enforcing function-level authorisation, allowing attackers to view other users’ private messages and data. - GitHub – Privilege Escalation (2020):
A similar vulnerability was discovered in GitHub’s API in 2020. Attackers could manipulate the API to gain admin-level privileges and access private repositories or delete critical resources. This issue arose because the access control logic did not properly segregate administrative functions from those available to regular users. - T-Mobile – API Access Flaw (2022):
T-Mobile suffered a significant data breach in 2022, primarily due to a broken function level authorisation flaw in their API. The vulnerability allowed hackers to manipulate API parameters and gain access to user accounts, leading to a massive exposure of sensitive personal data.
Cyber Incidents Involving API5:2023 – Broken Function Level Authorisation
The risk of Broken Function Level Authorisation (API5:2023), as highlighted in the OWASP API Security Top 10 (2023), has been implicated in several high-profile cyber incidents over the years. This vulnerability is particularly dangerous because it allows attackers to gain unauthorised access to sensitive data and administrative functions within an API. Exploiting such flaws can lead to severe breaches of both user and business data, potentially causing significant financial and reputational damage.
In this section, we will examine real-world cyber incidents that have occurred due to the exploitation of Broken Function Level Authorisation. These incidents provide valuable lessons for software developers on the critical importance of secure API design and the steps needed to avoid similar vulnerabilities.
1. Facebook Data Breach (2018)
Incident Overview: In 2018, Facebook experienced a data breach due to a vulnerability in its API that exposed users’ personal data, including private messages and photos. This incident was traced back to a Broken Function Level Authorisation flaw, where certain API endpoints were not adequately protected from unauthorised access.
How It Happened: The vulnerability arose because Facebook’s API allowed attackers to access private user information through a function intended for users with administrative privileges. Attackers could exploit this flaw by manipulating API parameters, elevating their access privileges, and bypassing the system’s security checks. As a result, they gained access to sensitive data without the need for authentication or authorisation.
Impact:- Over 50 million user accounts were affected.
- Personal information, including user messages, photos, and posts, was exposed.
- The breach caused significant reputational damage to Facebook, leading to public outcry and increased regulatory scrutiny.
- Lessons Learned:
- APIs should not rely solely on role-based access controls (RBAC) without proper function-level checks.
- Even administrative functions must have granular access control policies to prevent privilege escalation.
- Regular audits of API endpoints should be performed to ensure that authorisation logic is functioning as intended.
- 2. GitHub Privilege Escalation (2020)
Incident Overview: GitHub, a platform widely used for hosting and managing software development projects, suffered a Broken Function Level Authorisation vulnerability in 2020. This flaw was identified in the way the API was handling user roles and access controls.
How It Happened: The flaw allowed attackers to manipulate API calls and escalate their privileges. By altering the parameters associated with their requests, attackers could impersonate administrative users, gaining access to private repositories and deleting critical resources that were meant to be restricted.
This was an example of how insufficiently secured API endpoints could allow attackers to bypass function-level checks, gaining access to resources they should not have had.
Impact:- Attackers had the ability to delete critical repositories, steal intellectual property, or disrupt development processes.
- GitHub’s reputation as a secure platform for developers was put at risk, especially with the potential loss of intellectual property.
- While no major losses were reported, the vulnerability highlighted the need for stricter API access controls.
- Lessons Learned:
- GitHub improved its access control system after the breach by adding stricter authorisation checks at the function level, particularly for sensitive operations like repository management.
- Organisations should apply strict checks for API endpoints that can affect core functionalities, such as data deletion or configuration changes.
- Regular penetration testing and security audits are essential to discover and mitigate such vulnerabilities before they are exploited.
- 3. T-Mobile API Security Flaw (2022)
Incident Overview: T-Mobile, a telecommunications company, faced a significant security breach in 2022, which was later traced back to a Broken Function Level Authorisation vulnerability in their API.
How It Happened: T-Mobile’s API exposed sensitive customer data, including account information, payment details, and call records. Attackers exploited the broken authorisation checks between user roles and the API functions, which allowed them to gain unauthorised access to accounts. This was done by manipulating API parameters that were not appropriately validated, enabling the attackers to escalate their privileges and retrieve sensitive information.
The breach occurred due to insufficient verification of whether the user was authorised to access specific data or perform particular actions, especially in cases where a user attempted to view or modify another user’s data.
Impact:- Personal information of millions of T-Mobile customers was exposed.
- The breach led to identity theft, fraud, and potential financial losses for affected customers.
- The company faced fines, a damaged reputation, and legal ramifications.
- Lessons Learned:
- API endpoints should always enforce function-level authorisation for all sensitive operations, not just for authentication.
- Customer data must be protected with strong access control policies, and no user should be able to escalate their privileges without undergoing strict authorisation checks.
- Companies must adopt least-privilege principles to ensure that users can only access the specific data and functions they need to perform their tasks.
- 4. Uber API Incident (2016)
Incident Overview: While not directly related to the API5:2023 categorisation, Uber’s 2016 data breach involved similar flaws in its API, allowing attackers to gain access to a broader set of data than what was initially permitted.
How It Happened: In this case, Uber’s API allowed attackers to gain unauthorised access to sensitive trip data. The flaw was tied to a lack of sufficient authorisation checks between different user roles and endpoints. Attackers exploited these vulnerabilities by manipulating the API’s access control checks, leading to the exposure of rider and driver information.
Impact:- Personal data of over 57 million Uber users was compromised, including both riders and drivers.
- The incident led to a significant public relations crisis, lawsuits, and a loss of consumer trust.
- Uber had to pay a large settlement fee to affected parties.
- Lessons Learned:
- This breach reinforced the need for strong authorisation mechanisms that protect all levels of data access.
- Uber implemented stronger access control measures post-breach, with a focus on securing the API endpoints that access sensitive user data.
- APIs should use token-based authentication (e.g., OAuth) alongside strong authorisation mechanisms to prevent privilege escalation.
- 5. Capital One Data Breach (2019)
Incident Overview: Capital One suffered a major data breach in 2019, which exposed over 100 million customers’ personal data, including names, addresses, credit scores, and social security numbers. This breach was caused by an API-related vulnerability that stemmed from a Broken Function Level Authorisation flaw.
How It Happened: The Capital One breach was triggered by a misconfigured API on a cloud server. Attackers were able to exploit the flaw in the server’s access controls to retrieve sensitive data. While the API was intended to limit access to certain functions based on the user’s role, the authorisation checks were too broad, allowing unauthorised users to access other people’s data.
Impact:- Over 100 million customers were affected, leading to both financial loss and reputational damage.
- Capital One faced a significant fine from regulators and had to offer compensation to affected customers.
- The breach had long-term impacts on trust, particularly for a financial institution that handles sensitive customer data.
- Lessons Learned:
- Cloud-based APIs must have stringent function-level authorisation policies to prevent unauthorised access to sensitive data.
- Companies should implement role-based access controls (RBAC) along with attribute-based access controls (ABAC) to add an additional layer of security.
- Regular security reviews and penetration testing are necessary to identify and mitigate vulnerabilities before they are exploited.
Best Practices for Mitigating Broken Function Level Authorisation
To defend against this vulnerability, software developers must adopt several best practices to ensure that APIs are robust and secure:
- Implement Fine-Grained Access Controls:
It’s essential to define detailed and fine-grained access controls that specify exactly what each user role can access. Rather than using broad roles like ‘user’ or ‘admin’, aim for a more granular approach, such as differentiating between read-only and write access, or differentiating access based on function level (e.g., ‘admin’, ‘moderator’, ‘user’). - Always Check Authorisation at the Function Level:
Make sure that every API endpoint has an associated access control check to verify that the user making the request has the appropriate permissions. For example, before an API allows a user to update account details, it should check that the user is either the owner of the account or an admin. - Use Secure Authentication Mechanisms:
Employ multi-factor authentication (MFA) and other robust authentication mechanisms to ensure that only legitimate users can access sensitive functions. Even with the right authorisation, a compromised account could still be a risk without proper authentication checks. - Adopt the Principle of Least Privilege (PoLP):
Grant users the minimum level of access they need to perform their tasks. Limiting access rights reduces the attack surface and ensures that attackers are unable to exploit unnecessary access to privileged functions. - Regularly Review and Audit API Security:
Conduct periodic security reviews and audits of your API’s access control mechanisms. It’s essential to identify any misconfigurations or gaps in your security posture before attackers can exploit them. - Implement Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC):
RBAC is effective for managing basic permissions, but ABAC can provide a more dynamic, policy-based model that enforces function-level authorisation based on attributes such as user location, device type, and time of access. - Security Testing and Penetration Testing:
Conduct thorough security testing, including penetration testing, to uncover potential vulnerabilities in your API’s access controls. Automated security tools can help scan for broken authorisation, but manual testing is often required to uncover more sophisticated flaws. - Use Secure APIs Libraries and Frameworks:
Where possible, leverage trusted and secure libraries and frameworks that have built-in protection against common API security risks, including Broken Function Level Authorisation.
Final Thoughts
Broken Function Level Authorisation is one of the most critical vulnerabilities in the OWASP API Security Top 10 2023, and its impact on businesses can be devastating. As software developers, it is essential to design APIs with robust access control mechanisms, ensuring that sensitive functions are securely segregated and accessible only to authorised users. By adopting the best practices outlined above, developers can effectively mitigate this vulnerability, reduce the risk of security breaches, and safeguard both user data and business operations.
Ultimately, securing APIs is not just about writing clean, efficient code; it is about understanding the security implications of each function and implementing the right safeguards. By staying vigilant and proactive in securing APIs, developers can help protect their organisations from costly breaches and maintain the trust of their users.
The Importance of Securing API Access
The incidents outlined above serve as stark reminders of the critical need for function-level authorisation in API security. Broken Function Level Authorisation can have devastating consequences for organisations, leading to data breaches, financial losses, and irreparable damage to an organisation’s reputation. These breaches highlight that organisations must focus on the detailed design and configuration of their API access control mechanisms to ensure they are adequately protected from unauthorised access and privilege escalation.

For software developers, it is essential to understand that secure coding practices, frequent audits, and a holistic approach to API security are key to preventing such breaches. By employing fine-grained access control, role separation, and security testing, developers can mitigate the risks associated with Broken Function Level Authorisation and ensure that their APIs remain secure and resilient against evolving threats.