What it is: Exposed Dangerous Method or Function (CWE-749) is a type of vulnerability where an API exposes methods that should be restricted.
Why it matters: This can lead to unauthorized access, data modification, and exposure of sensitive information. Proper input validation and strict access control are essential.
How to fix it: Restrict method access to authorized users only and implement robust validation checks on all inputs.
TL;DR: Exposed Dangerous Method or Function (CWE-749) is a vulnerability where critical methods are exposed without proper restrictions, leading to potential data breaches. Fixing it involves implementing strict access controls and input validation.
| Field | Value |
|---|---|
| CWE ID | CWE-749 |
| OWASP Category | A01:2025 - Broken Access Control |
| CAPEC | CAPEC-500 |
| Typical Severity | Low |
| Affected Technologies | APIs, web services, libraries |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-29 |
What is Exposed Dangerous Method or Function?
Exposed Dangerous Method or Function (CWE-749) is a type of vulnerability that occurs when an application provides an API with methods or functions that are not properly restricted, allowing unauthorized access. As defined by the MITRE Corporation under CWE-749 and classified by the OWASP Foundation under A01:2025 - Broken Access Control.
Quick Summary
Exposed Dangerous Method or Function is a critical security issue where an API exposes methods with unrestricted access, potentially leading to data breaches and unauthorized modifications. This vulnerability can have severe consequences on application integrity and confidentiality. Jump to: Overview · Root Cause · Attack Flow · Prerequisites to Exploit · Vulnerable Code · Secure Code · Business Impact · Detection · Fixing
Jump to: Quick Summary · Exposed Dangerous Method or Function Overview · How Exposed Dangerous Method or Function Works · Business Impact of Exposed Dangerous Method or Function · Exposed Dangerous Method or Function Attack Scenario · How to Detect Exposed Dangerous Method or Function · How to Fix Exposed Dangerous Method or Function · Framework-Specific Fixes for Exposed Dangerous Method or Function · How to Ask AI to Check Your Code for Exposed Dangerous Method or Function · Exposed Dangerous Method or Function Best Practices Checklist · Exposed Dangerous Method or Function FAQ · Vulnerabilities Related to Exposed Dangerous Method or Function · References · Scan Your Own Site
Exposed Dangerous Method or Function Overview
What: Exposed dangerous methods allow unauthorized access to critical functionalities within an API.
Why it matters: Unrestricted access can lead to data modification, exposure of sensitive information, and potential privilege escalation.
Where it occurs: In APIs that expose methods without proper validation and authorization checks.
Who is affected: Applications using APIs with exposed dangerous methods are at risk.
Who is NOT affected: Systems already implementing strict input validation and access control mechanisms.
How Exposed Dangerous Method or Function Works
Root Cause
The root cause of this vulnerability lies in the lack of proper restrictions on API methods, allowing unauthorized users to invoke critical functions.
Attack Flow
- An attacker identifies an exposed method within the API.
- The attacker exploits the unrestricted access to perform unauthorized actions such as data modification or privilege escalation.
- The system responds without enforcing necessary security checks.
Prerequisites to Exploit
- Unrestricted access to dangerous methods in the API.
- Lack of input validation and authorization checks.
Vulnerable Code
def update_user_profile(user_id, new_data):
# No validation on user_id or new_data
db.update_user(user_id, new_data)
This code allows any user with knowledge of the endpoint to modify other users’ profiles without proper authentication.
Secure Code
from flask import request
def update_user_profile(user_id, new_data):
# Validate input and check authorization
if not validate_input(new_data) or not is_authorized(request.user_id, user_id):
return "Unauthorized", 403
db.update_user(user_id, new_data)
In the secure version, validation checks ensure that only authorized users can modify profiles.
Business Impact of Exposed Dangerous Method or Function
Confidentiality
- Sensitive data exposed to unauthorized access.
- Financial and personal information at risk.
Integrity
- Unauthorized modifications to user accounts and system configurations.
- Potential for malicious actors to manipulate application state.
Availability
- Service disruptions due to unauthorized actions.
- System instability from uncontrolled API usage.
Business Consequences:
- Financial losses from data breaches.
- Legal liabilities under privacy regulations.
- Damage to reputation and customer trust.
Exposed Dangerous Method or Function Attack Scenario
- An attacker discovers an exposed method for updating user profiles in the application’s API documentation.
- The attacker crafts a request with malicious input to exploit this vulnerability.
- Upon receiving the request, the system updates the user profile without proper validation or authorization checks.
- The attacker gains unauthorized access and modifies sensitive information.
How to Detect Exposed Dangerous Method or Function
Manual Testing
- Review API documentation for methods that lack proper restrictions.
- Test endpoints with unvalidated inputs to identify vulnerabilities.
Automated Scanners (SAST / DAST)
Static analysis can detect exposed methods, while dynamic testing verifies actual behavior under runtime conditions.
PenScan Detection
PenScan’s scanner engines such as ZAP and Nuclei can identify exposed dangerous methods during automated scans.
False Positive Guidance
False positives may occur if the method is correctly restricted but appears to be unrestricted in documentation or API endpoints.
How to Fix Exposed Dangerous Method or Function
- Implement strict access control mechanisms.
- Validate all inputs before executing critical functions.
- Restrict method access to authorized users only.
- Use frameworks that enforce security by default.
Framework-Specific Fixes for Exposed Dangerous Method or Function
Python/Django
from django.contrib.auth.decorators import login_required
@login_required
def update_user_profile(request, user_id):
if not request.user.is_staff:
return HttpResponseForbidden()
# Validate and process the request
Java Spring
@PreAuthorize("hasRole('ADMIN')")
public void updateUserProfile(@PathVariable Long userId, @RequestBody UserProfile new_data) {
// Process the update with validation
}
How to Ask AI to Check Your Code for Exposed Dangerous Method or Function
Review the following Python code block for potential CWE-749 Exposed Dangerous Method or Function vulnerabilities and rewrite it using strict access control: [paste code here]
Exposed Dangerous Method or Function Best Practices Checklist
✅ Implement strict input validation on all API methods. ✅ Restrict method access to authorized users only. ✅ Use frameworks that enforce security by default. ✅ Regularly audit API documentation for exposed methods. ✅ Test APIs with unvalidated inputs during penetration testing.
Exposed Dangerous Method or Function FAQ
How does exposed dangerous method or function work?
Exposed dangerous methods allow unauthorized access to critical functionality, potentially leading to data modification or exposure. Ensure proper input validation and restrict access to authorized users only.
Why is it important to prevent CWE-749 vulnerabilities?
Preventing CWE-749 ensures that sensitive functionalities are not exposed to malicious actors, safeguarding application integrity and confidentiality.
Can you provide an example of vulnerable code for CWE-749?
Vulnerable code includes methods or functions with unrestricted access that can be exploited by unauthorized users. Secure versions implement strict access controls and validation checks.
How does PenScan detect Exposed Dangerous Method or Function vulnerabilities?
PenScan uses a combination of static analysis and dynamic testing to identify exposed dangerous methods, ensuring comprehensive coverage across the application.
What is the best practice for mitigating CWE-749 in web applications?
Implement strict access control mechanisms and validate all inputs before allowing execution of critical functions. Use frameworks that enforce security by default.
How can I manually test for Exposed Dangerous Method or Function vulnerabilities?
Review API endpoints and identify methods with unrestricted access. Test these methods to ensure proper validation and authorization checks are in place.
What is the relationship between CWE-749 and other security weaknesses?
CWE-749 often overlaps with improper access control (CWE-284), as both involve unauthorized exposure of critical functionalities.
Vulnerabilities Related to Exposed Dangerous Method or Function
| CWE | Name | Relationship |
|---|---|---|
| CWE-284 | Improper Access Control | ChildOf |
References
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 Exposed Dangerous Method or Function and other risks before an attacker does.