CWEweakness
CWE-242 Use of Inherently Dangerous Function
High
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- C, C++
- CWE version
- 5.0
Description
The product calls a function that can never be guaranteed to work safely, regardless of how it is used.
Common consequences
• Other: Varies by Context — The consequences vary depending on the behavior of the affected function.
• Other: Modify Memory — Some functions can be subject to buffer overflows. For example, an attacker can easily send arbitrarily-sized input to gets() and overflow the destination buffer. In C++, an attacker can easily send arbitrarily-sized input to the >> operator and overflow the destination buffer.
Potential mitigations
• [Build and Compilation, Implementation] Identify a list of prohibited API functions and prohibit developers from using these functions, providing safer alternatives. In some cases, automatic code analysis tools or the compiler can be instructed to spot use of prohibited functions, such as the "banned.h" include file from Microsoft's SDL. [REF-554] [REF-1009] [REF-7]
• [Testing] Use grep or static analysis tools to spot usage of dangerous functions.
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.)
Observed examples
• CVE-2007-4004: FTP client uses inherently insecure gets() function and is setuid root on some systems, allowing buffer overflow
Related
Observed example · CVE (1)
- CVE-2007-4004 Buffer overflow in the ftp client in IBM AIX 5.3 SP6 and 5.2.0 allows local users to execute arbitrary code via unspecified vectors that… vulnerability
Child of · CWE (1)
- CWE-1177 Use of Prohibited Code weakness
Referenced by CVE · weakness (11)
- CVE-2026-11980 IBM Aspera Desktop App 1.0.5 through 1.0.19 can allow arbitrary code execution by loading DLL files at start-up. vulnerability
- CVE-2026-6477 Use of inherently dangerous function PQfn(..., result_is_int=0, ...) in PostgreSQL libpq lo_export(), lo_read(), lo_lseek64(), and… vulnerability
- CVE-2025-1994 IBM Cognos Command Center 10.2.4.1 and 10.2.5 could allow a local user to execute arbitrary code on the system due to the use of unsafe use… vulnerability
- CVE-2025-49215 A post-auth SQL injection vulnerability in the Trend Micro Endpoint Encryption PolicyServer could allow an attacker to escalate privileges… vulnerability
- CVE-2025-1331 IBM CICS TX Standard 11.1 and IBM CICS TX Advanced 10.1 and 11.1 could allow a local user to execute arbitrary code on the system due to… vulnerability
- CVE-2024-52324 Ruijie Reyee OS versions 2.206.x up to but not including 2.320.x uses an inherently dangerous function which could allow an attacker to… vulnerability
- CVE-2021-40698 ColdFusion version 2021 update 1 (and earlier) and versions 2018.10 (and earlier) are impacted by an Use of Inherently Dangerous Function… vulnerability
- CVE-2022-36310 Airspan AirVelocity 1500 software prior to version 15.18.00.2511 had NET-SNMP-EXTEND-MIB enabled on its snmpd service, enabling an attacker… vulnerability
- CVE-2021-42543 The affected application uses specific functions that could be abused through a crafted project file, which could lead to code execution,… vulnerability
- CVE-2017-1002157 modulemd 1.3.1 and earlier uses an unsafe function for processing externally provided data, leading to remote code execution. vulnerability
- CVE-2017-0904 The private_address_check ruby gem before 0.4.0 is vulnerable to a bypass due to use of Ruby's Resolv.getaddresses method, which is… vulnerability