CWE
Home > CWE List > CWE-227 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-227 Individual Dictionary Definition (Draft 9)

Failure to Fulfill API Contract (aka 'API Abuse')
Weakness ID
Status: Draft

227 (Weakness Class)

Description

Summary

The software uses an API in a manner contrary to its intended use.

Extended Description

An API is a contract between a caller and a callee. The most common forms of API misuse are caused by the caller failing to honor its end of this contract. For example, if a program fails to 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.

Alternate Terms

API Abuse

Potential Mitigations

Always utilize APIs in the specified manner.

Observed Examples
ReferenceDescription
CVE-2006-7140crypto implementation removes padding when they shouldn't, allowing forged signatures
CVE-2006-4339crypto implementation removes padding when they shouldn't, allowing forged signatures
Relationships
NatureTypeIDName
ChildOfCategoryCategory18Source Code
ParentOfCategoryCategory559Often Misused: Arguments and Parameters
ParentOfWeakness ClassWeakness ClassWeakness Class573Failure to Follow Specification
ParentOfWeakness VariantWeakness VariantWeakness Variant586Explicit Call to Finalize
ParentOfWeakness BaseWeakness BaseWeakness Base648Improper Use of Privileged APIs
ParentOfWeakness VariantWeakness VariantWeakness Variant650Trusting HTTP Permission Methods on the Server Side
PeerOfWeakness ClassWeakness ClassWeakness Class675Duplicate Operations on Resource
ParentOfWeakness BaseWeakness BaseWeakness Base684Failure to Provide Specified Functionality
IsRequiredByCompound Element: CompositeCompound Element: Composite120Unbounded Transfer ('Classic Buffer Overflow')
Source Taxonomies

7 Pernicious Kingdoms - API Abuse

Related Attack Patterns
CAPEC-IDAttack Pattern Name
96Block Access to Libraries
Page Last Updated: April 22, 2008