---
title: "CWE-749: Exposed Dangerous Method or Function"
url: https://radicalnotion.ai/cwe/cwe-749
type: cwe
description: "The product provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-749: Exposed Dangerous Method or Function

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **Likelihood of exploit:** Low
- **CVEs with this as primary weakness:** 202
- **Of those, in CISA KEV:** 4
- **New in 2026:** 75
- **CWE catalog version:** 4.21

## Description

The product provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted.

Many different kinds of technologies effectively provide access to methods or functions, such as ActiveX controls, Java functions, IOCTLs, and so on.

The exposure can occur in a few different ways:

The function/method was never intended to be exposed to outside actors.

The function/method was only intended to be accessible to a limited set of actors, such as Internet-based access from a single web site.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality, Availability, Access Control, Other | Gain Privileges or Assume Identity, Read Application Data, Modify Application Data, Execute Unauthorized Code or Commands, Other | Exposing critical functionality essentially provides an attacker with the privilege level of the exposed functionality. The consequences may vary depending on the behavior of the exposed method. Typically, this could result in the modification or exposure of sensitive data or possibly even execution of arbitrary code. |

## Potential mitigations

### Architecture and Design

If you must expose a method, make sure to perform input validation on all arguments, limit access to authorized parties, and protect against all possible vulnerabilities.

### Architecture and Design, Implementation (Attack Surface Reduction)

Identify all exposed functionality. Explicitly list all functionality that must be exposed to some user or set of users. Identify which functionality may be:

Ensure that the implemented code follows these expectations. This includes setting the appropriate access modifiers where applicable (public, private, protected, etc.) or not marking ActiveX controls safe-for-scripting.

- accessible to all users
- restricted to a small set of privileged users
- prevented from being directly accessible at all

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

In the following Java example the method removeDatabase will delete the database with the name specified in the input parameter.

Bad code:

```java
public void removeDatabase(String databaseName) {
    try {
        Statement stmt = conn.createStatement();
        stmt.execute("DROP DATABASE " + databaseName);
    } catch (SQLException ex) {...}
}
```

Good code:

```java
private void removeDatabase(String databaseName) {
    try {
        Statement stmt = conn.createStatement();
        stmt.execute("DROP DATABASE " + databaseName);
    } catch (SQLException ex) {...}
    }
```

The method in this example is declared public and therefore is exposed to any class in the application. Deleting a database should be considered a critical operation within an application and access to this potentially dangerous method should be restricted. Within Java this can be accomplished simply by declaring the method private thereby exposing it only to the enclosing class as in the following example.

### Example 2

These Android and iOS applications intercept URL loading within a WebView and perform special actions if a particular URL scheme is used, thus allowing the Javascript within the WebView to communicate with the application:

Bad code:

```java
// Android
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
    if (url.substring(0,14).equalsIgnoreCase("examplescheme:")){
        if(url.substring(14,25).equalsIgnoreCase("getUserInfo")){
            writeDataToView(view, UserData);
            return false;
        }
        else{
            return true;
        }
    }
}
```

Bad code:

```objective-c
// iOS
-(BOOL) webView:(UIWebView *)exWebView shouldStartLoadWithRequest:(NSURLRequest *)exRequest navigationType:(UIWebViewNavigationType)exNavigationType
{
    NSURL *URL = [exRequest URL];
    if ([[URL scheme] isEqualToString:@"exampleScheme"])
    {
        NSString *functionString = [URL resourceSpecifier];
        if ([functionString hasPrefix:@"specialFunction"])
        {

            // Make data available back in webview.
            UIWebView *webView = [self writeDataToView:[URL query]];
        }
        return NO;
    }
    return YES;
}
```

Attack code:

```javascript
window.location = examplescheme://method?parameter=value
```

### Example 3

This application uses a WebView to display websites, and creates a Javascript interface to a Java object to allow enhanced functionality on a trusted website:

Bad code:

```java
public class WebViewGUI extends Activity {
    WebView mainWebView;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mainWebView = new WebView(this);
        mainWebView.getSettings().setJavaScriptEnabled(true);
        mainWebView.addJavascriptInterface(new JavaScriptInterface(), "userInfoObject");
        mainWebView.loadUrl("file:///android_asset/www/index.html");
        setContentView(mainWebView);
    }

    final class JavaScriptInterface {
        JavaScriptInterface () {}

        public String getUserInfo() {
            return currentUser.Info();
        }
    }
}
```

