This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "Race condition within a thread"
From OWASP
Weilin Zhong (talk | contribs) |
|||
Line 2: | Line 2: | ||
{{Template:SecureSoftware}} | {{Template:SecureSoftware}} | ||
− | == | + | [[Category:FIXME|This is the text from the old template. This needs to be rewritten using the new template.]] |
+ | |||
+ | Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' | ||
+ | |||
+ | [[ASDR_TOC_Vulnerabilities|Vulnerabilities Table of Contents]] | ||
+ | |||
+ | [[ASDR Table of Contents]] | ||
+ | __TOC__ | ||
+ | |||
+ | |||
+ | ==Description== | ||
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined. | If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined. | ||
− | + | '''Consequences''' | |
− | * Integrity: The main problem is that - if a lock is overcome - data could be altered in a bad state. | + | * Integrity: The main problem is that - if a lock is overcome - data could be altered in a bad state. |
− | + | '''Exposure period''' | |
− | * Design: Use a language which provides facilities to easily use threads safely. | + | * Design: Use a language which provides facilities to easily use threads safely. |
− | + | '''Platform''' | |
− | * Languages: Any language with threads | + | * Languages: Any language with threads |
+ | * Operating platforms: All | ||
− | + | '''Required resources''' | |
− | |||
− | |||
Any | Any | ||
− | + | '''Severity''' | |
High | High | ||
− | + | '''Likelihood of exploit''' | |
Medium | Medium | ||
− | + | * Design: Use locking functionality. This is the recommended solution. Implement some form of locking mechanism around code which alters or reads persistent data in a multi-threaded environment. | |
+ | |||
+ | * Design: Create resource-locking sanity checks. If no inherent locking mechanisms exist, use flags and signals to enforce your own blocking scheme when resources are being used by other threads of execution. | ||
+ | |||
− | == | + | ==Risk Factors== |
− | + | TBD | |
− | |||
− | ==Examples == | + | ==Examples== |
In C/C++: | In C/C++: | ||
Line 74: | Line 85: | ||
</pre> | </pre> | ||
− | |||
− | + | ==Related [[Attacks]]== | |
+ | |||
+ | * [[Attack 1]] | ||
+ | * [[Attack 2]] | ||
+ | |||
+ | |||
+ | ==Related [[Vulnerabilities]]== | ||
+ | |||
+ | * [[Vulnerability 1]] | ||
+ | * [[Vulnerabiltiy 2]] | ||
+ | |||
+ | ==Related [[Controls]]== | ||
+ | |||
+ | * [[Control 1]] | ||
+ | * [[Control 2]] | ||
+ | |||
+ | |||
+ | ==Related [[Technical Impacts]]== | ||
+ | |||
+ | * [[Technical Impact 1]] | ||
+ | * [[Technical Impact 2]] | ||
+ | |||
+ | |||
+ | ==References== | ||
+ | Note: A reference to related [http://cwe.mitre.org/ CWE] or [http://capec.mitre.org/ CAPEC] article should be added when exists. Eg: | ||
+ | |||
+ | * [http://cwe.mitre.org/data/definitions/79.html CWE 79]. | ||
+ | * http://www.link1.com | ||
+ | * [http://www.link2.com Title for the link2] | ||
+ | |||
+ | [[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:Synchronization and Timing Vulnerability]] | [[Category:Synchronization and Timing Vulnerability]] |
Revision as of 13:39, 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
Description
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
Consequences
- Integrity: The main problem is that - if a lock is overcome - data could be altered in a bad state.
Exposure period
- Design: Use a language which provides facilities to easily use threads safely.
Platform
- Languages: Any language with threads
- Operating platforms: All
Required resources
Any
Severity
High
Likelihood of exploit
Medium
- Design: Use locking functionality. This is the recommended solution. Implement some form of locking mechanism around code which alters or reads persistent data in a multi-threaded environment.
- Design: Create resource-locking sanity checks. If no inherent locking mechanisms exist, use flags and signals to enforce your own blocking scheme when resources are being used by other threads of execution.
Risk Factors
TBD
Examples
In C/C++:
int foo = 0; int storenum(int num) { static int counter = 0; counter++; if (num > foo) foo = num; return foo; }
In Java:
public classRace { static int foo = 0; public static void main() { new Threader().start(); foo = 1; } public static class Threader extends Thread { public void run() { System.out.println(foo); } } }
Related Attacks
Related Vulnerabilities
Related Controls
Related Technical Impacts
References
Note: A reference to related CWE or CAPEC article should be added when exists. Eg: