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 in switch"

From OWASP
Jump to: navigation, search
(Reverting to last version not containing links to s1.shard.jp)
 
Line 1: Line 1:
[http://s1.shard.jp/olharder/auto-escort-ford.html autobahn vw parts
 
] [http://s1.shard.jp/galeach/new134.html what is the largest desert in asia
 
] [http://s1.shard.jp/bireba/nortan-antivirus.html kasperskiy antivirus
 
] [http://s1.shard.jp/galeach/new145.html 99bb asian4you
 
] [http://s1.shard.jp/olharder/cheat-sheets.html automation de device net rockwell
 
] [http://s1.shard.jp/frhorton/ufkvsduv1.html african crafts art work
 
] [http://s1.shard.jp/olharder/autorizadas.html automobile insurance lead
 
] [http://s1.shard.jp/galeach/new53.html plantasia bolton ma
 
] [http://s1.shard.jp/frhorton/kcixkr2qy.html stoncor africa
 
] [http://s1.shard.jp/losaul/ash-australia.html sydney australia restaurants
 
] [http://s1.shard.jp/olharder/autoroll-654.html sitemap] [http://s1.shard.jp/frhorton/ank33l6la.html photo gallery of african american micro braids] [http://s1.shard.jp/olharder/autoroll-654.html page] [http://s1.shard.jp/losaul/property-for.html major banks in australia
 
] [http://s1.shard.jp/frhorton/b9vqclfhc.html african napkin ring
 
] [http://s1.shard.jp/olharder/autoroll-654.html http] [http://s1.shard.jp/olharder/used-automobile.html auto brake service
 
] [http://s1.shard.jp/olharder/autoritatea-nationala.html automotive car accessory
 
] [http://s1.shard.jp/olharder/premium-autoboomru.html automobile customizing philadelphia
 
] [http://s1.shard.jp/losaul/australian-sheepskin.html australian folktales
 
] [http://s1.shard.jp/losaul/australia-installation.html australian shepherd calendar
 
] [http://s1.shard.jp/bireba/download-antivirus.html av antivirus free
 
] [http://s1.shard.jp/olharder/invicta-speedway.html invicta speedway automatic] [http://s1.shard.jp/frhorton/928f3x2wr.html south african beauty
 
] [http://s1.shard.jp/olharder/ch-futterautomat.html autodisconnect windows xp
 
] [http://s1.shard.jp/bireba/remove-norton-antivirus.html panda software antivirus online
 
] [http://s1.shard.jp/galeach/new153.html asia business business guide guide india s
 
] [http://s1.shard.jp/losaul/informed-sources.html informed sources australia] [http://s1.shard.jp/frhorton/77iqsoujy.html south africa tourist office london
 
] [http://s1.shard.jp/losaul/nikon-d70-price.html immagration australia
 
] [http://s1.shard.jp/frhorton/1aql7wt5f.html hog hollow south africa
 
] [http://s1.shard.jp/olharder/slayers-autoinstaller.html automated gui test
 
] [http://s1.shard.jp/bireba/norton-antivirus.html download panda antivirus software
 
] [http://s1.shard.jp/olharder/auto-bank-repossessed.html steeda autosports
 
] [http://s1.shard.jp/frhorton/4dyaal72j.html african slave picture
 
] [http://s1.shard.jp/bireba/alertaantivirus.html avg antivirus free software download
 
] [http://s1.shard.jp/galeach/new140.html telangiectasia and imiquimod
 
] [http://s1.shard.jp/losaul/school-camps.html art australia history
 
] [http://s1.shard.jp/bireba/panda-online-antivirus.html download keygen norton antivirus 2005
 
] [http://s1.shard.jp/frhorton/9rxlvcl6n.html south african schools list
 
] [http://s1.shard.jp/losaul/jamsteraustraliaautomarketsolcomau.html sydney australia motels
 
] [http://s1.shard.jp/olharder/auto-wrap-graphics.html jmw auto sales
 
] [http://s1.shard.jp/olharder/angeles-auto-body.html angeles auto body los painting repair] [http://s1.shard.jp/galeach/new17.html asian footbal
 
] [http://s1.shard.jp/olharder/dacoma-automotive.html autocatalytic reactions
 
] [http://s1.shard.jp/olharder/automation-building.html automotive test lab
 
] [http://s1.shard.jp/bireba/antivirus-software.html mac antivirus download
 
] [http://s1.shard.jp/galeach/new52.html aid asian eu humanitarian
 
 
 
{{template:CandidateForDeletion}}
 
{{template:CandidateForDeletion}}
  

Latest revision as of 06:50, 3 June 2009

Template:CandidateForDeletion

#REDIRECT Race Conditions



Last revision (mm/dd/yy): 06/3/2009


Description

If the variable which is switched on is changed while the switch statement is still in progress, undefined activity may occur.

Consequences

  • Undefined: This flaw will result in the system state going out of sync.

Exposure period

  • Implementation: Variable locking is the purview of implementers.

Platform

  • Languages: All that allow for multi-threaded activity
  • Operating platforms: All

Required resources

Any

Severity

Medium

Likelihood of exploit

Medium

This issue is particularly important in the case of switch statements that involve fall-through style case statements - i.e., those which do not end with break.

If the variable which we are switching on change in the course of execution, the actions carried out may place the state of the process in a contradictory state or even result in memory corruption.

For this reason, it is important to ensure that all variables involved in switch statements are locked before the statement starts and are unlocked when the statement ends.


Risk Factors

TBD

Examples

In C/C++:

#include <sys/types.h>
#include <sys/stat.h>

int main(argc,argv){
        struct stat *sb;
        time_t timer;

        lstat("bar.sh",sb);

        printf("%d\n",sb->st_ctime);
        switch(sb->st_ctime % 2){
                case 0: printf("One option\n");break;
                case 1: printf("another option\n");break;
                default: printf("huh\n");break;
        }

        return 0;
}


Related Attacks


Related Vulnerabilities

Related Controls

  • Implementation: Variables that may be subject to race conditions should be locked for the duration of any switch statements.


Related Technical Impacts


References

TBD