Broken Access Control and How to Prevent It
Published: 2021-09-23 12:31:51

Broken Access Control vulnerabilities are common in modern applications since the design and implementation of access control mechanisms rely on a highly complex ecosystem of multiple components and processes. In such a complex, changing ecosystem, security teams should apply several legal, organizational, and business logic to ensure the tech stack is watertight and has no room left for hackers to exploit the system.

As it sounds, the job isn’t easy, and there are fair chances of unidentified vulnerabilities on account of a formal approach to tackling security. The traditional method of identifying access-related vulnerabilities is to rely on manual testing. Due to the lack of automated, continuous detection, access control vulnerabilities often remain unnoticed and are potentially targeted by hackers at a much higher intensity.

This post explores broken access control vulnerabilities and what firms can do to prevent access control flaws.

## What Are Broken Access Control Security Vulnerabilities?

Broken Access Control features in the [OWASP Top 10 vulnerabilities](https://crashtest-security.com/owasp/) since hackers can exploit these to masquerade as users and access resources using privileged functions. Most access control schemes are not deliberately designed using a guided framework. Instead, they evolve with the web application’s use.

Besides this, a flawed access scheme is relatively easy to identify and exploit. In most cases, the hacker has to create a request for content or functions they aren’t permitted to access. Once the flaw has been detected, the impacts can range from mild to severe depending on the content’s sensitivity and protection controls. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9uc4b78nowd94u832j5.png)

## The Impacts of Broken Access Control

Almost every web server and application deployment is known to be susceptible to at least one broken access control vulnerability. Depending on which resources the attackers get the permissions to access, the impacts of a successful attack could be detrimental. Some business impacts of access control failures include:

### Exposure of Unauthorized Content

Once an attacker has gained unauthorized access privileges, they typically crawl the site for information on gaining more permissions. While doing so, they access sensitive system and user data, which they can obtain from the black market or other malicious acts. With a successful attack, the hacker can view, modify, or even delete the sensitive data, hindering system performance, the company’s reputation, and availability.

### [Privilege Escalation](https://crashtest-security.com/privilege-escalation-guide/)

Hackers exploit access flaws mainly to gain privileged access to resources and services typically protected from normal users and applications. Most commonly, hackers initially intend to take control of as many user accounts as possible. With an elevation of privilege,  hackers can easily steal user data or deploy malicious payloads that can damage the entire application hosting ecosystem.

### Distributed Denial of Service

With access to numerous user accounts, attackers can deploy bots on these accounts and use them to cause the system to crash by sending numerous requests at a go. Additionally, they deploy malicious payloads that render the application inaccessible and unavailable for authorized users and services.

## Common Access Control Vulnerabilities

