CWE-463: Deletion of Data Structure Sentinel
Official CWE-463 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Glexia's Take
CWE-463: Deletion of Data Structure Sentinel
Deletion of Data Structure Sentinel represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Availability,Other: Other: Generally this error will cause the data structure to not work properly.
- Authorization,Other: Other: If a control character, such as NULL is removed, one may cause resource access control problems.
Developer Pattern
CWE-463 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-463, 4.20.
Official CWE Definition
CWE-463: Deletion of Data Structure Sentinel
The accidental deletion of a data-structure sentinel can cause serious programming logic problems.
Often times data-structure sentinels are used to mark structure of the data structure. A common example of this is the null character at the end of strings. Another common example is linked lists which may contain a sentinel to mark the end of the list. It is dangerous to allow this type of control data to be easily accessible. Therefore, it is important to protect from the deletion or modification outside of some wrapper interface which provides safety.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- This example creates a null terminated string and prints it contents. The string foo has space for 9 characters and a null terminator, but 10 characters are written to it. As a result, the string foo is not null terminated and calling printf() on it will have unpredictable and possibly dangerous results.
Remediation
- Architecture and Design: Use an abstraction library to abstract away risky APIs. Not a complete solution.
- Build and Compilation: [object Object]
- Operation: Use OS-level preventative functionality. Not a complete solution.
Detection
- Code review
- SAST
- DAST
- Focused regression tests
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.