Attack code:

```javascript
<script>
    userInfoObject.getClass().forName('android.telephony.SmsManager').getMethod('getDefault',null).sendTextMessage(attackNumber, null, attackMessage, null, null);
</script>
```

### Example 4

After Android 4.2, only methods annotated with @JavascriptInterface are available in JavaScript, protecting usage of getClass() by default, as in this example:

Bad code:

```java
final class JavaScriptInterface {
    JavaScriptInterface () { }

    @JavascriptInterface
    public String getUserInfo() {
        return currentUser.Info();
    }
}
```

Attack code:

```javascript
<script>
    var info = window.userInfoObject.getUserInfo();
    sendUserInfo(info);
</script>
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2007-6382 | arbitrary Java code execution via exposed method |
| CVE-2007-1112 | security tool ActiveX control allows download or upload of files |

## Real CVEs with this weakness (sample of 12 of 202)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2010-0738 | Red Hat JBoss Authentication Bypass Vulnerability | critical | 10.0 | - | Yes | 2010-04-28 |
| CVE-2010-1428 | Red Hat JBoss Information Disclosure Vulnerability | high | 8.7 | - | Yes | 2010-04-28 |
| CVE-2006-1547 | Improper Input Validation in Apache Struts | high | 8.7 | - | Yes | 2006-03-30 |
| CVE-2018-19322 | GIGABYTE Multiple Products Code Execution Vulnerability | high | 8.5 | - | Yes | 2018-12-21 |
| CVE-2026-30957 | OneUptime Synthetic Monitor RCE via exposed Playwright browser object | critical | 10.0 | - | No | 2026-03-10 |
| CVE-2026-30921 | OneUptime Synthetic Monitor RCE via exposed Playwright browser object | critical | 10.0 | - | No | 2026-03-09 |
| CVE-2022-31491 | Exposed Dangerous Method or Function in Voltronic Power and PowerShield UPS monitoring software | critical | 10.0 | - | No | 2025-08-22 |
| CVE-2023-40151 | Red Lion Controls Sixnet RTU Exposed Dangerous Method Or Function | critical | 10.0 | - | No | 2023-11-21 |
| CVE-2026-76965 | OS Command Injection vulnerability in ABAP Application Server for SAP NetWeaver and ABAP Platform | critical | 9.9 | - | No | 2026-11-10 |
| CVE-2026-109412 | - | critical | 9.9 | - | No | 2026-10-13 |
| CVE-2026-89110 | Broken Access Control in SAP NetWeaver Visual Composer | critical | 9.9 | - | No | 2026-10-13 |
| CVE-2026-55454 | Appsmith: Caddy admin API exposed without authentication | critical | 9.9 | - | No | 2026-06-24 |

## Related attack patterns (CAPEC)

- [CAPEC-500](https://radicalnotion.ai/capec/capec-500): WebView Injection

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-284](https://radicalnotion.ai/cwe/cwe-284) | Improper Access Control |
| Child | [CWE-618](https://radicalnotion.ai/cwe/cwe-618) | Exposed Unsafe ActiveX Method |
| Child | [CWE-782](https://radicalnotion.ai/cwe/cwe-782) | Exposed IOCTL with Insufficient Access Control |

## Frequently asked questions

### What is CWE-749?

The product provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted.

### What CVEs are caused by CWE-749?

202 recorded CVEs are attributed to CWE-749, including CVE-2010-0738, CVE-2010-1428 and CVE-2006-1547. 4 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-749?

If you must expose a method, make sure to perform input validation on all arguments, limit access to authorized parties, and protect against all possible vulnerabilities.

### How is CWE-749 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-749?

Exploiting CWE-749 can lead to: Gain Privileges or Assume Identity, Read Application Data, Modify Application Data, Execute Unauthorized Code or Commands, Other.

### Is CWE-749 actively exploited?

Yes. 4 CWE-749 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 202 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/749.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-749). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
