Category: 7PK - API Abuse

Draft
Summary

This category represents one of the phyla in the Seven Pernicious Kingdoms vulnerability classification. It includes weaknesses that involve the software using an API in a manner contrary to its intended use. According to the authors of the Seven Pernicious Kingdoms, "An API is a contract between a caller and a callee. The most common forms of API misuse occurs when the caller does not honor its end of this contract. For example, if a program does not call chdir() after calling chroot(), it violates the contract that specifies how to change the active root directory in a secure fashion. Another good example of library abuse is expecting the callee to return trustworthy DNS information to the caller. In this case, the caller misuses the callee API by making certain assumptions about its behavior (that the return value can be used for authentication purposes). One can also violate the caller-callee contract from the other side. For example, if a coder subclasses SecureRandom and returns a non-random value, the contract is violated."

Membership
IDNameDescription
CWE-242Use of Inherently Dangerous FunctionThis vulnerability occurs when code uses functions that are inherently unsafe and cannot be reliably secured, posing a direct risk to application stability and security.
CWE-243Creation of chroot Jail Without Changing Working DirectoryThis vulnerability occurs when a program creates a chroot jail but fails to change its current working directory afterward. Because the process's working directory remains outside the jail, attackers can use relative paths to access files and directories that should be restricted.
CWE-244Improper Clearing of Heap Memory Before Release ('Heap Inspection')Using realloc() to resize buffers containing secrets like passwords or keys can leave that sensitive data exposed in memory, as the original data is not securely erased.
CWE-245J2EE Bad Practices: Direct Management of ConnectionsThis vulnerability occurs when a J2EE application handles database connections directly instead of using the container's built-in connection management system.
CWE-246J2EE Bad Practices: Direct Use of SocketsThis vulnerability occurs when a J2EE application creates network sockets directly, bypassing the container-managed communication framework provided by the platform.
CWE-248Uncaught ExceptionThis vulnerability occurs when a function throws an error or exception, but the calling code does not have a proper handler to catch and manage it.
CWE-250Execution with Unnecessary PrivilegesThis vulnerability occurs when software runs with higher permissions than it actually needs to perform its tasks. This excessive privilege creates security risks by opening doors to new attacks or making existing weaknesses more dangerous.
CWE-252Unchecked Return ValueThis vulnerability occurs when a program fails to verify the result of a function or method call, allowing it to continue execution without detecting errors or unexpected conditions.
CWE-558Use of getlogin() in Multithreaded ApplicationUsing the getlogin() function in a multithreaded application can lead to unreliable or incorrect username results, creating security and logic flaws.
CWE-700Seven Pernicious KingdomsThis view (graph) organizes weaknesses using a hierarchical structure that is similar to that used by Seven Pernicious Kingdoms.
CWE-251Often Misused: String ManagementFunctions that manipulate strings encourage buffer overflows.
Vulnerability Mapping Notes
Usage: Prohibited
Reasons: Category
Rationale:
This entry is a Category. Using categories for mapping has been discouraged since 2019. Categories are informal organizational groupings of weaknesses that can help CWE users with data aggregation, navigation, and browsing. However, they are not weaknesses in themselves.
Comment:
See member weaknesses of this category.