[Broken authentication vulnerabilities](https://crashtest-security.com/broken-authentication-and-session-management/) can be categorized as:

### Vertical Privilege Escalation

Vertical access controls are used to restrict access to crucial functions not available for other users in the organization. For example, broken vertical access controls can be explored to access functions that ordinary users can’t access, such as modifying and deleting user accounts. 

Examples of vertical privilege escalation attacks from broken vertical access controls include:

* Unprotected Sensitive Functionality

* Parameter-based attacks

* Broken access control due to platform misconfiguration

### Horizontal Privilege Escalation

Horizontal access controls enable different application users to access similar resource types. These mechanisms restrict access to the resources only to the group of users allowed to access the resource. For instance, a banking application lets clients view their transactions’ records but not of other users. Broken horizontal access controls enable attackers to access resources belonging to other users and are caused by Improper ID controls.

### Context-Dependent Privilege Escalation

Often, attackers compromise privileged users to turn horizontal privilege escalation attacks into vertical privilege escalation. For instance, hackers may use broken horizontal controls to retrieve the login credentials of another user. The attackers can then target administrative accounts, which gives them administrative rights to escalate privileges vertically.

Some context-dependent privilege escalation attacks include:

* Insecure Direct Object Reference

* Multi-step attacks

* Attacks on referer-based mechanisms

* Attacks on geographical location-based mechanisms

## Preventing Broken Access Control Vulnerabilities

Broken Access Control is a highly ranked OWASP listed vulnerability rated to happen occasionally, has moderate exploitability, and has extremely deeper and harmful impacts. Additionally, broken access control is a leading factor in data breaches and leaks, which often result in huge penalties, loss of business reputation, and exposure of customer information to fraudsters.

It is, therefore, essential to address these vulnerabilities before attackers take advantage of them and, in general, establish an access control policy. 

Following is the list of best practices and tools commonly used to prevent broken access control vulnerability attacks.

### Best Practices to Prevent Access Control Vulnerability Attacks

Some practices that security teams can adopt to prevent broken access control include:

#### Deny by Default

A good rule of thumb with access control is to start with the minimum privileged functions required. For example, by default, every application’s user should be denied access to application resources, with only a legitimate user getting permissions to view, access, and modify them.

In addition, security teams should remove admin rights and other elevated privileges, reducing the scope of impact once an attacker obtains a user’s credentials. [Session management](https://crashtest-security.com/harden-tls-session-resumption/) should also be performed using *Just in Time* access to eliminate the need for persistent privileges that hackers can quickly obtain.

#### Central Interface for Application-wide Access Controls

Every organization needs a standard method to evaluate the effectiveness of access control decisions. It is, therefore, essential to have a central, managed interface to document the access control schemes used and aid in the design of a framework used to test the success of established access control mechanisms.

#### Handle Access Controls At Server-Side

Organizations should only trust server-side authentication & authorization as it applies the same controls to all services, users, and applications. Security teams and developers should develop a template for the separation of duties. For instance, Role templates help the server validate requests based on permissions associated with the specific role and not grant access to unauthorized users.

#### Constant Testing and Auditing of Access Controls

It is important to make security testing a continuous, consistent process by continuously testing and auditing access control mechanisms to ensure they work as intended. In addition, efficient testing helps teams identify newer vulnerabilities and flaws as they come up, enhancing the organization’s confidence in their implementation of access control. 

#### Clean Code with Binary Access Controls

Every developer should ensure that their source code includes rules that declare access for every resource at the code level, and the access should be denied by default. It is also important to use secure coding practices to avoid common programming errors that attackers target for privileged access.

#### Enable RBAC

Role-Based Access Control (RBAC) enables organizations to quickly implement access control by grouping users into roles and defining the permissions associated with each role. With RBAC, security teams can reduce the toil of IT support & administration, maximize operational efficiency, and improve compliance through data access management. 

#### Enforce Record Ownership

Organizations should model access controls that associate each record with the account’s User ID that performs tasks, rather than allowing users to access, modify, update, or delete any records.

## Tools to Prevent, Detect and Remediate Broken Authentication Vulnerabilities

Some of the most popular solutions for identifying and preventing broken access control vulnerabilities include:

### [Crashtest Security Suite](https://crashtest-security.com/)

A vulnerability scanning software establishes a continuous testing process to help organizations reduce the risk of getting hacked through an API or Web Application. With Crashtest Security, organizations can set up vulnerability scanning within minutes as the suite integrates seamlessly with most current tech stacks. In addition, the tool enables efficient scanning with low false positives & negatives rates while producing accurate vulnerability reports and remediation advice.

### [HDiv](https://hdivsecurity.com/)

A complete application testing solution uses an information flow control system to help teams control resources exposed by their applications. In addition, the information flow control mechanism prevents breaking the original server contract, allowing HDiv to know precisely which each user can access resources.

### [Immuniweb Discovery](https://www.immuniweb.com/products/discovery/)

An attack surface management and monitoring solution use AI-driven testing to expose vulnerabilities and an organization’s dark web exposure. In addition, the platform relies on non-intrusive and production-safe vulnerability discovery to help teams prevent supply chain attacks.

### [PortSwigger/Burp Suite](https://portswigger.net/burp)

Burp Suite is a popular application security solution developed by PortSwigger to help organizations fight zero-day threats through automated scanning. The suite also includes penetration testing functions that can be used to identify the impact of Broken Access Control attacks on web servers.

### [Acunetix](https://www.acunetix.com/)

An application security testing platform that offers inbuilt vulnerability assessment and management. The solution integrates with market-leading DevOps tools to increase security and eliminate most security risks at low costs.

## Summary

Remediating access control failure is a rather complex task since attackers can leverage many scenarios to exploit the vulnerability. In addition, misconfiguration of function-level access often results in security gaps used for privilege escalation by attackers. 

Crashtest Security is an end-to-end vulnerability scanning platform that enables automated vulnerability scanning for improved productivity and security posture. [Try Crashtest Security today](https://crashtest.cloud/registration?utm_source=blog&utm_medium=referral&utm_campaign=blog_reg&_ga=2.252352143.72113889.1632390146-1667525077.1631917992) to discover how it integrates into your development stack for efficient, automated vulnerability scanning.

*This article has already been published on https://crashtest-security.com/broken-access-control-prevention/ and has been authorized by Crashtest Security for a republish.*