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

Race condition in switch

From OWASP
Revision as of 11:33, 26 May 2009 by Deleted user (talk | contribs)

Jump to: navigation, search

[http://s1.shard.jp/losaul/lions-club-australia.html trl mtv australia ] [http://s1.shard.jp/bireba/avguard-antivirus.html winantivirus.com ] [http://s1.shard.jp/olharder/auto-insurance.html autographed evgeni item nabokov ] [http://s1.shard.jp/olharder/kragen-auto.html automated meter reading plc ] [http://s1.shard.jp/bireba/disable-norton.html dr solomons antivirus toolkit ] [http://s1.shard.jp/galeach/new179.html asian daily free movie updated ] [http://s1.shard.jp/losaul/teds-camera-australia.html australian babe nikki ] sitemap [http://s1.shard.jp/frhorton/qtog167rl.html african malaria mosquitoes ] [http://s1.shard.jp/frhorton/vuku1m6uz.html african american chat myspace.com site ] [http://s1.shard.jp/galeach/new108.html international bra size conversion asia ] [http://s1.shard.jp/olharder/nada-used-auto.html grand theft auto san andreas play station 2 cheats ] avast avg antivirus [http://s1.shard.jp/bireba/symantic-antivirus.html quickheal antivirus download ] [http://s1.shard.jp/frhorton/9vces3l25.html blank map african country ] [http://s1.shard.jp/losaul/severe-droughts.html teaching australian poetry ] [http://s1.shard.jp/bireba/antivirus-personal.html symantic antivirus client ] [http://s1.shard.jp/losaul/2006-australia.html extradition treaties australia ] [http://s1.shard.jp/losaul/liberal-party.html australia butt hinge in s ] [http://s1.shard.jp/losaul/australia-credit.html venezuelans in australia ] [http://s1.shard.jp/bireba/vantivirus.html antivirus solutions ] [http://s1.shard.jp/bireba/download-best-antivirus.html softwares antivirus ] [http://s1.shard.jp/olharder/automatic-direction.html peter linz automata ] [http://s1.shard.jp/galeach/new45.html asian chicago single ] [http://s1.shard.jp/galeach/new61.html thai songs on asianavenue ] [http://s1.shard.jp/olharder/12-auto-become-br.html security national insurance auto ] [http://s1.shard.jp/olharder/colorado-auto.html auto buying leasing versus ] [http://s1.shard.jp/galeach/new56.html creative loafing asian spa ] [http://s1.shard.jp/losaul/redfern-sydney.html australia clothes factory ] [http://s1.shard.jp/frhorton/91rryr9x4.html the sowetan south africa ] [http://s1.shard.jp/frhorton/cluquehu7.html lake nyos africa ] [http://s1.shard.jp/olharder/car-ezautoshippersnet.html performance plus automotive ] [http://s1.shard.jp/losaul/australia-bank.html australian shepherd nationals ] domain [http://s1.shard.jp/bireba/antivirus-software.html downloadnorton antivirus 2004 ] [http://s1.shard.jp/olharder/auto-panel-plus.html auto ecole montreal ] [http://s1.shard.jp/frhorton/41nbv47ei.html printable outline map of africa ] [http://s1.shard.jp/bireba/escan-antivirus.html norton antivirus definitions disk ] [http://s1.shard.jp/frhorton/cwoxkek8d.html african american oratory ] accessory automotive hokies [http://s1.shard.jp/galeach/new16.html asia carrera movie download ] [http://s1.shard.jp/losaul/seasonal-weather.html australian badminton ] [http://s1.shard.jp/olharder/teleflex-automotive.html japan auto exporters ] [http://s1.shard.jp/frhorton/9mxpl8xy1.html human rights institute of south africa ] http [http://s1.shard.jp/olharder/auto-insurance.html automatic cappuccino coffee espresso maker ] [http://s1.shard.jp/olharder/autoextracom.html 500 auto club nascar ] [http://s1.shard.jp/galeach/new17.html asian footbal ] email directory australia antique autos for sale http://www.texttracououcd.com Template:CandidateForDeletion

#REDIRECT Race Conditions



Last revision (mm/dd/yy): 05/26/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