What it is: Improper Authorization (CWE-285) is a type of vulnerability that occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality.
Why it matters: Improper Authorization can lead to severe consequences, including unauthorized access to sensitive data, modification of sensitive data, and execution of unauthorized code or commands. It is essential to implement proper access control mechanisms and ensure that authorization checks are applied consistently to prevent such vulnerabilities.
How to fix it: To fix Improper Authorization vulnerabilities, you can implement role-based access control, use a "default deny" policy when defining access control lists, and ensure that access control checks are applied consistently. You can also use an AI coding assistant to review your code for potential CWE-285 Improper Authorization vulnerabilities and rewrite it using the primary fix technique.
TL;DR: Improper Authorization (CWE-285) occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality. To fix this vulnerability, implement role-based access control, use a “default deny” policy, and ensure that access control checks are applied consistently.
At-a-Glance
| Field | Value |
|---|---|
| CWE ID | CWE-285 |
| OWASP Category | A01:2025 - Broken Access Control |
| CAPEC | CAPEC-1, CAPEC-104, CAPEC-127, CAPEC-13, CAPEC-17, CAPEC-39, CAPEC-402, CAPEC-45, CAPEC-5, CAPEC-51, CAPEC-59, CAPEC-60, CAPEC-647, CAPEC-668, CAPEC-76, CAPEC-77, CAPEC-87 |
| Typical Severity | High |
| Affected Technologies | Web applications, Java EE/EJB, Spring, ASP.NET, Django |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-28 |
What is Improper Authorization?
Improper Authorization (CWE-285) is a type of vulnerability that occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality. As defined by the MITRE Corporation under CWE-285, and classified by the OWASP Foundation under A01:2025 - Broken Access Control, Improper Authorization can lead to severe consequences, including unauthorized access to sensitive data, modification of sensitive data, and execution of unauthorized code or commands.
Quick Summary
Improper Authorization (CWE-285) is a critical vulnerability that occurs when an application fails to perform or incorrectly performs an authorization check. This can lead to severe consequences, including unauthorized access to sensitive data, modification of sensitive data, and execution of unauthorized code or commands. To fix this vulnerability, implement role-based access control, use a “default deny” policy, and ensure that access control checks are applied consistently.
Jump to: What is Improper Authorization? · Quick Summary · Improper Authorization Overview · How Improper Authorization Works · Business Impact of Improper Authorization · Improper Authorization Attack Scenario · How to Detect Improper Authorization · How to Fix Improper Authorization · Framework-Specific Fixes for Improper Authorization · How to Ask AI to Check Your Code for Improper Authorization · Improper Authorization Best Practices Checklist · Improper Authorization FAQ · Vulnerabilities Related to Improper Authorization · References · Scan Your Own Site
Improper Authorization Overview
What: Improper Authorization (CWE-285) is a type of vulnerability that occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality.
Why it matters: Improper Authorization can lead to severe consequences, including unauthorized access to sensitive data, modification of sensitive data, and execution of unauthorized code or commands. It is essential to implement proper access control mechanisms and ensure that authorization checks are applied consistently to prevent such vulnerabilities.
Where it occurs: Improper Authorization can occur in any application that fails to perform or incorrectly performs an authorization check.
Who is affected: Any user who has access to the affected application may be affected by Improper Authorization.
Who is NOT affected: Users who do not have access to the affected application are not affected by Improper Authorization.
How Improper Authorization Works
Root Cause
Improper Authorization (CWE-285) occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality. This can be due to a variety of reasons, including:
- Failing to implement proper access control mechanisms
- Incorrectly implementing access control mechanisms
- Not ensuring that access control checks are applied consistently
Attack Flow
- An attacker attempts to access sensitive data or functionality without authorization.
- The application fails to perform or incorrectly performs an authorization check, allowing the attacker to gain unauthorized access.
Prerequisites to Exploit
- The attacker must have some level of access to the affected application
- The application must fail to perform or incorrectly perform an authorization check
Vulnerable Code
def access_data(user):
# Check if user has permission to access data
if user == 'admin':
return True
else:
return False
This code is vulnerable because it only checks if the user is ‘admin’, but does not ensure that the user has proper authorization.
Secure Code
def access_data(user):
# Check if user has permission to access data using role-based access control
if user.role == 'admin' or user.role == 'moderator':
return True
else:
return False
This code is secure because it uses role-based access control to ensure that the user has proper authorization.
Business Impact of Improper Authorization
Improper Authorization (CWE-285) can lead to severe consequences, including:
- Unauthorized access to sensitive data
- Modification of sensitive data
- Execution of unauthorized code or commands
This can result in financial losses, compliance issues, and damage to reputation.
Improper Authorization Attack Scenario
- An attacker attempts to access sensitive data without authorization.
- The application fails to perform or incorrectly performs an authorization check, allowing the attacker to gain unauthorized access.
- The attacker modifies or deletes sensitive data.
- The attacker executes unauthorized code or commands.
How to Detect Improper Authorization
Manual Testing
- Review application code for proper access control mechanisms
- Test application with different user roles and permissions
- Verify that authorization checks are applied consistently
Automated Scanners (SAST/DAST)
- Use SAST tools to detect vulnerabilities in application code
- Use DAST tools to detect vulnerabilities in application runtime behavior
PenScan Detection
PenScan’s automated scan engines actively test for CWE-285 Improper Authorization vulnerabilities.
False Positive Guidance
When reviewing the detection results, be aware that some patterns may look risky but are actually safe due to context. For example, a pattern that looks like it could lead to an unauthorized access attempt might actually be a legitimate user action.
How to Fix Improper Authorization
- Implement role-based access control
- Use a “default deny” policy when defining access control lists
- Ensure that access control checks are applied consistently
- Review and update application code to ensure proper access control mechanisms are in place
Framework-Specific Fixes for Improper Authorization
Java EE/EJB
- Implement the @RolesAllowed annotation to restrict access to sensitive methods
- Use the @PermitAll and @DenyAll annotations to control access to resources
- Ensure that access control checks are applied consistently
@RolesAllowed("admin")
public void accessData() {
// Code to access data
}
Node.js
- Implement role-based access control using a library such as Passport.js
- Use a “default deny” policy when defining access control lists
- Ensure that access control checks are applied consistently
const express = require('express');
const app = express();
app.use(passport.initialize());
passport.use(new LocalStrategy({
usernameField: 'username',
passwordField: 'password'
}, function(username, password, done) {
// Code to authenticate user
}));
app.get('/access-data', passport.authenticate('local'), function(req, res) {
// Code to access data
});
How to Ask AI to Check Your Code for Improper Authorization
You can use an AI coding assistant to review your code for potential CWE-285 Improper Authorization vulnerabilities and rewrite it using the primary fix technique. Here is a copy-pasteable prompt you can use:
Review the following Python code block for potential CWE-285 Improper Authorization vulnerabilities and rewrite it using role-based access control:
Improper Authorization Best Practices Checklist
✅ Implement role-based access control to ensure that users have proper authorization. ✅ Use a “default deny” policy when defining access control lists. ✅ Ensure that access control checks are applied consistently. ✅ Review and update application code to ensure proper access control mechanisms are in place.
Improper Authorization FAQ
How does Improper Authorization occur?
Improper Authorization occurs when an application fails to perform or incorrectly performs an authorization check, allowing unauthorized access to sensitive data or functionality.
What are the common consequences of Improper Authorization?
The common consequences of Improper Authorization include unauthorized access to sensitive data, modification of sensitive data, and execution of unauthorized code or commands.
How can I detect Improper Authorization in my application?
You can detect Improper Authorization by performing manual testing, using automated scanners (SAST/DAST), and reviewing the PenScan detection results.
What are some best practices to prevent Improper Authorization?
Some best practices to prevent Improper Authorization include implementing role-based access control, ensuring that access control checks are applied consistently, and using a “default deny” policy when defining access control lists.
Can I use an AI coding assistant to check my code for Improper Authorization vulnerabilities?
Yes, you can use an AI coding assistant to review your code for potential CWE-285 Improper Authorization vulnerabilities and rewrite it using the primary fix technique.
What are some common mistakes that lead to Improper Authorization vulnerabilities?
Some common mistakes that lead to Improper Authorization vulnerabilities include failing to perform or incorrectly performing authorization checks, allowing untrusted input to reach a dangerous sink, and not implementing proper access control mechanisms.
How can I ensure that my application’s configuration is secure against Improper Authorization attacks?
You can ensure that your application’s configuration is secure against Improper Authorization attacks by implementing a “default deny” policy when defining access control lists, using role-based access control, and ensuring that access control checks are applied consistently.
What are some framework-specific fixes for Improper Authorization vulnerabilities in Java EE/EJB?
Some framework-specific fixes for Improper Authorization vulnerabilities in Java EE/EJB include implementing the @RolesAllowed annotation to restrict access to sensitive methods, using the @PermitAll and @DenyAll annotations to control access to resources, and ensuring that access control checks are applied consistently.
Vulnerabilities Related to Improper Authorization
| CWE | Name | Relationship |
|---|---|---|
| CWE-284 | Improper Access Control (ChildOf) |
References
- MITRE CWE-285
- OWASP A01:2025 - Broken Access Control
- CAPEC-1, CAPEC-104, CAPEC-127, CAPEC-13, CAPEC-17, CAPEC-39, CAPEC-402, CAPEC-45, CAPEC-5, CAPEC-51, CAPEC-59, CAPEC-60, CAPEC-647, CAPEC-668, CAPEC-76, CAPEC-77, CAPEC-87
- NVD CVE Database
Scan Your Own Site
Manual code review catches what you know to look for. An automated scan catches what you didn’t. Scan your own website using PenScan to find Improper Authorization and other risks before an attacker does.