Weakness · High

CWE-749: Exposed Dangerous Method or Function

What it is

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.

Likelihood of exploit: Low2 exploited in the wildMITRE CWE 4.19.1

Severity (our rating)
High
Likelihood of exploit
Low
Introduced during
Architecture and Design, Implementation
Exploited in the wild
2 known exploited CVEs

In more detail

This weakness can lead to a wide variety of resultant weaknesses, depending on the behavior of the exposed method. It can apply to any number of technologies and approaches, 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.

What an attacker can do

  • Gain Privileges or Assume Identity (Integrity, Confidentiality, Availability, Access Control, Other)
  • Read Application Data (Integrity, Confidentiality, Availability, Access Control, Other)
  • Modify Application Data (Integrity, Confidentiality, Availability, Access Control, Other)
  • Execute Unauthorized Code or Commands (Integrity, Confidentiality, Availability, Access Control, Other)
  • Other (Integrity, Confidentiality, Availability, Access Control, Other)

How to prevent it

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.
  • Identify all exposed functionality. Explicitly list all functionality that must be exposed to some user or set of users. Identify which functionality may be: accessible to all users restricted to a small set of privileged users prevented from being directly accessible at all 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.

How to find it

  • 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.)

CWE-749 on MITRE's CWE site

Exploited in the wild: 2 CVEs

Vulnerabilities caused by CWE-749 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.

All known exploited vulnerabilities

H2 Security

Found it in your code?

We review where it appears, fix it with your team, and check it was not already used against you.

Talk to our team

T Academy

Stop writing it in the first place

Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.

Start free

Source: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.