theprogramwhenprocessingasampleexploitItassignssymbolicvaluesb0b1b2b3tothebytesintheexploitmessagesandkeepstrackofsymbolicstatefortheprocessorandmemoryForexampleifinputpointstoabuerwiththee ID: 321522
Download Pdf The PPT/PDF document "Bouncer:SecuringSoftwarebyBlockingBadInp..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Bouncer:SecuringSoftwarebyBlockingBadInputManuelCostaMicrosoftResearchCambridge,UKmanuelc@microsoft.comMiguelCastroMicrosoftResearchCambridge,UKmcastro@microsoft.comLidongZhouMicrosoftResearchMountainView,USAlidongz@microsoft.comLintaoZhangMicrosoftResearchMountainView,USAlintaoz@microsoft.comMarcusPeinadoMicrosoftRedmond,USAmarcuspe@microsoft.comAbstractAttackersexploitsoftwarevulnerabilitiestocontrolorcrashprograms.Bouncerusesexistingsoftwareinstrumentationtechniquestodetectattacksanditgeneratesltersauto-maticallytoblockexploitsofthetargetvulnerabilities.Theltersaredeployedautomaticallybyinstrumentingsystemcallstodropexploitmessages.Theseltersintroducelowoverheadandtheyallowprogramstokeeprunningcorrectlyunderattack.Previousworkcomputesltersusingsymbolicexecutionalongthepathtakenbyasampleexploit,butat-tackerscanbypasstheseltersbygeneratingexploitsthatfollowadierentexecutionpath.Bouncerintroducesthreetechniquestogeneralizelterssothattheyarehardertobypass:anewformofprogramslicingthatusesacombina-tionofstaticanddynamicanalysistoremoveunnecessaryconditionsfromthelter;symbolicsummariesforcommonlibraryfunctionsthatcharacterizetheirbehaviorsuccinctlyasasetofconditionsontheinput;andgenerationofalterna-tiveexploitsguidedbysymbolicexecution.Bouncerltershavelowoverhead,theydonothavefalsepositivesbyde-sign,andourresultsshowthatBouncercangenerateltersthatblockallexploitsofsomereal-worldvulnerabilities.CategoriesandSubjectDescriptorsD.4.6[OperatingSystems]:SecurityandProtection;D.4.5[OperatingSystems]:Reliability;D.4.8[OperatingSys-tems]:PerformanceGeneralTermsSecurity,Reliability,Availability,Performance,Algorithms,Design,MeasurementKeywordsPreconditionslicing,SymbolicexecutionPermissiontomakedigitalorhardcopiesofallorpartofthisworkforpersonalorclassroomuseisgrantedwithoutfeeprovidedthatcopiesarenotmadeordistributedforprotorcommercialadvantageandthatcopiesbearthisnoticeandthefullcitationontherstpage.Tocopyotherwise,torepublish,topostonserversortoredistributetolists,requirespriorspecicpermissionand/orafee.SOSP'07,October1417,2007,Stevenson,Washington,USA.Copyright2007ACM978-1-59593-591-5/07/0010...$5.00.1.INTRODUCTIONAttackersexploitsoftwarevulnerabilitiestocrashpro-gramsortogaincontrolovertheirexecution.Thisisaseriousproblembecausetherearemanyvulnerabilitiesandattacksarefrequent.WedescribeBouncer,asystemthatpreventsattacksbydroppingexploitmessagesbeforetheyareprocessedbyavulnerableprogram.Bouncerintroduceslowoverheadanditallowsprogramstokeeprunningcor-rectlyevenwhenunderattack.Severaltechniquesdetect(potentiallyunknown)attacksbyaddingcheckstoprograms:safelanguagesincludecheckstoensuretypesafetyandtheythrowexceptionswhenthechecksfail(e.g.,JavaandC#),andcheckscanbeaddedtransparentlytoprogramswritteninunsafelanguages(e.g.,[4,12,13,16,17,28,40]).Theproblemisthatthesetech-niquesdetectattackstoolatewhentheonlywaytorecovermaybetorestarttheprogram.Forexample,CRED[40]addsboundscheckstopreventbuerover\rowsinCpro-grams.Thesepreventtheattackerfromgainingcontrolovertheexecution,buthowdowerecoverwhenanattackcausesaboundschecktofail?Intheabsenceofadditionalmech-anism,restartingtheprogramistheonlyoptionbecausetheprogramdoesnotincludeanycodetorecoverfromthefailure.Thisproblemisnotexclusivetounsafelanguages.Eventhoughout-of-boundsexceptionsarepartoftypesafelanguages,programsfrequentlylackcorrectcodetohandleruntimeexceptions[48].Therefore,thesetechniquesarenotsucient.Theyleaveservicesvulnerabletolossofdataanddenialofservice.Bouncerimprovesthereliabilityandavailabilityofpro-gramsunderattack.Itusesprevioustechniquestodetectattemptstoexploitavulnerabilityanditgeneratesltersautomaticallytomatchmessagesthatcanexploitthevul-nerability.Theltersaredeployedautomaticallybyinstru-mentingsystemcallstorunthelteronincomingmessagesandtodropexploitmessagesbeforetheyaredeliveredtothevulnerableprogram.Wedesignedthesystemtoensurethattheseltershavelowoverheadandnofalsepositives,thatis,theyonlydropmessagesthatcanexploitthevulner-ability.Sincemostprogramscancopewithmessagelossesandltershavenofalsepositives,Bouncerallowsprogramstokeepworkingcorrectlyandecientlyevenwhentheyareattackedrepeatedly.BouncerbuildsonVigilante's[16]techniquetogenerateltersautomatically.Itcomputesaninitialsetofltercon-ditionsusingsymbolicexecutionalongthepathfollowedby theprogramwhenprocessingasampleexploit.Itassignssymbolicvaluesb0;b1;b2;b3:::tothebytesintheexploitmessages,andkeepstrackofsymbolicstatefortheprocessorandmemory.Forexample,ifinputpointstoabuerwiththeexploitbytes,registereaxhassymbolicvalueb0+1af-terexecutingmovzxeax,input;addeax,1.Wheneveraconditionalbranchisexecuted,weaddaconditiontotheltertoensurethatinputsthatsatisfythelterconditionsfollowthesameexecutionpath.Continuingwiththepre-viousexample,ifcmpeax,2;jgtargetisexecutedandthebranchistaken,weaddtheconditionb0+12tothelter.Thistechniqueguaranteesnofalsepositives:anyinputthatsatisesthelterconditionscanmakethepro-gramfollowthesameexecutionpathasthesampleexploit.Theseltersblockmanyvariantsofthesampleexploit,butattackerscanbypassthembygeneratingexploitsthatfollowadierentexecutionpath.Bouncerintroducesthreepracticaltechniquestogeneral-izetheinitialltertoblockadditionalexploitsofthesamevulnerability:Preconditionslicingisanewformofprogramslic-ing[49]thatusesacombinationofstaticanddynamicanalysistoremoveunnecessarylterconditions.Symbolicsummariesgeneralizetheconditionscapturedbythesymbolicexecutioninsidecommonlibraryfunc-tions.Theyreplacetheseconditionsbyasuccinctsetofconditionsthatcharacterizethebehaviorofthesefunctionsforabroadersetofinputs.Thesesummariesaregeneratedautomaticallyfromatemplatethatiswrittenonceforeachlibraryfunction.Generationofalternativeexploitsguidedbysymbolicexecution.Bouncerusestheinitialexploitmessageandtheconditionsobtainedfromsymbolicexecutiontoderivenewinputmessagesthatarelikelytoexploitthesamevulnerability.Itusesexistingtechniquestocheckifthenewinputmessagesarevalidexploits,anditcomputesanewsetoflterconditionsforeachnewexploit.Thenallterisacombinationoftheltersobtainedforeachexploit.WeimplementedBouncerandevaluateditusingfourvul-nerabilitiesinfourrealprograms:MicrosoftSQLserver,ghttpd,nullhttpd,andstunnel.TheresultsshowthatBouncersignicantlyimprovesthecoverageofVigilantel-ters,andthatltersintroducelowoverhead.Computingalterthatblocksexactlythesetofmes-sagesthatcanexploitavulnerabilityissimilartocomputingweakestpreconditions[15,20],whichishardforprogramswithloopsorrecursion[50].Sinceweguaranteezerofalsepositives,wedonotguaranteezerofalsenegatives,thatis,Bouncerltersmayfailtoblocksomeexploitsofthetar-getvulnerability.Butourinitialresultsarepromising:adetailedanalysisofthevulnerablecodeshowsthatBouncercangeneratelterswithnofalsenegativesforthevulnera-bilitiesinSQLserverandstunnel.Therestofthepaperisorganizedasfollows.Section2providesanoverviewofBouncer.Section3describeshowBouncercomputesaninitialsetoflterconditionsusingsymbolicexecution.Section4describeslterrenementwithimproveddetectoraccuracy.Section5presentspre-conditionslicing.Section6describessymbolicsummaries.Section7describestheproceduretosearchforalternativeattacks.Section8presentstheresultsofourevaluation.Section9discussesrelatedworkandSection10concludes.ProcessMessage(char*msg){charbuffer[1024];charp0='A';charp1=0;if(msg[0]0)p0=msg[0];if(msg[1]0)p1=msg[1];if(msg[2]==0x1){sprintf(buffer,"\\servers\\%s\\%c",msg+3,p0);StartServer(buffer,p1);}}Figure1:Examplevulnerablecode:sprintfcanover\rowbuffer.2.OVERVIEWANDBACKGROUNDVulnerabilitiesinthecontextofthispaperareprogramerrorsthatanattackercanexploittomakethevulnerableprogramdeviatefromitsspecication.Anattackerexploitsavulnerabilitybycraftinginputthatcausestheprogramtobehaveincorrectly.Wecallsuchaninputanexploit.Figure1showsavulnerablecodefragmentthatwewilluseasanexamplethroughoutthepaper.ThisisinCforclaritybutBouncerworkswithbinarycode.ThefunctionProcessMessageiscalledimmediatelyafterthemessagemsgisreceivedfromthenetwork.Thisfunctionhasavulnerabil-ity:exploitmessagescancauseittoover\rowbufferinthecalltosprintf.Theattackercanexploitthisvulnerabilitytooverwritethereturnaddressonthestack,whichcancausetheprogramtocrashorexecutearbitrarycode.Thereareusuallymanyexploitsforavulnerability,forexample,anymessagewiththethirdbyteequalto0x1followedbyatleast1013non-zerobytesisavalidexploitforthisvulnerability.Bouncerprotectsprogramsbygeneratingltersthatdropexploitsbeforetheyareprocessed.Figure2providesanoverviewofBouncer'sltergenerationarchitecture.Filtergenerationstartswithasampleexploitthatidenti-esavulnerability.Weobtainasampleexploitbyrunningaversionofthevulnerableprograminstrumentedtologin-putsandtodetectattacks.Whenanattackisdetected,theexploitmessagesareretrievedfromthelog[16]andsenttoBouncer.ThecurrentprototypeusesDFI[12]todetectat-tacksonCandC++programsbutitwouldbepossibletouseotherdetectors(e.g.,[28,4,17,40,37,16,13])ortoapplyourtechniquestoprogramswritteninsafelanguages.DFIdetectsmemorysafetyviolations,forexample,formatstringvulnerabilities,buerover\rows,accessesthroughdan-glingpointers,readsofuninitializeddata,anddoublefrees.Foreachvaluereadbyaninstructionintheprogramtext,DFIusesstaticanalysistocomputethesetofinstructionsthatmaywritethevalue.Atruntime,itmaintainsatablewiththeidentierofthelastinstructiontowritetoeachmemorylocation.Theprogramisinstrumentedtoupdatethistablebeforewrites,andreadsareinstrumentedtocheckiftheidentieroftheinstructionthatwrotethevaluebeingreadisanelementofthesetcomputedbythestaticanalysis.Ifitisnot,DFIraisesanexception.DFIhaslowoverheadbecausemostinstrumentationcanbeoptimizedawaywithstaticanalysis,andithasnofalsepositives:itonlyraisesexceptionswhenmemorysafetyisviolated.Forourexample,wewilluseasampleexploitmessagethat Figure2:Bouncerarchitecture.startswiththreebytesequalto0x1followedby1500non-zerobytesandbytezero.ProcessingthismessagecausesDFItothrowanexceptionwhenp1isaccessedtosetupthecallstackforStartServerbecausep1hasbeenoverwritten.Themessagesinthesampleexploitaresenttoaversionofthevulnerableprogramthatisinstrumentedbothtodetectattacksandtogenerateanexecutiontrace(seeFigure2).ThecurrentprototypeusesDFItodetectattacksandNir-vana[8]togenerateanexecutiontrace.Ifthesampleexploitisvalid,theexecutiontraceissenttothemodulethatrunsthepreconditionslicingalgorithm.Thistracecontainsthesequenceofx86instructionsexecutedfromthemomenttherstmessageisreceivedtothepointwheretheattackisde-tected.Wecalltheinstructionwheretheattackisdetectedthevulnerabilitypoint.Inourexample,thetracecontainstheinstructionsuptothecalltosprintf,theinstructionsinsidesprintf,andtheremaininginstructionsuptothevulnerabilitypoint,whichisthepushofp1ontothestack.Themodulethatrunsthepreconditionslicingalgorithm(seeFigure2)usesthesametechniqueasVigilante[16]togenerateaninitialsetofconditionsforthelter.Thistech-niquereplacestheconcretevalueofeachbyteinthesampleexploitbyasymbolicvaluebiandperformsforwardsym-bolicexecutionalongthetraceofx86instructions.Itaddsaconditiontothelterforeachbranchthatdependsontheinput.Theinitialsetofconditionsforourexampleis:b00^b10^b2=1^b1503=0^82i1503bi=0Thevulnerableprogramisguaranteedtofollowtheexecu-tionpathinthetracewhenprocessinganymessagethatsatisestheinitiallterconditions.Therefore,thisltercanbeusedtodropexploitmessageswithoutintroducingfalsepositives.However,theattackercancraftexploitsthatarenotdroppedbythislterbecausetherearesomecondi-tionsthatarenotnecessarytoexploitthevulnerability.Forexample,theconditionsonb0andb1arenotnecessaryandexploitswithbothshorterandlongersequencesofnon-zerobytesstartingatindexthreecanexploitthevulnerability.Bouncerreplacestheconditionsgeneratedforsomelibraryfunctions,likesprintfinourexample,bysymbolicsum-mariesthatcontainexactlytheconditionsonthefunctionargumentsthatcauseittoviolatememorysafety.Thesesummariesaregeneratedautomaticallyfromatemplatethatiswrittenonceperlibraryfunction.Inourexample,Bouncerperformsstaticanalysisanddeterminesthatbufferhassize1024bytes,andthatanysequencewithatleast1013non-zerobytespointedtobymsg+3willleadtoamemorysafetyviolationindependentofthevalueofp0.Therefore,thelterconditionsafterthisstepare:b0-0.6;ã¥ç0^b1-0.6;ã¥ç0^b2=1^82i1016bi=0Afteraddingsymbolicsummaries,preconditionslicingusesacombinationofstaticanddynamicanalysistoremoveun-necessaryconditionsfromthelter.Inourexample,itisabletoremovetheconditionsonbytesb0andb1producingtheoptimallter:b2=1^82i1016bi=0Ingeneral,theltersproducedaftertherstiterationarenotoptimal.Bouncergeneralizestheseltersbyrepeatingtheprocesswithalternativeexploitsofthesamevulnera-bilitythatcausetheprogramtofollowdierentexecutionpaths.Thelterconditionsaresenttothemodulethatgeneratesalternativeexploits.Thismoduleusesthesampleexploitandtheconditionstogeneratenewinputmessagesthatarelikelytoexploitthesamevulnerability.Then,itsendsthesemessagestotheinstrumentedvulnerablepro-gramtocheckiftheyarevalidexploits.Iftheyare,theprocessisrepeatedwiththenewexploitmessages.Other-wise,themodulegeneratesnewinput.ThesetoflterconditionsobtainedwitheachexploitiscombinedintoanecientnallterbyoneofBouncer'smodules(seeFigure2).Bouncerlterscanbedeployedautomaticallyafewtensofsecondsafteranewvulnerabilityisidentiedandtheycanbeupdatedasouranalysisgeneralizesthelters.WecanalsorunthelterswithvulnerableprogramsthatareinstrumentedtodetectattackswithDFIandtologinputs.ThisscenarioallowsBouncertorenethelterwhenanattackthatbypassesthelterisdetectedbyDFI.WeexpectBouncertoimproveavailabilityandreliabilitysignicantlyuntilthesoftwarevendorissuesapatchforthevulnerability,whichcantakemanydays.3.SYMBOLICEXECUTIONBouncercomputestheinitialsetoflterconditionsbyperformingforwardsymbolicexecutionalongthetraceob-tainedbyprocessingasampleexploit.Anyinputthatsat-isestheseconditionscanmaketheprogramfollowtheexe-cutionpathinthetraceuntilthevulnerabilityisexploited.ThetraceisgeneratedbyNirvana[8]anditcontainsthesequenceofx86instructionsexecutedbyeachthreadandtheconcretevaluesofsourceanddestinationoperandsforeachinstruction.Thesymbolicexecutionstartsbyreplacingtheconcretevaluesofthebytesinthesampleexploitbysymbolicval-ues:thebyteatindexigetssymbolicvaluebi.Then,itexecutestheinstructionsinthetracekeepingtrackofthesymbolicvalueofstoragelocationsthataredatadependent ontheinput.Thesymbolicvaluesareexpressionswhosevaluedependsonsomeofthebi.Theyarerepresentedastreeswhoseinteriornodesarex86instructionopcodesandwhoseleavesareconstantsoroneofthebi.Wechosethisrepresentationbecauseitistrivialtoconvertintoexecutablecodeanditavoidstheproblemofmodelingx86instructionsusinganotherlanguage.Thesymbolicexecutiondenesatotalorderonthein-structionsinthetracethatisalegaluniprocessorschedule.Theinstructionsareprocessedoneatatimeinthistotalorder.Ifthenextinstructiontobeprocessedhasatleastonesourceoperandthatreferencesastoragelocationwithasymbolicvalue,theinstructionisexecutedsymbolically.Otherwise,anystoragelocationsmodiedbytheinstructionaremarkedasconcrete,thatis,wedeleteanysymbolicvaluetheselocationsmayhavehadbecausetheyarenolongerdatadependentontheinput.Forexample,considerthetraceinFigure3thatcorrespondstothetestintherstifinFigure1.Sincethesourceoperandoftherstinstructionisconcrete,thevalueinregistereaxismarkedconcrete.Thesourceoperandofthesecondinstructionreferencestherstbyteinthemsgarraythathassymbolicvalueb0.Therefore,eaxgetssymbolicvalue(movsxb0)aftertheinstructionisexecuted.Sincethevalueofregistereaxisnowsymbolic,the\ragsregister(eflags)hassymbolicvalue(cmp(movsxb0)0)afterthecmpinstruction.moveax,dwordptr[msg]movsxeax,byteptr[eax]cmpeax,0jgProcessMessage+25h(401045h)Figure3:Assemblycodefortherstifintheex-amplefromFigure1.Wheneverthesymbolicexecutionencountersabranchthatdependsontheinput,itaddsaconditiontotheltertoensurethatinputsthatsatisfythelterconditionscanfollowtheexecutionpathinthetrace.Abranchdependsontheinputifthevalueofeflagsissymbolic.Conditionsarerepresentedasatreeoftheform:(Jccf),wherefisthesymbolicvalueofeflags.Ifthebranchistakeninthetrace,Jccistheopcodeofthebranchinstruction.Otherwise,Jccistheopcodeofthebranchinstructionthatteststhenega-tionoftheconditiontestedinthetrace.ForexamplewhenthelastinstructioninFigure3isexecuted,symbolicexecu-tiongeneratesthecondition(jg(cmp(movsxb0)0)).Ifthebranchhadnotbeentakeninthetrace,theconditionwouldbe(jle(cmp(movsxb0)0)).Noconditionsareaddedforbranchesthatdonotdependontheinput.Symbolicexecutionalsogeneratesconditionswhenanin-directcallorjumpisexecutedandthevalueofthetargetoperandissymbolic.Theconditioninthiscaseassertsthatts=tcwheretsisthesymbolicvalueofthetargetandtcistheconcretevalueofthetargetretrievedfromthetrace.Werepresenttheconditionas(je(cmptstc)).Similarconditionsaregeneratedwhenaloadorstoreisex-ecutedandtheaddressoperandhasasymbolicvalue.Theseconditionsassertthatas=acwhereasisthesymbolicvalueoftheaddressoperandandacisitsconcretevalueretrievedfromthetrace.Werepresenttheconditionas(je(cmpasac)).EXE[11]describesatechniquetogenerateweakerconditionsinthiscase.Wecouldusethistechniquetoob-tainamoregeneralinitiallterbutourcurrentprototypeonlyappliesEXE'stechniquetocommonlibraryfunctionslikestrtokandsscanf.Theinitiallterisaconjunctionoftheseconditions.Anyinputthatsatisesthelterconditionscanmakethepro-gramfollowtheexecutionpathinthetraceuntilthevul-nerabilityisexploited.Wesaycanbecausetheprogrammayonlyfollowthesameexecutionpathiftheinputispro-cessedinthesamesettingasthesampleexploit,thatis,iftheinputisreceivedinthesamestatewherethetracestartedandtheruntimeenvironmentmakesthesamenon-deterministicchoicesitmadeduringthetrace(forexample,thesameschedulingdecisions).Sincethisstateisreachableandclientsdonotcontrolthenon-deterministicchoices,thelterhasnofalsepositives.Additionally,thesymbolicorconcretevaluesofinstruc-tionoperandsareequivalentacrossthetracesobtainedwhenprocessinganyoftheinputsthatsatisfytheconditionsintheinitiallter(inthesamesettingasthesampleexploit).Equivalentmeansidenticalmodulodierentlocationsforthesamelogicalobjects,forexample,thebasesofstackscandif-ferandlocationsofobjectsontheheapcanbedierentbuttheheapswillbeisomorphic.4.IMPROVINGDETECTORACCURACYDetectorinaccuracycanleadtolterswithunnecessaryconditionsbecauseitincreasesthelengthofthetracesusedduringsymbolicexecution.Manytechniquestodetectat-tacksareinaccurate(e.g.,[28,4,17,37,16,13,12]):theydetectanattackonlywhensomeinstructionobservestheef-fectoftheexploitratherthanidentifyingthevulnerability.Forexample,DFIdetectsamemorysafetyviolationonlywhenitreadsdataproducedbyanunsafewrite.Thiswritemayoccurmuchearlierintheexecution.WeanalyzethetracetoimproveDFI'saccuracy.WhenDFIdetectsamemorysafetyviolation,wetraversethetracebackwardstondtheunsafewrite.Wemakethiswriteinstructionthevulnerabilitypointandanyconditionsaddedbyinstructionsthatappearlaterinthetraceareremovedfromtheinitiallter.Thisanalysismaybeinsucienttoidentifythevulner-abilityforattacksthatcorruptinternaldatastructuresinlibraries.Forexample,aclassofattackscorruptstheheapmanagementdatastructuresintheCruntimelibrariestowriteanywhereinmemory.SinceDFIdoesnotcheckreadsinsidelibraries,itdetectstheattackonlywhenaninstruc-tionreadsdataproducedbythiswrite.Weimplementedananalysistondtheinstructionthatrstcorruptstheheapmanagementdatastructures.Wersttraversethetracebackwardstondtheunsafewrite(asdescribedabove).Ifthiswritewasexecutedbyoneoftheheapmanagementfunctions(e.g.,malloc),wetraversethetraceforwardfromthebeginningtondtherstreadinsidemalloc,callocorfreeofavaluewrittenbyaninstructionoutsidethesefunc-tions.Wemaketheinstructionthatwrotethisvaluethevulnerabilitypoint,andremoveanyconditionsaddedbylaterinstructions.Ourcurrentimplementationonlydealswithheapmanagementdatastructuresbutthesameideacouldbeappliedtootherlibraryfunctions.5.PRECONDITIONSLICINGTheinitialltergeneratedbysymbolicexecutionblocksmanyexploitvariants,butitcanbebypassedbyattacksthat exploitthevulnerabilitythroughadierentexecutionpath.Thissectionprovidesanoverviewofslicingtechniquesanddescribesthepreconditionslicingalgorithmthatgeneralizestheinitiallterwithoutintroducingfalsepositives.5.1Staticordynamic?Programslicing[49]performsstaticanalysistoidentifythesetofinstructionsthatarerelevanttothevalueofasetofvariableswhenachoseninstructionisreached.Thissetofinstructionsiscalledtheslice.Wecouldrunanexistingprogramslicingalgorithmtoremoveunnecessaryconditionsfromtheinitiallter.Thisalgorithmcouldcomputethesetofinstructionsthatarerelevanttothevalueoftheoperandsoftheinstructionatthevulnerabilitypoint.Thenwecouldremovefromthelterconditionsaddedbybranchinstruc-tionsnotintheslice.TheproblemwithslicingtechniquesthatrelyonlyonstaticanalysisisthattheyareveryimprecisewhenappliedtorealCandC++programswithpointers[29,24].Theytendtoclassifymostinstructionsasrelevantand,therefore,arenoteectiveatremovingconditionsfromthelter.Dynamicslicingtechniques[29,51]usedynamicinforma-tiontoimproveprecision.Theytakeaninput,generateanexecutiontrace,andusethedynamicdependenciesobservedduringthetracetoclassifyinstructionsasrelevant.Thesetechniquesarenotsuitabletoremoveconditionsfromthelterbecausetheymayintroducefalsepositives.Dynamicslicingcanleadtotheremovalofnecessarycon-ditionsfromthelterbecauseitdoesnotcapturedepen-denciesoninstructionsthatwerenotexecutedinthetrace.Figure4showsanexamplewherethiscanhappen.Ifweapplydynamicslicingtothetraceobtainedwiththesampleexploitmsg="ab",thebranchcorrespondingtothesecondifismarkedirrelevant.However,removingtheconditionaddedbythisbranchfromtheinitiallterresultsinalterthatblocksallmessagesstartingwith'a'.Thislterhasfalsepositives:itcanblockmessagesstartingwith"aa"thatcanneverreachthevulnerabilitypoint.inta=0,b=0;int*c=&b;if(msg[0]=='a')a=1;if(msg[1]=='a')c=&a;*c=0;if(a)Vulnerability();Figure4:Examplewhereremovingconditionsusingdynamicslicingcanleadtofalsepositives.Wedevelopedanewslicingalgorithmtoremoveunneces-saryconditionswithoutaddingfalsepositives.Itcombinesideasfromastaticslicingalgorithmcalledpathslicing[24]withideasfromdynamicslicing.Pathslicingiswellsuitedtoourproblembecauseitcomputesthesetofstatementsinapaththroughaprogramthatarerelevanttoreachatargetlocation.Weimproveitsaccuracybyusingnotonlythepathintheexecutiontraceforthesampleexploitbutalsodynamicinformationfromthetrace,andweperformslicingofassemblycoderatherthansourcecode.5.2BasicstructurePreconditionslicingtraversestheexecutiontraceback-wardsfromthevulnerabilitypointtocomputeapathslice,thatis,asubsequenceoftheinstructionsinthetracewhoseexecutionissucienttoensurethatthevulnerabilitycanbeexploited.Intuitively,thepathslicecontainsbrancheswhoseoutcomematterstoexploitthevulnerabilityandmu-tationsthataecttheoutcomeofthosebranches[24].Wegeneralizetheinitiallterbyremovinganyconditionsthatwereaddedbyinstructionsthatarenotintheslice.Thecurrentimplementationofpreconditionslicingislim-itedtothecasewhereallinstructionsthatarerelevanttoreachthevulnerabilitypointareexecutedbythesamethread.Thisdoesnotmeanthatouralgorithmonlyworkswithsingle-threadedprograms.Infact,alltheprogramsweusedtoevaluateBounceraremulti-threaded.Weareworkingonanextensiontohandlethecasewheretheinteractionbe-tweenseveralthreadsisrequiredtoexploitavulnerability.Westartbydescribingthealgorithmatahighlevelandexplainhowwecombinestaticanddynamicanalysistoim-proveprecisioninthenextsection.Thealgorithmreceivesasinputsatrace,arepresentationoftheprogramcode,andaliasanalysisinformation.Thetracehasasequenceofentriesforeachinstructionintheexecutionwiththesampleexploit.Eachentryinthetracehasapointertothecorrespondinginstructioninthecode,thememoryaddressesorregisternamesreadandwrittenbytheinstructionintheexecutiontrace,andthesymbolicorconcretevaluesreadandwrittenbytheinstructioninthesymbolicexecution.WeobtainarepresentationoftheprogramcodebyusingPhoenix[33]toraisetheprogrambinarytoanintermediaterepresentationverysimilartothex86instructionset.WeusethealiasanalysisimplementedinDFI[12].Theanalysisisperformedduringthecompilationoftheprogramfromsourcecode.Itgeneratestworelationsonoperandsofinstructionsintheprogramcode:MayAlias(o1;o2)itheoperandso1ando2mayrefertooverlappingstoragelocationsinsomeexecution,andMustAlias(o1;o2)itheoperandso1ando2alwaysrefertothesamestoragelocationinallexecutions.Theserelationsareconservativeapprox-imations.MayAliasmayincludepairsthatneveroverlapandMustAliasmaynotincludepairsthatalwaysoverlap.Thealiasrelationsarewrittentodiskduringcompilationandlaterreadbyouralgorithmtogetherwiththebinary.Thealgorithmmaintainsthefollowingdatastructures:curisthetraceentrybeingprocessedsliceisalistoftraceentriesthatwereaddedtothepathslice.Initially,itcontainstheentryforthevul-nerabilitypointinstruction.livekeepstrackofdependenciesforinstructionsinslice.Itcontainsentriesforoperandsreadbytheseinstructionsthathavenotbeencompletelyoverwrittenbyinstructionsthatappearearlierinthetrace.Entriesinlivecontainapointertothecorrespondingoperandinthecode,theregisterormemoryaddressfromwhichtheinstructionreadtheoperandintheexecutiontrace,andthesymbolicorconcretevalueoftheoperandreadbytheinstructioninthesymbolicexecution.Entriesalsokeeptrackofportionsoftheoperandthathavebeenoverwrittenbyinstructionsthatappearearlierinthetrace.Initially,livecontainstheoperandsreadbytheinstructionatthevulnerabilitypoint.WeshowpseudocodeforthealgorithminFigure5.Thealgorithmiteratesthroughthetracebackwardsdecidingwhatinstructionstotakeintotheslice.Return,call,andbranch ComputeSlice(){while(!trace.IsEmpty){cur=trace.RemoveTail();if(cur.IsRet){call=trace.FindCall(cur);if(MayWriteF(CalledFunc(call),live))Take(cur);elsetrace.RemoveRange(cur,call);}elseif(cur.IsCall){Take(cur);foreach(eintrace.CallArgSetup(cur)){Take(e);trace.Remove(e);}}elseif(cur.IsBranch){if(!Postdominates(slice.head,cur)||WrittenBetween(cur,slice.head))Take(cur);}else{if(MayWrite(cur,live))Take(cur);}}}voidTake(cur){slice.AddHead(cur);live.UpdateWritten(cur);live.AddRead(cur);}Figure5:Pseudo-codefortheslicingalgorithm.instructionsaretreatedinaspecialwaybutotherinstruc-tionsaretakeniftheymayoverwritetheoperandsinlive.Whencurisareturninstruction,thealgorithmndsthecorrespondingcallinthetraceandtakesthereturnifthecalledfunctioncanoverwriteoperandsinlive;otherwise,noneoftheinstructionsinthecalledfunctionistakenandalltheentriesbetweenthereturnandthecallareremovedfromthetrace.Whenthereturnistaken,thealgorithmiteratesthroughtheinstructionsinthecalledfunction.Callinstructionsarealwaystakenunlesstheywerealreadyremovedwhenprocessingthecorrespondingreturn.Wealsotaketheinstructionsthatsetuptheargumentsforthecall.Branchesaretakenifthedirectionofthebranchisrele-vanttothevalueoftheoperandsinlive,thatis,ifthereissomepathoriginatingatthebranchinstructionthatdoesnotleadtothelastinstructionaddedtotheslice,orifoneoftheoperandsinlivemaybeoverwritteninapathbetweenthebranchandthelastinstructionaddedtotheslice.TheprocedureTakeaddsthetraceentryofeachinstruc-tionthatistakentoslice.Inaddition,itupdateslivetore\rectthewritesandreadsperformedbytheinstructioninthetrace.ThemethodUpdateWrittenrecordswhatlo-cationswerewrittenbytheinstructionincurandAddReadaddstheoperandsreadbycurtoliverecordingthelocationtheywerereadfromandtheirvalue.5.3CombiningstaticanddynamicanalysisPreconditionslicingimprovestheaccuracyofpathslic-ing[24]bytakingadvantageofinformationfromthesym-bolicexecution.Itensuresthefollowinginvariant.LetFbetheintermediatelterthatcontainsalltheconditionsintheinitiallterthatwereaddedbyinstructionsuptocurandtheconditionsaddedbyinstructionsinslice.ThenalltheexecutionpathsobtainedbyprocessinginputsthatmatchF(inthesamesettingasthesampleexploit)executethese-ProcessMessage(char*msg,char*p0,char*p1){charbuffer[1024];if(msg[0]0)*p0=msg[0];if(msg[1]0)*p1=msg[1];if(msg[2]==0x1&&*p0!=0){sprintf(buffer,"\\servers\\%s\\%c",msg+3,*p0);StartServer(buffer,p1);}}Figure6:Exampletoillustratebenetofusingdy-namicinformationtoremoveoperandsfromlive.quenceofinstructionsinsliceandthesourceoperandsofeachoftheseinstructionshaveequivalentconcreteorsym-bolicvaluesacrossthesepaths.Weusedynamicinformationtoremoveentriesfromlivesoonerthanpossibleusingstaticanalysis.ThemethodUp-dateWrittenremovesanentryfromlivewhenthestor-agelocationthattheoperandwasreadfromintheexecu-tiontraceiscompletelyoverwrittenbyearlierinstructionsinthetrace.Sincelivealreadycapturesthedependenciesoftheinstructionsthatoverwrotetheremovedentry,theentrynolongeraectsthereachabilityofthevulnerabilityatthispointinanypathobtainedwithinputsthatmatchF.Incontrast,pathslicingremovesanoperandfromliveifMustAliasholdsfortheoperandandanyoftheoperandswrittenbythecurrentinstruction.WecanillustratethebenetsofourapproachusingthemodiedexampleinFigure6andthesamesampleexploitthatweusedearlier.Assumethatp0andp1pointtothesamestoragelocationandthatthisfactcannotbedeter-minedbythestaticanalysis.Pathslicingwouldnotbeabletoremoveanyconditionfromtheinitiallter.Preconditionslicingcanremovetheconditionb00fromtheinitiallter.When*p1=msg[1]isprocessed,theoperandfor*p0isre-movedfromlivebecauseitsstoragelocationisoverwritten.Therefore,thebranchthatchecksmsg[0]0isnotaddedtotheslice.ThefunctionMayWritechecksifaninstructionmayover-writeanoperandinlive.Wealsouseacombinationofstaticanddynamicanalysistoimplementthisfunction.May-WritestartsbycomputingthesetLwithalloperandsinthecodethatmayaliasatleastoneoperandwithanentryinlive.Accordingtothestaticanalysis,MayWriteshouldre-turntrueifanyoftheoperandswrittenbycurisinLandfalseotherwise.Weperformanadditionalchecktoimproveaccuracywithdynamicinformation.Wedonottakecurifitsexecutiondidnotwriteoverthestoragelocationsofanyoftheoperandsinliveanditstargetaddressisdeterminedbyconcretevaluesofoperandsinlive.ThispreservestheinvariantbecausethedependenciescapturedinliveensurethatcurcannotaectthevalueoftheoperandsinliveinanypathobtainedwithinputsthatmatchF.Soitisnotrelevanttoreachthevulnerability.Tocheckifthetargetaddressofcurisdeterminedbyconcretevaluesofoperandsinlive,weiterateoverthein-structionsinthebasicblockofcur.Ifalloperandsreadbyaninstructionmustaliasanoperandwithaconcretevalueinliveortheresultoperandofapreviousinstructioninthebasicblock,weexecutetheinstructionwiththecon- ProcessMessage(char*msg,char*p0,char*p1){charbuffer[1024];if(msg[0]0)*p0=msg[0];if(msg[1]0)*p1=msg[1];if(msg[2]==0x1&&*p0!=0&&p1!=p0){sprintf(buffer,"\\servers\\%s\\%c",msg+3,*p0);StartServer(buffer,p1);}}Figure7:Exampletoillustratebenetofusingdy-namicinformationtocomputeMayWrite.cretevaluesandrecordtheconcretevalueofthedestinationoperand.Wedonottakecurifwecancomputeaconcretevalueforitstargetaddress.Figure7showsamodiedversionofourexamplecodethatillustratesthebehaviorofMayWrite.Assumethatp0andp1pointtodierentlocationsbutstaticanalysiscannotdeterminethisfact.Inthiscase,pathslicingcannotremoveanyconditionsfromtheoriginallter.Preconditionslicingcanremovetheconditionb10.*p1=msg[1]isnottakenbecauseitdoesnotoverwriteanyoperandinliveandp1isinlive.Sothebranchthatchecksmsg[1]0isnottaken.MayWriteFcheckswhetherafunctionmaywriteoveranyoperandinlive.ItcomputestheintersectionbetweenthesetofalloperandsthefunctionmaymodifyandL.Ifthein-tersectionisempty,wedonottakethefunction.Otherwise,weperformanadditionalcheckforlibraryfunctionswhosesemanticsweknow.Wedonottakealibraryfunctionifthelocationsitwritesaredeterminedbytheconcretevaluesofoperandsinliveanditdidnotwriteoveranyoperandinliveinthetrace.Forexample,wedonottakethecallmemcpy(dst,src,n)ifthevaluesofdstandnarecon-stantsoraredeterminedbytheconcretevaluesofoperandsinlive,anditdidnotoverwriteanyoperandinlive.Therearetwocheckstodeterminewhethertoaddabranchtotheslice.Therstonechecksifthelastinstructionaddedtothesliceisapostdominatorofthebranch[5],i.e.,whetherallpathsfromthebranchtothefunction'sreturninstruc-tionspassbyslice.head.Ifnot,weaddthebranchtotheslicetocaptureinlivethedependenciesnecessarytoensurethebranchoutcomeinthetrace.Otherwise,theexecutionpathsmightnotvisittheinstructionsinslice.Weuseastandardstaticanalysistodeterminepostdom-inancebutrstwecheckiftheoutcomeofthebranchisalreadydecidedgiventheconcreteandsymbolicvaluesofoperandsinlive.Inthiscase,wedonotaddthebranchtotheslice.ThisissimilartothetechniquesdescribedtoimprovetheaccuracyofMayWritebutwemakeuseofsym-bolicoperandvaluesandtheconditionsaddedbyinstruc-tionsalreadyintheslice.Ifthebranch\ragissymbolic,wecheckiftheconditionsalreadyinthesliceimplythebranchconditionoritsnegation.Thecurrentimplementationonlydealswithsimpleexpressions.Thispreservestheinvariantbecause,whenthebranchisnotaddedtoslice,thede-pendenciescapturedinlivealreadyensuretheappropriatebranchoutcometoreachthevulnerabilityinanypathob-tainedwithaninputthatmatchesF.WrittenBetweenimplementsthesecondchecktodeter-minewhetherornottotakeabranch.Itreturnstrueifthereissomepathinthecodebetweenthebranchandslice.headwheresomeoperandsinlivemaybeoverwritten.Weper-formthischeckbytraversingthecontrol\rowgraphbetweenthebranchandslice.headindepth-rstorder.Weiterateovertheinstructionsineachbasicblockvisited.WeuseMayWrite(orMayWriteFforfunctioncalls)todetermineiftheinstructionsinthebasicblockcanmodifyoperandsinlive.Wealsomakeuseofconcretevaluesofoperandsinlivetoimprovetheaccuracyoftheanalysis.Thisisverysimilartowhatwasdescribedabove.6.SYMBOLICSUMMARIESPreconditionslicingisnoteectiveatremovingconditionsaddedbyinstructionsinsidelibraryfunctions.Withoutaliasinformation,itmustbeconservativeandaddalltheinstruc-tionsinthesefunctionstotheslice.Wetookapragmaticapproachtoaddressthislimitation:weuseknowledgeaboutthesemanticsofcommonlibraryfunctionstogeneratesym-bolicsummariesthatcharacterizethebehaviorofafunctionasasetofconditionsonitsinputs.Weusethesesummariestoreplacetheconditionsextractedfromthetrace.Wegeneratesymbolicsummariesautomaticallyfromatemplatethatiswrittenonceperlibraryfunction.Therearetwocasesdependingonwhetherthevulnerabilitypointisinsidealibraryfunctionorthelibraryfunctioniscalledinthepathtowardsthevulnerability.Intherstcase,wedonotneedtocharacterizethefullbehaviorofthefunc-tionbecausewhathappensafterthevulnerabilitypointisnotimportant.Therefore,thesymbolicsummaryissimplyaconditionontheargumentsofthefunctionthatistrueexactlywhenthevulnerabilitycanbeexploited.Theconditionsinasymbolicsummaryaregeneratedfromatemplate(whichdependsonthelibraryfunction)usingacombinationofstaticanddynamicanalysis.Theanalysismustdeterminethesymbolicorconcretevaluesoffunctionargumentsandpotentiallythesizesoftheobjectspointedtobythesearguments.Forexampleifthevulnerabilityisabuerover\rowinthecallmemcpy(dst,src,n),thesummarywillstatethatthesizeoftheobjectpointedtobydstmustbegreaterthanorequalton.Togeneratethiscondition,theanalysismustdeterminetheconcreteorsymbolicvaluesfornandforthesizeoftheobjectpointedtobydst.Thevalueforargumentslikenisreadilyavailablefromthetraceentryforthecorrespondingpushinstruction.Todeterminethesizeoftheobjectpointedtobyanar-gument,theanalysistraversesthetracebackwardsfromthefunctioncalltothepointwheretheobjectisallocated.Forobjectsthatareallocateddynamicallyusingcalloc,malloc,orrealloc,theanalysisobtainstheconcreteorsymbolicvaluesoftheargumentspassedtotheseallocatorstocomputeanexpressionfortheobjectsize.Forobjectswhosesizeisknownstatically,theanalysisobtainstheob-jectsizefromourrepresentationofthecode.Duringthistracetraversal,theanalysisbuildsanexpressionfortheo-setbetweentheargumentpointerandthestartaddressoftheobject.Theexpressionforthesizeusedintheconditionisequaltotheobjectsizeminusthisoset.Itishardertocomputesymbolicsummariesforfunctionsintheprintffamilybecausetheyhaveavariablenumberofargumentswithvariabletypes,butitisimportantbecausethesefunctionsareinvolvedinmanyvulnerabilities.Wedistinguishtwocases:whentheformatstringdependsontheinputandwhenitisknownstatically. Intherstcase,weonlydealwithcallsthatreceivenoargumentsbeyondtheformatstring,whichisthecommoncasewithformatstringvulnerabilities.Theanalysisgener-atesasummarywithaconditiononthesymbolicvaluesofthebytesintheformatstring.Thisconditionistruewhentheformatstringcontainsvalidformatspeciersorwhenitssize(afterconsumingescapecharacters)exceedsthesizeofthedestinationbuerforfunctionsinthesprintffamily.Whentheformatstringdoesnotdependontheinput,themostcommonvulnerabilityisforafunctioninthesprintffamilytoformatanattacker-suppliedstringintoadestina-tionbuerthatistoosmall(asinourexampleinFigure1).Thesummaryforthiscaseisaconditiononthesizesoftheargumentstrings.Theanalysiscomputestheboundonthesesizesbyparsingthestaticformatstringusingthesamealgorithmasprintf,processinganyargumentsthatdonotdependontheinput,anddeterminingthesizeofthedestinationbuer(asdescribedabove).Itisinterestingtocontrastsymbolicsummarieswithatechniquethatpatchesthecodebyaddingacheckbeforethelibrarycall.SymbolicsummariesallowBouncertode-tectanddiscardbadinputbeforeitisprocessed.Therefore,servicescankeeprunningcorrectlyunderattack.Whereasrecoveringwhenthecheckfailsishard.Furthermore,addingthecheckmayrequirekeepingaruntimestructuremappingobjectstotheirsizes.Thisisnotneededbysymbolicsum-mariesbecausetheyarespecictoaparticularexecutionpath(theonedenedbytheotherconditionsinthelter).Wealsocomputeasecondtypeofsymbolicsummaryforlibraryfunctionsthatarecalledinthepathtowardsthevulnerability.Wemotivatethiswiththefollowingexample:if(stricmp(s,"Astring")==0)Vulnerability();thevulnerabilityinthisexampleisreachableiftheattackersuppliedstringequals\Astring"afterbothareconvertedtolowercase.Theconditionsthatweextractautomaticallyfromasampleexecutionofstricmpwillonlycaptureapar-ticularvalueofsthatsatisesthecomparison.Thetech-niquesdescribedinthenextsectiongenerateexecutionswithalternativeinputstogeneralizethelters.Buttheywouldrequireatleast28inputs(where8isthesizeof\Astring")togeneratealterthatcanblockalltheattacksthatcanexploitthevulnerability.Ifwereplacetheconditionsfortheexecutionofstricmpinthesampletracebythesummary(s[0]=A_s[0]=a)^:::^(s[8]=G_s[8]=g)^s[9]=0wecancapturesuccinctlyallvaluesofsthatcanbeusedtoexploitthevulnerability.Sincethevulnerabilityisnotinsidethesefunctions,wecanalternativelychoosetocallthemdirectlyinthelter.Currently,weonlygeneratesummariesforfunctionsinthemiddleofthepathiftheyhavenosideeects.Thereissomerecentworkthatproposescomputingsimilarsummariesautomaticallyforarbitraryfunctions[22].7.SEARCHFOROTHERATTACKSThetechniquesdescribedintheprevioussectionsgener-ateltersthatblockmanyattacksthatexploitthesamevulnerability,buttheyarenotsucienttogenerateoptimalltersthatblockallexploits.Togeneralizeourltersfurther,wesearchforalterna-tiveexploitsofthesamevulnerability,obtainnewexecu-tiontracesusingtheseexploits,andapplythealgorithmsdescribedintheprevioussectionstocomputeanewlter.Thedisjunctionoftheltersobtainedfromthedierentex-ecutiontracescatchesmoreexploits.Thesearchforallpossibleexploitsmaytakeasignicantamountoftime.Therefore,theinitialltermaybedeployedassoonasitisavailable(withintensofseconds),whilethesearchprocedureincrementallyimprovesitsaccuracy.Weexperimentedwithtwotechniquestosearchforalter-nativeexploits.First,weimplementedthetestgenerationapproachofDART[23](whichwasalsoproposedin[41,11]).Thisapproachusesconditionsobtainedfromsymbolicexecution(asinSection3)toguidenewtestinputgenera-tion.Ittakesaprexoftheconditionsnegatesthelastoneandfeedstheresultingconditionstoaconstraintsolvertoobtainnewtestinputs.Thisapproachhasthenicepropertythatgivenenoughtimeitcanndallexploitsofthesamevulnerability.Theproblemisthatitrequirestoomuchtimeinpractice.Weareworkingonsearchheuristicsthatmightmakethisapproachpractical.Wecurrentlyuseasecondsearchstrategythatgeneratesalternativeexploitsbyremovingorduplicatingbytesintheoriginalexploitmessages.Thisstrategyisnotguaranteedtondallexploitsofthesamevulnerabilitybutitissimple,fastandeasytoparallelize.Wepickbytestoremoveorduplicateusinganheuris-ticbasedonthelterconditions.Wegiveascoretoeachconditionequaltothetotalnumberofbytesinconditionsdividedbythenumberofbytesthathaveanidenticalcondi-tion.Eachbytehasascoreequaltothesumofthescoresoftheconditionsitappearsin.Wepickthebyteswiththelow-estscoresbecausetheyarelikelytobellerbytesinbuerover\rowexploits.Aftergeneratingapotentialnewexploit,wesendittotheversionofthevulnerableprogramthatisinstrumentedtodetectattacks(asshowninFigure2).Ifthedetectorsignalsthattheexploitisvalid,werepeattheltergen-erationprocessforthenewexploit.Whenusingsymbolicsummariesforthelibraryfunctionwiththevulnerability,weinstrumentthevulnerableprogramtosignalsuccesswhenthecallsitewiththevulnerabilityisreached.Iftheexploitisnotvalid,thedetectordoesnotraiseanexception.Wedetectthiscaseusingawatchdogthatchecksifallthreadsinthevulnerableprogramareidle.Thisworkswellinpracticeandavoidshavingtowaitforalargetimeout.Weuseourheuristictoselectbytestoremove.Ifafterremovingabytetheresultingmessageisnotavalidexploit,weretainthatbyteandpickanotheronetoremove.Werepeatthisprocessuntilwehavetriedtoremoveallbytesorthemessagesizeislowerthanaboundfromasymbolicsummary.Then,westartgeneratingnewexploitsbydupli-catingbytesintheoriginalexploitmessage.Wepickanotherbytetoduplicateifwedidnotobtainanexploitoriftherearebytesintheresultingexploitmessagethatarenotreadbythevulnerableprogram.Westopafterwehavetriedtoduplicateallbytes.Wecombinetheltersgeneratedforeachalternativeex-ploittoobtainthenallter.Simplytakingthedisjunctionofalllterscanresultinanallterwithhighoverhead.In-stead,wecomparetheconditionsappliedtoeachbyteindexbyeachlter.Acommonstructureisasetofbyteindicesinthebeginningofamessagethathavethesameconditioninalllters.Thesearetypicallyfollowedbysequencesofbyteindicesthathavedierentlengthsindierentltersbuthavethesameconditionsappliedtoeachbyteinthe sequenceineachlter.Theremaybeseveralofthesese-quences.Typically,theyarefollowedbyterminatorbyteswiththesameconditionsineachlter.Ifwerecognizethisstructure,wetakeadvantageofittogenerateanecientnallter.Inthiscase,thenallterhastheconditionsfortheinitialbytesfollowedbyloopsthatchecktheconditionsonthevariablelengthbytesequences,andconditionsthatchecktheterminatorbytes.Thenallterisanx86executable.Itisstraightforwardtoconverttheconditionsgeneratedduringsymbolicexe-cutionintoexecutablecode.Weuseasimplestack-basedstrategytoevaluateeachconditionandashort-circuiteval-uationoftheconjunctionoftheconditions.Thesizeofthestackisboundedbythedepthofthetreesintheconditionsandltersonlyaccessthisstackandtheinputmessages.Therefore,ltersareguaranteedtoruninboundedtimeandtouseaboundedamountofmemory.8.EVALUATIONWeimplementedaprototypeofBouncerandweevaluateditusingrealvulnerabilitiesinrealprograms:MicrosoftSQLserver,ghttpd,nullhttpd,andstunnel.Westartedbyan-alyzingeachvulnerabilitycarefullytocharacterizethesetofattackmessagesthatcanexploitit.Then,weusedBouncertogeneratealterforeachvulnerabilityandevaluatedthefractionofattackvariantsblockedbythelter.Theresultsshowthatourlterscanblockallattacksthatexploittwoofthevulnerabilities.Wealsoranexperimentstostudyltergeneration.Wemeasuredltergenerationtime,thenumberofiterationsinthesearchforalternativeexploits,andthecontributionofeachofourtechniquestogeneralizetheinitiallter.Thenalsetofexperimentsmeasuredtheoverheadintro-ducedbythelterswhenusedtoprotectrunningservices.Wemeasuredboththerunningtimeoftheltersandthedegradationinservicethroughputwithandwithoutattacks.Ourresultsshowthatthedeployedltershavenegligibleoverheadandthatattackersmustconsumealargeamountofbandwidthtoreduceservicethroughputsignicantly.8.1ServicesandvulnerabilitiesWestartbydescribingtheservicesandvulnerabilitiesthatwestudied,andalltheattacksthatcanexploiteachvulner-ability.Determiningthesetofallattacksrequireddetailedanalysisofthevulnerableprogramsaidedbyourtools.Wealsodescribethesampleexploitthatweusedtobootstraptheltergenerationprocessforeachvulnerability.SQLserverisarelationaldatabasefromMicrosoftthatwasinfectedbytheinfamousSlammer[34]worm.Westud-iedthebuerover\rowvulnerabilityexploitedbySlammer.Anattackercanover\rowastackbuerbysendingaUDPmessagewiththerstbyteequalto0x4followedbymorethan60bytesdierentfromzero.Thestackover\rowoccursinsideacalltosprintf.WeusethesameexploitasSlam-mertostarttheltergenerationprocess.Thisexploithastherstbytesetto0x4followedbya375-bytestringwiththewormcode,anditoverwritesthereturnaddressofthefunctionthatcallssprintf.GhttpdisanHTTPserverwithseveralvulnerabilities[1].Thevulnerabilitythatwechoseisastackbuerover\rowwhenprocessingthetargetURLforGETrequests.Theover\rowoccurswhenloggingtherequestinsideacalltovsprintf.Therearemanyexploitsthatcanover\rowthebuer.Successfulexploitsmusthavelessthan4Kbytesandhaveasequenceofnon-zerobytesterminatedby"\n\n"or"\r\n\r\n".Theymuststartwithzeroormorespacechar-actersfollowedbythestring"GET"andbyoneormorespacecharacters.Thesequenceofremainingcharactersuntiltherst'\n'or'\r'cannotcontainthestring"\\.."andmusthavemorethan150bytes.Thesampleexploittostartltergenerationforghttpdbeginswiththestring"GET"followedbyasequenceof203non-zerobytesterminatedby"\n\n".Thisexploitover\rowsthereturnaddressofthefunctionthatcallsvsprintf.NullhttpdisanotherHTTPserver.Thisserverhasaheapover\rowvulnerabilitythatanattackercanexploitbysendingHTTPPOSTrequestswithanegativevalueforthecontentlengtheld[2].TheserequestscausetheservertoallocateaheapbuerthatistoosmalltoholdthedatainthePOSTrequest.WhilecallingrecvtoreadthePOSTdataintothebuer,theserveroverwritestheheapmanagementdatastructuresmaintainedbytheClibrary.Thisvulnerabilitycanbeexploitedtooverwritearbitrarywordsinmemory.Thereisaverylargenumberofmessagesthatcancausethebuertoover\rowinnullhttpd.Eachofthesemessagesisasequenceoflineswithupto2046non-zerobytesdif-ferentfrom'\n'terminatedby'\n'.Therstlinemuststartwith"POST"(caseinsensitive)followedbytwoothereldsseparatedbyspaces.Then,therecanbeanynum-berofarbitrarynon-emptylinesuntilalinethatstartswith"Content-Length:"(caseinsensitive)followedbyastringthatisinterpretedasanegativenumber Nbyatoi.Thislinecanthenbefollowedbyanynumberofnon-emptylinesthatdonotstartwith"Content-Length:".Themessagemustendwithanemptylinefollowedbyatleast1024 NbytesofPOSTdata.Weusedtheexploitdescribedin[14]tostarttheltergenerationprocessfornullhttpd.Thisisatwomessageex-ploit.TherstmessageexploitsthevulnerabilitytomodifytheCGI-BINcongurationstringtoallowtheattackertostartanarbitraryprogram.Thesecondmessagestartsashell.Therstmessagehasalinewithacookiethatisnotnecessaryfortheattack.StunnelisagenerictunnelingservicethatencryptsTCPconnectionsusingSSL.Westudiedaformatstringvulner-abilityinthecodethatestablishesatunnelforSMTP[3].Anattackercanover\rowastackbuerbysendingamessagethatispassedasaformatstringtothevsprintffunction.Thebuerover\rowsiftheattackersendsanymessagewithupto1024bytesterminatedby'\n'withasequenceofinitialbytesdierentfrom'\n'thatexpandstomorethan1024byteswheninterpretedasaformatstring.Therearemanymessagesthatsatisfytheseconditionsandtheycanbesmall,forexample,"%1025.x\n"over\rowsthebuer.Thesampleexploitthatweusedtobootstraptheltergenerationprocessforstunnelwasamessagestartingwith"%.512x"followedby602'A'charactersanda'\n'.Thismessageoverwritesthereturnaddressofthefunctionthatcallsvsprintf.8.2FilteraccuracyThissectionevaluatestheaccuracyofBouncerlters.Ta-ble1summarizesourresults.Alterhasfalsenegativesifitfailstoblockinputthatcanexploitthevulnerabilityun-derstudyandfalsepositivesifitblocksinputthatcannotexploitthevulnerability. service falsepositives falsenegatives SQLserver no no ghttpd no yes nullhttpd no yes stunnel no no Table1:AccuracyofBouncerlters. 10002000300040005000600070008000 SQL Server Nullhttpd ghttpd stunnel Number of conditions Symbolic execution Detector accuracy Summaries Slicing Figure8:NumberofconditionsinBouncerltersafterapplyingeachtechnique.Thenumberofcon-ditionsaftersymbolicexecutionisthenumberofconditionsinVigilantelters.FiltersgeneratedbyBouncerhavenofalsepositivesbydesign:allthemessagestheyblockcanexploitthevulner-ability.Althoughwecannotprovidestrongguaranteesonfalsenegatives,wefoundempiricallythatBouncergenerateslterswithnofalsenegativesforthevulnerabilitiesinSQLserverandstunnel:ourltersblockalltheattacksthatcanexploitthesevulnerabilities.Theltersfortheothervulnerabilitiesfailtoblocksomeexploitsbuttheyblockmanyexploitsdierentfromthesam-pleexploit.ItisharderforBouncertogeneratelterswithnofalsenegativeswhenprotocolsallowsemanticallyequiv-alentmessagestobeencodedinmanydierentways,orwhenthereareseveralvariablelengtheldsthatarepro-cessedbeforereachingthevulnerability.Forexample,HTTPGETmessagescanhavezeroormorespacesbefore"GET"andoneofmorespacesafter"GET".Bouncer'slterforghttpdfailstoblockexploitmessagesthathavespacesbefore"GET"butcapturesexploitsthataddspacesafter"GET".BouncerltersblocksignicantlymoreattacksthanVig-ilantelters[16].BouncerremovesalargefractionoftheconditionsinVigilantelters(whichareobtainedusingsym-bolicexecutionaloneasdescribedinSection3).Figure8showsthenumberofconditionsinBouncerltersaftersymbolicexecution(sameasVigilante),afterimprov-ingdetectoraccuracy,afterreplacingtheconditionsinthelibraryfunctionwherethevulnerabilityoccursbyasym-bolicsummary,andafterpreconditionslicing.Thesenum-berswereobtainedintherstiteration(whichprocessesthesampleexploit)andalltheconditionsdependontheinput.AdditionaliterationswouldimprovetheaccuracyofBouncerltersrelativetoVigilanteltersevenfurther.TheresultsshowthatallthetechniquesimprovetheaccuracyofBouncerlters.Preconditionslicinghasthelargestim-pactforSQLserver,ghttpd,andstunnel.Fornullhttpd,improvingdetectoraccuracyisthelargestcontributor.Webelievethatitwouldbepossibletoreducefalseneg-ativesbycombiningBouncer'stechniqueswithothertech-niquestocomputeweakestpreconditions(e.g.,[6]).How- 20000400006000080000100000SQL ServernullhttpdghttpdstunnelFilter generation time (s)Vulnerable applicationFigure9:Totaltimetogeneratelters. 20040060080010001200SQL ServernullhttpdghttpdstunnelNumber of filter iterationsVulnerable applicationFigure10:Numberofiterationstogeneratelters.ever,thereareproblemswithloopsandrecursionthathavetobesolvedforthesetechniquestobeuseful.Additionally,wecouldexploitprotocolknowledge(whenavailable)toim-provethesearchforalternativeexploitsasinShieldGen[19].8.3FiltergenerationWealsoevaluatedthecostofltergenerationbymeasur-ingthenumberofiterationsandthetimetogeneratethelters.WerantheseexperimentsonaDellPrecisionWork-station350witha3GHzIntelPentium4processorand1GBofmemory.TheoperatingsystemwasWindowsXPprofes-sionalwithservicepack2.Figures9and10showthetotaltimeandthenumberofiterationstogeneratethelters,respectively.Werantheexperimentswitha24-hourtimelimit.Theltergenerationprocessfornullhttpdandghttpddidnotterminatebeforethislimit.IttookBouncer4.7hourstogeneratethelterforSQLserverand16.2forstunnel.Theltergenerationprocessranforroughly1000itera-tionsinallcases.Itstoppedafter967iterationsforSQLserverandafter1025iterationsforstunnel.TheminimumexploitsizeforSQLserveris61bytesandthemaximumis1024.Forstunneltheminimumexploitsizeis2bytesandthemaximumisalso1024.Therearetworeasonsfortherelativelylargeltergen-erationtimes.First,thetimeperiterationislargeduetoinecienciesinourprototype:17sforSQLServer,83sfornullhttpd,79sforghttpd,and57sforstunnel.Forexam-ple,generationandremovalofconditionsisperformedbyseparateprocessesthatcommunicatebyreadingandwritinglargeles.Betterintegrationwouldsignicantlyreducethetimeperiteration.Second,thenumberofiterationsisalsolargetoensurethenallterhasnofalsepositives.Wearestudyingtechniquestoanalyzeloopsstaticallythatshouldreducethenumberofiterationsnecessary.Ourprototypeisusefulevenwiththeselimitations. 400800120016000100200300400Running time (ns)Message size (bytes) SQL filterFigure11:FilteroverheadfortheMicrosoftSQLservervulnerabilityasafunctionofmessagesize.Insomedeploymentscenarios,itiseasytoreduceltergenerationtimesbyexploitingparallelism.Sinceiterationsinourltergenerationprocessareindependent,itcanbeparallelizedbyassigningeachiterationtoadierentpro-cessor.Forexample,alargesoftwarevendorlikeMicrosoftcouldruntheltergenerationprocessinaclusterwith1000machinesandthendisseminatethelterstousersofvulner-ablesoftware.Thiscouldspeedupltergenerationtimesbyuptothreeordersofmagnitude,forexample,generatingtheltersfortheSQLServerandstunnelvulnerabilitieswouldtakelessthanoneminute.Inotherscenarios,wecandeployalteraftertherstiteration,whichtakestensofseconds.Thenwecandeployanimprovedlteraftereachiteration.Additionally,ifwerunthevulnerableprograminstrumentedtodetectattackswithDFIandtologinputs,BouncercanrenethelterwhenanattackthatbypassesthelterisdetectedbyDFI.8.4FilteroverheadWealsoranexperimentstomeasuretheoverheadintro-ducedbydeployedlters.Theresultsshowthattheover-headtoprocessbothexploitandnon-exploitmessagesislowforalltheltersgenerated.Therefore,ltersallowservicestoworkcorrectlyandecientlyevenunderattack.8.4.1RunningtimeTomeasurethelterrunningtime,wevariedmessagesizesfrom16to400bytesinincrementsof16bytes.Foreachmessagesize,wemeasuredthetimetoprocess1000messagesandrepeatedthisexperiment1000times.Wepresenttheaveragetimeacrossthe1000experiments.Werantheseex-perimentsinthemachinedescribedintheprevioussection.Wechosemessagestoobtainaworst-caseoverheadforthelters.Themessagesarepickedrandomlybutwithcon-straintsdesignedtoforcetheltertocheckconditionsonthemaximumnumberofmessagebytespossible.Forex-ample,themessagesusedtomeasuretheoverheadoftheSQLserverlterhavetherstbyteequalto0x4toforcetheltertocheckiftheremainingbytesinthemessagearedierentfromzero.Ontheotherhand,themessagessenttothestunnellterhaveno%charactersbecausethel-terstopsprocessingthemessagebyteswhenitndsavalidformatspecier.Figure11showstheSQLserverlteroverhead.Theover-headcurveis\ratforsmallmessagesizesbecausetherstconditioninthelterchecksifthemessagehasatleast61bytes.Thisconditionisobtainedfromthesymbolicsum-maryforthesprintffunctionwherethevulnerabilityoc-curs.Theoverheadgrowslinearlywiththesizeforlonger 400800120016000100200300400Running time (ns)Message size (bytes) ghttpd filterFigure12:Filteroverheadfortheghttpdvulnerabil-ityasafunctionofmessagesize. 400800120016000100200300400Running time (ns)Message size (bytes) nullhttpd filterFigure13:Filteroverheadforthenullhttpdvulner-abilityasafunctionofmessagesize.messages(whichareallexploits)becausethenumberofbytesprocessedbythelterincreaseslinearly.Figure12showsthelteroverheadfortheghttpdvulner-ability.ThecurveissimilartotheoneforSQLserver:itis\ratformessagesupto156bytesbecauseoftheconditionobtainedfromthesymbolicsummaryofthevsprintffunc-tionwherethevulnerabilityoccurs.Theoverheadgrowslinearlyforexploitmessages.AsinSQLservertheover-headforprocessingnon-exploitmessagesisnegligibleandtheoverheadforprocessingexploitmessagesislow.TheoverheadcurvefornullhttpdisdierentfromtheprevioustwoasshowninFigure13.ThishappensbecauseweusePOSTrequeststotestthislterandincreasemessagesizebyaddingbytestothePOSTdata,whichisnotprocessedbythelter.TheresultsshowthattheoverheadtoprocessPOSTrequestsislow.SinceoneoftherstconditionsinthelterchecksifthemessagestartswithPOST,theoverheadtoprocessmessagesthatdonotstartwithPOSTisverylow.Figure14showsthelteroverheadforthestunnelvul-nerability.Thiscurveisdierentfromalltheothersbecausethisvulnerabilitycanbeexploitedwithverysmallmessagesandtheltermustcheckeverybyteinthemessagelook-ingforvalidformatspeciers.Theoverheadishigherthanthatobservedfortheotherltersbutthislterisonlyap-pliedtogreetingmessageswhenestablishingSSLtunnelsfortheSMTPprotocol.Therefore,itsoverallimpactonperformanceisnegligible.Inallcasesshown,thetimetorunthelteronnon-exploitmessagesisbetweenthreeandveordersofmag-nitudesmallerthantypicalwide-areanetworklatenciesandbetweentwoandthreeordersofmagnitudesmallerthantypicallocal-areanetworklatencies.Therefore,ourltershaveanegligibleimpactonoverallservicelatency. 100020003000400050000100200300400Running time (ns)Message size (bytes) stunnel filterFigure14:Filteroverheadforthestunnelvulnera-bilityasafunctionofmessagesize.8.4.2EffectonthroughputWealsomeasuredthroughputreductionduetoltersonSQLserverandnullhttpd.ThevulnerableservicesranonaDellPrecisionworkstation350witha3GHzIntelPentium4processorand2GBofRAM,runningWindows2000.WeranclientsonaDellLatitudeD600laptopwitha2GHzIn-telPentiumprocessorand1GBofRAM,runningWindowsXPprofessionalwithservicepack2,andonaDellLatitudeD620laptopwitha2.16GHzCore2Duoprocessorand2GBofRAM,runningWindowsVista.Serverandclientswereconnectedbya100MbpsD-LinkEthernetswitch.ForSQLserver,weusedtheTPC-Cbenchmark[45]togenerateload.Tomeasuretheworstcasescenarioforthelteroverhead,clientswereconguredwithzerothinktimeandweusedemptyimplementationsfortheTPC-Cstoredprocedures.Fornullhttpd,wegeneratedloadusingare-questfromtheSPECWeb1999benchmark[43].There-questfetchesastaticlewith102bytes.Wechosethisre-questbecausetheleiscachedbytheserver,whichensuresthelteroverheadisnotmaskedbyI/O.ForbothSQLserverandnullhttpd,wemeasuredthemaximumthroughputintheabsenceofattacksforabaseversionwithoutthelterandforaversionwiththelterdeployed.Forbothversions,weincreasedtherequestrateuntiltheserverreached100%CPUusage.Wereporttheaverageofthreeruns.Theoverheadisverylow:itwasbelow1%forbothservices.Onasecondsetofexperiments,wemeasuredthethrough-putofthetwoservicesunderattack.Wesentattackprobestoserversthatwerefullyloadedandmeasuredthereduc-tioninthroughputasweincreasedtherateofattackprobes.Theattacksprobescarriedthesameexploitsthatwereusedtostarttheltergenerationprocess.Weranthisexper-imentwithservicesprotectedbyBouncerltersandwithservicesthatrestartwhentheydetectanattack.Werestarttheserviceimmediatelyafteranattackprobeisreceivedtomakethecomparisonindependentoftheperformanceofanyparticulardetectionmechanism.Figures15and16showthenormalizedthroughputunderattackofSQLserverandnullhttpd,respectively.Detectingtheattacksisnotenough.IfSQLserverisrestartedwheneveranattackisdetected,theattackercanmaketheserviceunavailablewithverylittleeort.TheresultsshowthatanattackercanreducethethroughputofSQLserverbymorethan90%withanattackrateofonly12probesperminute.ThishappensbecauseSQLserverhasacomplexstartupprocedurethattakesapproximatelyveseconds.WithBouncerlters,thereductioninthroughputwiththisattackrateisnegligible. 0.20.40.60.8024681012Normalized throughputAttack probes/minute SQL with Bouncer filter SQL restarting on attackFigure15:NormalizedthroughputforBouncerandRestartonaSQLserverunderattack. 0.00.20.40.60.81.0102030405060708090100Normalized throughputAttack probes/minute nullhttpd with Bouncer filter nullhttpd restarting on attack Figure16:NormalizedthroughputforBouncerandRestartonanullhttpdWebserverunderattack.Theresultswhennullhttpdisrestartedonattackaresim-ilar:theattackercanreducethethroughputofnullhttpdbymorethan90%witharateofonly100probesperminute.TheattackraterequiredtomaketheserviceunavailableislargerfornullhttpdthanforSQLserverbecausethestartuptimefornullhttpdismorethananorderofmagnitudesmaller.TheversionofnullhttpdprotectedbyBouncerisessentiallyunaectedbyattackswiththisrate.TheattackerneedstoexpendordersofmagnitudemorebandwidthtoaectthethroughputofservicesprotectedbyBouncer.Figure17showsthatwhentheattackersendsalmost18000probespersecond,SQLserverprotectedbyBouncercanstilldeliver80%ofthethroughputachievablewithoutattacks.Figure18showsthatnullhttpdprotectedbyBouncercandeliver65%ofthenormalthroughputatanattackrateof1000probespersecond.Thethroughputde-gradesfasterfornullhttpdbecauseitcreatesanewthreadforeachrequest(includingattackprobes),whileSQLserverusesanecientthreadpoolingmechanism.9.RELATEDWORKTherehasbeenpreviousworkonautomaticgenerationoflterstoblockexploitmessages.Mostproposals[25,26,42,30,36,44,47,31,32,19]providenoguaranteesontherateoffalsepositives.Therefore,theycanmaketheprogramstopworkingevenwhenitisnotunderattack.Fromthesetech-niques,ShieldGen[19]isthemostcloselyrelatedtoBouncer.Itusesaprotocolspecicationtogeneratedierentpoten-tialexploitsfromaninitialsample,anditinstrumentstheprogramtocheckifpotentialexploitsarevalidexploits.WecouldimproveBouncer'salternativeexploitgenerationbyleveragingaprotocolspecication,butthesespecicationsdonotexistformostprograms. 0.00.20.40.60.81.020006000100001400018000Normalized throughputAttack probes/second SQL with Bouncer filter Figure17:NormalizedthroughputforSQLserverunderattack. 0.20.40.60.802004006008001000Normalized throughputAttack probes/second nullhttpd with Bouncer filter Figure18:NormalizedthroughputfornullhttpdWebserverunderattack.Vigilante[16]computesltersautomaticallyusingaformofsymbolicexecution[27]alongthepathtakenbyasampleexploit.Filtersareguaranteedtohavenofalsepositivesandtheyblockallexploitsthatcausetheprogramtofollowthesameexecutionpathuntilthevulnerabilitypoint.Crandalletal.[18]haveshownthattheselterscancatchmanyat-tackvariants.However,attackerscanbypasstheseltersbygeneratingexploitsthatfollowadierentexecutionpath.RecentworkhasexploredtechniquestogeneralizeVigi-lantelterstoblockexploitsthatfollowdierentexecutionpaths.Brumleyetal[9]proposethreelterrepresentations:Turingmachines,symbolicconstraints,andregularexpres-sions.Turingmachineltersareachoppedversionofthevulnerableprogramthatisinstrumentedtodetecttheat-tack.Programchoppingremovesinstructionsthatcannotbeexecutedfromthepointwheretheexploitmessageisre-ceivedtothevulnerabilitypoint.Turingmachinelterscanhavelowfalsenegativesandnofalsepositives,buttheirover-headishigh.Theltercanincludemostoftheinstructionsintheoriginalprogram(becausechoppingisimprecise)anditisnecessarytoinitializethestateofthelterbeforepro-cessingeachmessage.Thetechniquestogeneratesymbolicconstraintandregularexpressionltersdonotscaletorealprograms[10].Concurrentlywithourwork,Brumleyetal.[10]proposedapromisingtechniquetocomputesymbolicconstraintl-ters,whicharesimilartoBouncer'slters.Theyleveragepreviousworkoncomputingweakestpreconditions[6]tocreatethelter.Theseltershavenofalsepositivesbuttheymayhavefalsenegativesbecauseloopsareunrolledaconstantnumberoftimesbeforecomputingweakestprecon-ditions.Anotherconcernisthattheltersarelarge(evenwhenloopsareunrolledonlyonce)becausetheaddressesinmemoryaccessesaretreatedsymbolically[6].Bouncer'ssymbolicexecutiontechniqueusesconcreteaddressestore-trievethesymbolicorconcretevaluesofmemorycells.Thishastwoadvantages:itsimpliestheconditionsinthel-teranditremovesunnecessaryconditions.Additionally,weusepreconditionslicingtoremoveunecessaryconditions.ItwouldbeinterestingtocombineBouncer'stechniqueswithothertechniquestocomputeweakestpreconditions[6].Othertechniquespreventattacksbyaddingcheckstopro-gramstodetectexploits(e.g.,type-safelanguagesandtrans-parentinstrumentationforunsafeprograms[4,12,13,16,17,28,40]).Thesetechniquescanintroduceasignicantoverheadandtheydetectattackstoolatewhentheonlywaytorecovermaybetorestarttheprogram.Vulnerability-specicexecutionlters[35,46]canreducetheoverheadbyinstrumentingtheprogramtodetectexploitsofasinglevul-nerability,buttheycannotsolvethesecondproblem.Thereareseveraltechniquesthatallowprogramstokeepworkingunderattack.Failure-obliviouscomputing[39]usesCRED[40]tocheckforout-of-boundsaccessesbutdoesnotaborttheexecutionwhenacheckfails.Instead,itig-noresout-of-boundswritesanditgeneratesvaluesforout-of-boundsreads.Thisallowsprogramstokeepworkingbuttheoverheadcanbehighandprogramscanbehaveincor-rectly,forexample,theauthorshadtocarefullycraftvaluesforout-of-boundsreadstopreventinniteloopsintheirex-amples.DieHard[7]randomizesthelocationofobjectsinalargeheaptomakeitlesslikelyforout-of-boundswritestooverwriteanotherobject.Thistechniquehaslowoverheadbutitcanbeeasyforattackerstobypass.Checkpointingandrollbackrecovery[21]aregeneraltechniquestorecoverfromfaults.Theycanbeusedtorecoverwhenanattackisdetected[38,46]butrecoverycanberelativelyexpen-siveandtheysuerfromtheoutputcommitproblem[21],thatis,theycannotrollbacktheenvironmentaftersendingoutput.Sweeper[46]proposestheuseofltersoninputmessagestoreducethenumberoftimesrecoveryisneeded.10.CONCLUSIONSThispaperdescribedBouncer,asystemthatautomati-callygenerateslterstoblockexploitmessagesbeforetheyareprocessedbyavulnerableprogram.BouncerusesDFItoobtainsampleexploitsfor(potentiallyunknown)vulner-abilitiesanditgeneratesltersfromthesesamples.Bouncergeneratesltersusingacombinationoffourtechniques:sym-bolicexecutioncomputesaninitialsetoflterconditions;preconditionslicingusesacombinationofstaticanddy-namicanalysistoremoveunnecessaryconditionsfromthelter;symbolicsummariescharacterizethebehaviorofcom-monlibraryfunctionssuccinctlyasasetofconditionsontheinput;andalternativeattacksearchgeneratesnewat-tackinputguidedbysymbolicexecution.Bouncerltersdonothavefalsepositivesbydesignandourresultsshowthatitcangeneratelterswithnofalsenegativesforreal-worldvulnerabilitiesinSQLserverandstunnel.Theresultsalsoshowthattheseltersintroducelowoverheadandallowpro-gramstokeeprunningecientlyevenwhenunderattack.AcknowledgmentsWethankAngelosStavrouandLaurentViscontiforhelpwiththecode.WethankByronCook,TomBallandMadanMusuvathifordiscussionsaboutthiswork.WethankourshepherdYuanyuanZhouandtheanonymousreviewersforcommentsthathelpedtoimprovethepaper. 11.REFERENCES[1]GHttpdLog()FunctionBuerOver\rowVulnerability.http://www.securityfocus.com/bid/5960.[2]NullHTTPdRemoteHeapOver\rowVulnerability.http://www.securityfocus.com/bid/5774.[3]STunnelClientNegotiationProtocolFormatStringVulnerability.http://www.securityfocus.com/bid/3748.[4]M.Abadi,M.Budiu,U.Erlingsson,andJ.Ligatti.Control-\rowIntegrity:Principles,implementations,andapplications.InACMCCS,Nov.2005.[5]A.Aho,R.Sethi,andJ.D.Ullman.Compilers:Principles,techniques,andtools.PrenticeHall,1986.[6]M.BarnettandK.R.M.Leino.Weakest-preconditionofunstructuredprograms.InPASTE,Sept.2005.[7]E.D.BergerandB.G.Zorn.DieHard:Probabilisticmemorysafetyforunsafelanguages.InPLDI,June2006.[8]S.Bhansali,W.-K.Chen,S.deJong,A.Edwards,R.Murray,M.Drinic,D.Mihocka,andJ.Chau.Frameworkforinstruction-leveltracingandanalysisofprogramexecutuions.InVEE,June2006.[9]D.Brumley,J.Newsome,D.Song,H.Wang,andS.Jha.Towardsautomaticgenerationofvulnerabilitysignatures.InIEEESymposiumonSecurityandPrivacy,May2006.[10]D.Brumley,H.Wang,S.Jha,andD.Song.CreatingVulnerabilitySignaturesUsingWeakestPre-conditions.InComputerSecurityFoundationsSymposium,July2007.[11]C.Cadar,V.Ganesh,P.M.Pawlowski,D.L.Dill,andD.R.Engler.EXE:Automaticallygeneratinginputsofdeath.InACMCCS,2006.[12]M.Castro,M.Costa,andT.Harris.Securingsoftwarebyenforcingdata-\rowintegrity.InOSDI,Nov.2006.[13]S.Chen,J.Xu,N.Nakka,Z.Kalbarczyk,andR.K.Iyer.Defeatingmemorycorruptionattacksviapointertaintednessdetection.InDSN,July2005.[14]S.Chen,J.Xu,E.C.Sezer,P.Gauriar,andR.K.Iyer.Non-control-dataattacksarerealisticthreats.InUSENIXSecuritySymposium,July2005.[15]M.Costa.End-to-EndContainmentofInternetWormEpidemics.PhDthesis,UniversityofCambridge,Oct.2006.[16]M.Costa,J.Crowcroft,M.Castro,A.Rowstron,L.Zhou,L.Zhang,andP.Barham.Vigilante:End-to-EndContainmentofInternetWorms.InSOSP,Oct.2005.[17]C.Cowan,C.Pu,D.Maier,H.Hinton,J.Wadpole,P.Bakke,S.Beattie,A.Grier,P.Wagle,andQ.Zhang.Stackguard:Automaticdetectionandpreventionofbuer-overrunattacks.InUSENIXSecuritySymposium,Jan.1998.[18]J.R.Crandall,Z.Su,S.F.Wu,andF.T.Chong.Onderivingunknownvulnerabilitiesfromzero-daypolymorphicandmetamorphicwormexploits.InACMCCS,Nov.2005.[19]W.Cui,M.Peinado,H.J.Wang,andM.Locasto.ShieldGen:Automaticdatapatchgenerationforunknownvulnerabilitieswithinformedprobing.InIEEESymposiumonSecurityandPrivacy,May2007.[20]E.W.Dijkstra.Guardedcommands,nondeterminacyandformalderivationofprograms.CommunicationsoftheACM,Aug.1975.[21]E.N.Elnozahy,L.Alvisi,Y.-M.Wang,andD.B.Johnson.Asurveyofrollback-recoveryprotocolsinmessage-passingsystems.ACMComputingSurveys,34(3):375{408,Sept.2002.[22]P.Godefroid.CompositionalDynamicTestGeneration.InPOPL,Jan.2007.[23]P.Godefroid,N.Klarlund,andK.Sen.DART:DirectedAutomatedRandomTesting.InPLDI,2005.[24]R.JhalaandR.Majumdar.Pathslicing.InPLDI,June2005.[25]J.O.KephartandW.C.Arnold.Automaticextractionofcomputervirussignatures.InVirusBulletin,Sept.1994.[26]H.KimandB.Karp.Autograph:Towardautomated,distributedwormsignaturedetection.InUSENIXSecuritySymposium,Aug.2004.[27]J.C.King.Symbolicexecutionandprogramtesting.CommunicationsoftheACM,19(7):385{394,July1976.[28]V.Kiriansky,D.Bruening,andS.P.Amarasinghe.Secureexecutionviaprogramshepherding.InUSENIXSecuritySymposium,Aug.2002.[29]B.KorelandJ.Laski.Dynamicprogramslicing.InformationProcessingLetters,29,1988.[30]C.KreibichandJ.Crowcroft.Honeycomb-creatingintrusiondetectionsignaturesusinghoneypots.InHotNets,Nov.2003.[31]Z.LiangandR.Sekar.Automaticgenerationofbuerover\rowsignatures:Anapproachbasedonprogrambehaviormodels.InACSAC,Dec.2005.[32]Z.LiangandR.Sekar.Fastandautomatedgenerationofattacksignatures:Abasisforbuildingself-protectingservers.InACMCCS,Nov.2005.[33]Microsoft.Phoenixcompilerframework.http://research.microsoft.com/phoenix/phoenixrdk.aspx.[34]D.Moore,V.Paxson,S.Savage,C.Shannon,S.Staniford,andN.Weaver.InsidetheSlammerworm.IEEESecurityandPrivacy,1(4),July2003.[35]J.Newsome,D.Brumley,andD.Song.Vulnerability-specicexecutionlteringforexploitpreventiononcommoditysoftware.InNDSS,Feb.2006.[36]J.Newsome,B.Karp,andD.Song.Polygraph:Automaticallygeneratingsignaturesforpolymorphicworms.InIEEESymposiumonSecurityandPrivacy,May2005.[37]J.NewsomeandD.Song.Dynamictaintanalysisforautomaticdetection,analysisandsignaturegenerationofexploitsoncommoditysoftware.InNDSS,Feb.2005.[38]F.Qin,J.Tucek,J.Sundaresan,andY.Zhou.Rx:Treatingbugsasallergies-asafemethodtosurvivesoftwarefailures.InSOSP,Nov.2005.[39]M.Rinard,C.Cadar,D.Dumitran,D.M.Roy,T.Leu,andW.Beebee.Enhancingserveravailabilityandsecuritythroughfailure-obliviouscomputing.InOSDI,Dec.2004.[40]O.RuwaseandM.Lam.Apracticaldynamicbuerover\rowdetector.InNDSS,Feb.2004.[41]K.Sen,D.Marinov,andG.Agha.CUTE:AConcolicUnitTestingEngineforC.InESEC/FSE,2005.[42]S.Singh,C.Estan,G.Varghese,andS.Savage.Automatedwormngerprinting.InOSDI,Dec.2004.[43]SPEC.Specweb99benchmark.http://www.spec.org/osg/web99.[44]T.TothandC.Kruegel.Accuratebuerover\rowdetectionviaabstractpayloadexecution.InRAID,Oct.2002.[45]TPC.TPC-Conlinetransactionprocessingbenchmark.1999.http://www.tpc.org/tpcc.[46]J.Tucek,J.Newsome,S.Lu,C.Huang,S.Xanthos,D.Brumley,Y.Zhou,andD.Song.Sweeper:Alightweightend-to-endsystemfordefendingagainstfastworms.InEuroSys,Mar.2007.[47]X.Wang,C.-C.Pan,P.Liu,andS.Zhu.Sigfree:Asignature-freebuerover\rowattackblocker.InUsenixSecuritySymposium,Aug.2006.[48]W.WeimerandG.C.Necula.Findingandpreventingruntimeerrorhandlingmistakes.InOOPSLA,Oct.2004.[49]M.Weiser.Programslicing.InConferenceonSoftwareEngineering.IEEEComputerSocietyPress,1981.[50]G.Winskel.TheFormalSemanticsofProgrammingLanguages.MITPress,1993.[51]X.ZhangandR.Gupta.Costeectivedynamicprogramslicing.InPLDI,June2004.