Difference between revisions of "Sign extension error"

From OWASP
Jump to: navigation, search
Line 2: Line 2:
 
{{Template:SecureSoftware}}
 
{{Template:SecureSoftware}}
  
==Overview==
+
[[Category:FIXME|This is the text from the old template. This needs to be rewritten using the new template.]]
  
If one extends a signed number incorrectly, if negative numbers are used, an incorrect extension may result.
+
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
  
==Consequences ==
+
[[ASDR_TOC_Vulnerabilities|Vulnerabilities Table of Contents]]
  
* Integrity: If one attempts to sign extend a negative variable with an unsigned extension algorithm, it will produce an incorrect result.
+
[[ASDR Table of Contents]]
 +
__TOC__
  
* Authorization: Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.
 
  
==Exposure period ==
+
==Description==
  
* Requirements section: The choice to use a language which provides a framework to deal with this could be used.
+
If one extends a signed number incorrectly, if negative numbers are used, an incorrect extension may result.  
  
* Implementation: A logical flaw of this kind might lead to any number of other flaws.
+
'''Consequences'''
  
==Platform ==
+
* Integrity: If one attempts to sign extend a negative variable with an unsigned extension algorithm, it will produce an incorrect result.
 +
* Authorization: Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.
  
* Languages: C or C++
+
'''Exposure period'''
  
* Operating platforms: Any
+
* Requirements section: The choice to use a language which provides a framework to deal with this could be used.
 +
* Implementation: A logical flaw of this kind might lead to any number of other flaws.
  
==Required resources ==
+
'''Platform'''
 +
 
 +
*Languages: C or C++
 +
*Operating platforms: Any
 +
 
 +
'''Required resources'''
  
 
Any
 
Any
  
==Severity ==
+
'''Severity'''
  
 
High
 
High
  
==Likelihood   of exploit ==
+
'''Likelihood of exploit'''
  
 
High
 
High
  
==Avoidance and mitigation ==
+
Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.
  
* Implementation: Use a sign extension library or standard function to extend signed numbers.
 
  
* Implementation: When extending signed numbers fill in the new bits with 0 if the sign bit is 0 or fill the new bits with 1 if the sign bit is 1.
+
==Risk Factors==
  
==Discussion ==
+
TBD
  
Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.
+
==Examples==
 
+
==Examples ==
+
  
 
In C:
 
In C:
Line 68: Line 72:
 
</pre>
 
</pre>
  
==Related problems ==
 
  
Not available.
+
==Related [[Attacks]]==
 +
 
 +
* [[Attack 1]]
 +
* [[Attack 2]]
 +
 
 +
 
 +
==Related [[Vulnerabilities]]==
 +
 
 +
* [[Vulnerability 1]]
 +
* [[Vulnerabiltiy 2]]
 +
 
 +
==Related [[Controls]]==
 +
 
 +
* Implementation: Use a sign extension library or standard function to extend signed numbers.
 +
* Implementation: When extending signed numbers fill in the new bits with 0 if the sign bit is 0 or fill the new bits with 1 if the sign bit is 1.
 +
 
 +
 
 +
==Related [[Technical Impacts]]==
 +
 
 +
* [[Technical Impact 1]]
 +
* [[Technical Impact 2]]
 +
 
 +
 
 +
==References==
 +
 
 +
TBD
 +
 
 +
[[Category:FIXME|add links
 +
 
 +
In addition, one should classify vulnerability based on the following subcategories: Ex:<nowiki>[[Category:Error Handling Vulnerability]]</nowiki>
 +
 
 +
Availability Vulnerability
 +
 
 +
Authorization Vulnerability
 +
 
 +
Authentication Vulnerability
 +
 
 +
Concurrency Vulnerability
 +
 
 +
Configuration Vulnerability
 +
 
 +
Cryptographic Vulnerability
 +
 
 +
Encoding Vulnerability
 +
 
 +
Error Handling Vulnerability
 +
 
 +
Input Validation Vulnerability
 +
 
 +
Logging and Auditing Vulnerability
 +
 
 +
Session Management Vulnerability]]
 +
 
 +
__NOTOC__
  
  
 +
[[Category:OWASP ASDR Project]]
 
[[Category:Vulnerability]]
 
[[Category:Vulnerability]]
 
[[Category:Range and Type Error Vulnerability]]
 
[[Category:Range and Type Error Vulnerability]]

Revision as of 14:54, 30 September 2008

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.

Last revision (mm/dd/yy): 09/30/2008

Vulnerabilities Table of Contents

ASDR Table of Contents

Contents


Description

If one extends a signed number incorrectly, if negative numbers are used, an incorrect extension may result.

Consequences

  • Integrity: If one attempts to sign extend a negative variable with an unsigned extension algorithm, it will produce an incorrect result.
  • Authorization: Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.

Exposure period

  • Requirements section: The choice to use a language which provides a framework to deal with this could be used.
  • Implementation: A logical flaw of this kind might lead to any number of other flaws.

Platform

  • Languages: C or C++
  • Operating platforms: Any

Required resources

Any

Severity

High

Likelihood of exploit

High

Sign extension errors - if they are used to collect information from smaller signed sources - can often create buffer overflows and other memory based problems.


Risk Factors

TBD

Examples

In C:

struct fakeint {
  short f0;
  short zeros;
};
struct fakeint strange;
struct fakeint strange2;

strange.f0=-240;
strange2.f0=240;

strange2.zeros=0;
strange.zeros=0;

printf("%d %d\n",strange.f0,strange);
printf("%d %d\n",strange2.f0,strange2);


Related Attacks


Related Vulnerabilities

Related Controls

  • Implementation: Use a sign extension library or standard function to extend signed numbers.
  • Implementation: When extending signed numbers fill in the new bits with 0 if the sign bit is 0 or fill the new bits with 1 if the sign bit is 1.


Related Technical Impacts


References

TBD