Logo
-

Byte Open Security

(ByteOS Network)

Log In

Sign Up

ByteOS

Security
Vulnerability Details
Registries
Custom Views
Weaknesses
Attack Patterns
Filters & Tools
CWE-468:Incorrect Pointer Scaling
Weakness ID:468
Version:v4.17
Weakness Name:Incorrect Pointer Scaling
Vulnerability Mapping:Allowed
Abstraction:Base
Structure:Simple
Status:Incomplete
Likelihood of Exploit:Medium
DetailsContent HistoryObserved CVE ExamplesReports
▼Description

In C and C++, one may often accidentally refer to the wrong memory due to the semantics of when math operations are implicitly scaled.

▼Extended Description

▼Alternate Terms
▼Relationships
Relevant to the view"Research Concepts - (1000)"
NatureMappingTypeIDName
ChildOfDiscouragedP682Incorrect Calculation
Nature: ChildOf
Mapping: Discouraged
Type: Pillar
ID: 682
Name: Incorrect Calculation
▼Memberships
NatureMappingTypeIDName
MemberOfProhibitedC465Pointer Issues
MemberOfProhibitedC737CERT C Secure Coding Standard (2008) Chapter 4 - Expressions (EXP)
MemberOfProhibitedV884CWE Cross-section
MemberOfProhibitedC998SFP Secondary Cluster: Glitch in Computation
MemberOfProhibitedC1160SEI CERT C Coding Standard - Guidelines 06. Arrays (ARR)
MemberOfProhibitedC1408Comprehensive Categorization: Incorrect Calculation
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 465
Name: Pointer Issues
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 737
Name: CERT C Secure Coding Standard (2008) Chapter 4 - Expressions (EXP)
Nature: MemberOf
Mapping: Prohibited
Type:View
ID: 884
Name: CWE Cross-section
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 998
Name: SFP Secondary Cluster: Glitch in Computation
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1160
Name: SEI CERT C Coding Standard - Guidelines 06. Arrays (ARR)
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1408
Name: Comprehensive Categorization: Incorrect Calculation
▼Tags
NatureMappingTypeIDName
MemberOfProhibitedBSBOSS-273Medium likelihood of exploit
MemberOfProhibitedBSBOSS-323Read Memory (impact)
MemberOfProhibitedBSBOSS-331Modify Memory (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-273
Name: Medium likelihood of exploit
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-323
Name: Read Memory (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-331
Name: Modify Memory (impact)
▼Relevant To View
Relevant to the view"Weaknesses Addressed by the SEI CERT C Coding Standard - (1154)"
NatureMappingTypeIDName
MemberOfProhibitedC1160SEI CERT C Coding Standard - Guidelines 06. Arrays (ARR)
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1160
Name: SEI CERT C Coding Standard - Guidelines 06. Arrays (ARR)
Relevant to the view"Software Development - (699)"
NatureMappingTypeIDName
MemberOfProhibitedC465Pointer Issues
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 465
Name: Pointer Issues
Relevant to the view"Software Fault Pattern (SFP) Clusters - (888)"
NatureMappingTypeIDName
MemberOfProhibitedC998SFP Secondary Cluster: Glitch in Computation
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 998
Name: SFP Secondary Cluster: Glitch in Computation
▼Background Detail

▼Common Consequences
ScopeLikelihoodImpactNote
ConfidentialityIntegrityN/ARead MemoryModify Memory

Incorrect pointer scaling will often result in buffer overflow conditions. Confidentiality can be compromised if the weakness is in the context of a buffer over-read or under-read.

Scope: Confidentiality, Integrity
Likelihood: N/A
Impact: Read Memory, Modify Memory
Note:

Incorrect pointer scaling will often result in buffer overflow conditions. Confidentiality can be compromised if the weakness is in the context of a buffer over-read or under-read.

▼Potential Mitigations
Phase:Architecture and Design
Mitigation ID:
Strategy:
Effectiveness:
Description:

Use a platform with high-level memory abstractions.

Note:


Phase:Implementation
Mitigation ID:
Strategy:
Effectiveness:
Description:

Always use array indexing instead of direct pointer manipulation.

Note:


Phase:Architecture and Design
Mitigation ID:
Strategy:
Effectiveness:
Description:

Use technologies for preventing buffer overflows.

Note:

▼Modes Of Introduction
Phase: Implementation
Note:

Programmers may try to index from a pointer by adding a number of bytes. This is incorrect because C and C++ implicitly scale the operand by the size of the data type.

▼Applicable Platforms
Languages
Class: C(Undetermined Prevalence)
Class: C++(Undetermined Prevalence)
▼Demonstrative Examples
Example 1

This example attempts to calculate the position of the second byte of a pointer.

Language: ( code)
N/A

Language: C(Bad code)
int *p = x; char * second_char = (char *)(p + 1);

Language: ( code)
N/A

In this example, second_char is intended to point to the second byte of p. But, adding 1 to p actually adds sizeof(int) to p, giving a result that is incorrect (3 bytes off on 32-bit platforms). If the resulting memory address is read, this could potentially be an information leak. If it is a write, it could be a security-critical write to unauthorized memory-- whether or not it is a buffer overflow. Note that the above code may also be wrong in other ways, particularly in a little endian environment.

▼Observed Examples
ReferenceDescription
▼Affected Resources
    ▼Functional Areas
      ▼Weakness Ordinalities
      OrdinalityDescription
      ▼Detection Methods
      ▼Vulnerability Mapping Notes
      Usage:Allowed
      Reason:Acceptable-Use
      Rationale:

      This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.

      Comments:

      Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

      Suggestions:
      ▼Notes
      ▼Taxonomy Mappings
      Taxonomy NameEntry IDFitEntry Name
      CLASPN/AN/AUnintentional pointer scaling
      CERT C Secure CodingARR39-CExactDo not add or subtract a scaled integer to a pointer
      CERT C Secure CodingEXP08-CN/AEnsure pointer arithmetic is used correctly
      Software Fault PatternsSFP1N/AGlitch in computation
      Taxonomy Name: CLASP
      Entry ID: N/A
      Fit: N/A
      Entry Name: Unintentional pointer scaling
      Taxonomy Name: CERT C Secure Coding
      Entry ID: ARR39-C
      Fit: Exact
      Entry Name: Do not add or subtract a scaled integer to a pointer
      Taxonomy Name: CERT C Secure Coding
      Entry ID: EXP08-C
      Fit: N/A
      Entry Name: Ensure pointer arithmetic is used correctly
      Taxonomy Name: Software Fault Patterns
      Entry ID: SFP1
      Fit: N/A
      Entry Name: Glitch in computation
      ▼Related Attack Patterns
      IDName
      ▼References
      Reference ID: REF-18
      Title: The CLASP Application Security Process
      Author: Secure Software, Inc.
      Section:
      Publication:
      Publisher:
      Edition:
      URL:https://cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf
      URL Date:2024-11-17
      Day:N/A
      Month:N/A
      Year:2005
      Reference ID: REF-62
      Title: The Art of Software Security Assessment
      Author: Mark Dowd, John McDonald, Justin Schuh
      Section: Chapter 6, "Pointer Arithmetic", Page 277
      Publication:
      Publisher:Addison Wesley
      Edition:1st Edition
      URL:
      URL Date:
      Day:N/A
      Month:N/A
      Year:2006
      Details not found