Understanding and Preventing Broken Access Control, the Top Vulnerability in OWASP Top 10 2021

Access control is a critical component of web application security, as it ensures that only authorized users have access to sensitive data and functions. However, when access control is not properly implemented or enforced, it can lead to significant security risks. In fact, Broken Access Control is currently the top vulnerability in the OWASP Top 10 2021 list.

Broken Access Control occurs when an attacker can bypass or manipulate access control mechanisms to gain unauthorized access to resources or functions. There are several ways in which access control can be violated, including:

  • Violation of the principle of least privilege or deny by default, where access should only be granted for particular capabilities, roles, or users, but is available to anyone.
  • Bypassing access control checks by modifying the URL (parameter tampering or force browsing), internal application state, or the HTML page, or by using an attack tool modifying API requests.
  • Permitting viewing or editing someone else’s account, by providing its unique identifier (insecure direct object references)
  • Accessing API with missing access controls for POST, PUT and DELETE.
  • Elevation of privilege. Acting as a user without being logged in or acting as an admin when logged in as a user.
  • Metadata manipulation, such as replaying or tampering with a JSON Web Token (JWT) access control token, or a cookie or hidden field manipulated to elevate privileges or abusing JWT invalidation.
  • CORS misconfiguration allows API access from unauthorized/untrusted origins.
  • Force browsing to authenticated pages as an unauthenticated user or to privileged pages as a standard user.

To prevent Broken Access Control vulnerabilities, it is essential to implement access control mechanisms correctly. Here are some best practices for preventing access control violations:

  • Access control is only effective in trusted server-side code or server-less API, where the attacker cannot modify the access control check or metadata.
  • Except for public resources, deny by default.
  • Implement access control mechanisms once and re-use them throughout the application, including minimizing Cross-Origin Resource Sharing (CORS) usage.
  • Model access controls should enforce record ownership rather than accepting that the user can create, read, update, or delete any record.
  • Unique application business limit requirements should be enforced by domain models.
  • Disable web server directory listing and ensure file metadata (e.g., .git) and backup files are not present within web roots.
  • Log access control failures, alert admins when appropriate (e.g., repeated failures).
  • Rate limit API and controller access to minimize the harm from automated attack tooling.
  • Stateful session identifiers should be invalidated on the server after logout. Stateless JWT tokens should rather be short-lived so that the window of opportunity for an attacker is minimized. For longer lived JWTs it’s highly recommended to follow the OAuth standards to revoke access.

By following these best practices, you can help ensure that your web application is protected against Broken Access Control vulnerabilities. Stay vigilant and keep your application secure!

(Visited 91 times, 1 visits today)

Leave a Reply