47
Avik Chaudhuri Towards Provably Secure and Correct Systems

Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

AvikChaudhuri

TowardsProvablySecureandCorrectSystems

Page 2: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Opera<ngsystemsStoragesystems

Webapplica<onframeworksMobiledeviceplaAorms

Clouds

Thesesystemsrunourcode.Whatsecurityandcorrectnessguaranteesdotheyprovide?

Systemswerelyon

Page 3: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Developfounda:onsofsecureandcorrectsystems

Analysisofsystems(specifica4on+verifica4on)

Construc<onofsystems(design+implementa4on)

Exploitprogramminglanguagesaslensprinciples,techniques

Aimofmyresearch

Page 4: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Overviewofpastandongoingworkonsystemanalysis Storagesystems(Plutus,OSD,PCFS)

 Opera4ngsystems(WindowsVista,Asbestos) MobiledeviceplaForms(Android)

 Webapplica4onframeworks(RubyonRails)

Systemsasprogramminglanguages

Programanalysesforsystemguarantees

Similarideascanguidesystemdesign

Thistalk

Page 5: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Analogy:Communica4onModelcryptographywithequa<onsdecrypt(encrypt(x,k),k)=x

Programminglanguagetodescribeprotocols createnewnames(keys) buildtermswithfunc<onsymbols(hashing,encryp4on) communicatetermsoverchannels composeparallelprocesses

[appliedpicalculus]

Page 6: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Specifica4onandVerifica4onAdversary(arbitraryunspecifiedcontext)Languageseman:csdefinesthepoweroftheadversary

Specifica<on(types,logicalasser<ons)

Prooftechniques(typesystems,abstractinterpreta<on)Tools(ProVerif,F7)Canverifyprotocols,theirimplementa:ons,andtheiruses

Thisapproachcanbeextendedtoothersystems!

Page 7: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

 Analysisofsecurefilesharingonuntrustedstorage[withB.Blanchet:S&P’08]

  variousaOacks,preciseguarantees

 Correctimplementa<onofdistributedaccesscontrol[withM.Abadi:FMSE’05,FORTE’06;FCS’08]

  piFalls,generaldesignprinciples

 Languagesupportforproof‐carryingauthoriza<on[withD.Garg:ESORICS’09]

  automa4cproofmanagement

Storagesystems

Page 8: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

 Analysisofopera<ngsystemsecuritymodels[withS.Rajamaniandothers:CCS’08]

  decidabilityresults,toolforsystemdesign

 Typesystemforenforcingsecurityonanopera<ngsystem[withS.Rajamaniandothers:PLAS’08]

  formaliza4onofdesigninten4onsandbestprac4ces

Opera4ngsystems

Page 9: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

 Securityverifica<onofmobiledeviceapplica<ons[PLAS’09;ongoingworkwithJ.Fosterandothers]

  cer4fiedinstalla4onwithsecurityguarantees

MobiledeviceplaForms

Page 10: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

 Securityandcorrectnessverifica<onofwebapplica<ons[withJ.Fosterandothers:ASE’09,ongoingwork]

  elimina4onofvariousclassesofaOacksandbugs

Webapplica4onframeworks

Page 11: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageReduc<onist:Storageis,aRerall,communica<on

 write/readafile ≈send/receiveonachannel

 storageonuntrusteddisks ≈communica4onoverinsecurenetworks

Shouldbeabletoleveragepreviousworkoncommunica:on

Pragma<st:Careful!Whydoweneeddynamicaccesscontrol?

Expectdynamicspecifica:ons(e.g.,dynamictrustassump:ons)

Page 12: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Page 13: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 14: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

AliceReader

Writer

(knowsreadkey)

(knowswritekey)

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 15: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Carol

David

Eve

Reader

Writer

(knowsreadkey)

(knowswritekey)

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 16: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Carol

David

Eve

Reader

Writer

(knowsreadkey)

(knowswritekey)

Owner(creates/distributeskeys)

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 17: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Carol

David

Eve

Reader

Writer

Owner

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 18: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

AliceDavid

Eve

(creates/distributesnewkeys)Carol

Reader

Writer

(knowsnewreadkey)

(knowsnewwritekey)

Owner

Bob

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 19: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisks

Alice

Bob

Carol

David

Eve

Reader

Writer

Owner

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 20: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

StorageonUntrustedDisksDavid

Eve

Alice

Bob

Carol(creates/distributesnewkeys)

Reader

Writer

(knowsnewreadkey)

(knowsnewwritekey)

Owner

Server:untrusted

Clients:sometrusted,someuntrusted

Files:encrypted/signed

Page 21: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Op4miza4onsinPlutus Arefilesimmediatelyre‐securedwithnewkeys?No!Filessecuredwithnewkeysonsubsequentwrites“lazyrevoca<on”

 Howdoreadersdecidewhichkeystouse?Throwawayoldkeys,derivefromnewkeysasrequired“keyrota<on”

Doestheprotocolimplementtheseop4miza4onscorrectly?Whatarethesecurityimplica4onsoftheseop4miza4ons?

Page 22: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Specifica4onandVerifica4onAutomatedsecurityanalysisofPlutuswithProVerif

Results Weakersecrecythanclaimedwriterscanactforreaders,secretsmayeventuallyleak

 SeriousaXackonintegrity(cleverexploitofsubtlebug)adversarycancolludewithreaderstobecomewriters

appliedpicalculusprograms+

expectedproper<es

Hornlogicclauses+

queries

with

Page 23: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Keyidea:ModelCorrup4onSpecifycodeforeachroleintheprotocol

 ownerstrusted  readerstrustedorcorrupt writerstrustedorcorrupt(trusted=followsprotocol,corrupt=leakskeys)

Adversaryunspecified,controlsanyrunoftheprotocol

(e.g.,chooseswhichprincipalstocorruptandwhen)

Specifysecuritydespitecorrup<onSecurityviola:onPreciselowerboundsoncorrup:on

Page 24: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

DistributedAccessControlNetworkedStorage(e.g.,OSD)

Capability:unforgeable/verifiableauthoriza<oncer4ficate

Revoca:onistrickyHowdowespecifyandverifycorrectnessofimplementa4ons?

Client

AccessControlAuthority

DiskServer“capability”

Page 25: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

IdealStorage

Studypreserva<onoftraceproper<es,equivalences

ResultsVariouswaystobreakfullabstrac:onNevertheless,correctimplementa<onsexist

Generaldesignprinciples:Distributedimplementa:onofstatefulcomputa:ons

Implementa4onasRefinement

with

ClientAccessControlAuthority+DiskServer

Page 26: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Proof‐CarryingAuthoriza4on

Filesystemrequiresauthoriza<onproofsTremendousburdenonuser

Solu<onPCAL:Language/compilersupportforPCAsystemsuserwritesscript,compilermanagesproofs&instrumentsscriptTricky!(e.g.,proofsatcompile4memaybeinvalidatrun4me)

with

Client

DistributedAccessControlAuthori4es

FileSystem

Page 27: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Opera4ngSystemsVariouslevelsoftrust(ordered)

Protec<onmechanisms(e.g.,labelsforaccesscontrol)intendtorestrictinforma:onflowacrosslevelsoftrust

butoaendonot!(toorestric4ve)

Process

Loca4on

System Admin User Web> > >

Page 28: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

AccessControlforIntegrity“nowriteup”

“noexecutedown”

Browsersecurity

WebdatacannotoverwriteUserloca4onWebcodecannotberunbyAdminprocess

Browserfunc:onality?

UserneedstodownloaddatafromWeb(e.g.,emailaOachment)

AdminneedstoinstallcodefromWeb(e.g.,gameapplica4on)

> > >

Page 29: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

DynamicControlofLabelsWindowsVista

spawnuntrustedprocess(executelesstrustedcode)

readuntrustedloca4on(onlyoverwriteuntrusteddata)

trustuntrustedloca4on(verifytrustbyothermeans)

>Process

Loca4on

AdmincaninstallcodefromWeb UsercansavedatafromWeb

Page 30: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

WindowsVista

Implicitdesigninten:ons,bestprac:ces?(Similarideasinotheropera4ngsystems,e.g.,Asbestos)

DynamicControlofLabels

spawnuntrustedprocess(executelesstrustedcode)

readuntrustedloca4on(onlyoverwriteuntrusteddata)

trustuntrustedloca4on(verifytrustbyothermeans)

AdmincaninstallcodefromWeb UsercansavedatafromWeb

>Process

Loca4on

Page 31: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Specifica4onandVerifica4onSystemDesigner:Whatguaranteescanthesystemprovide? modelbehaviors(dynamicseman4cs)

 analyzerestric<ons(sta4cseman4cs)

ProVerif✗ undecidablequeryevalua:oncanbeaproblem!

Solu<onEon:dynamiclogicprogramming

✓ expressiveenough✓ decidablequeryevalua:on

with

Page 32: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

EonEon=Datalog+new+next+somesyntac4crestric4ons(unarydynamicpredicates,monotonicity)

new:createconstantsini4alizedwithsomepredicatesnext:updatepredicatesforsuchconstants

Datalog:enforceconstraints

Queryevalua:on:reduc:ontoDatalogquerysa:sfiability(new=existen<alquan<fier,next=statetransformer)

Page 33: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

AutomatedAnalysiswithEonExperiments

 modelbehaviors(dynamicseman4cs) analyzerestric<ons(sta4cseman4cs)

Results

WindowsVistaAdackscanbeblamedontrustedprocesses(interes4ngdesignprinciple)

Soundmonitoringoftrustedprocessestoeliminateadacks

Explicitdesigninten4ons,bestprac4ces!

Page 34: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

CodeAnalysisforSecurityWindowsVistaAOackscanbeeliminatedbyrestric4ngtrustedcode

Idea

Enforcerestric:onsoncodeviaasecuritytypesystem

types=securityinvariants

soundness=typepreserva<onwith

Page 35: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

AccessControl+SecurityTypesProgramminglanguagetodescribecoderunningonsystem createprocesses/loca<onsthatareprotectedwithlabels updatelabels(accesscontrol) packcodeasdata(compila4on)

  read/write/executecontentsatloca4ons

Accesscontrolencodedindynamicseman<csSecuritytypesenforcesta<cseman<cs

Hybridtypechecking(soundness,precision,op4miza4on)

Page 36: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

AccessControl+SecurityTypesSecuritytypeTL(dataoftypeT,trustedsta<callyatlevelL)TypeLocTL(loca<onthatcontainsdataofsecuritytypeTL)

Ifloc:LocTL,thendynamiclabelofloc≥LByaccesscontrol,levels<Lcannot

 writetoloc controldynamiclabelofloc

Bytypechecking,ensurethatlevels≥Lalways writedatathatflowsfromlevels≥Ltoloc

 maintaindynamiclabelofloc≥L

Page 37: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Examplesini4alizecmd.exeini4alizeurl

ie.execontainscode:readsurl&executescontents

executesie.exeatWeb

virus.execontainscode:overwritescmd.exe

urlcontainsvirus.exe

[System]

[User]

[Web]

Codetypechecks[Webcannotwritetocmd.exe]

Page 38: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Examplesini4alizesetup.exe

ini4alizeurl

ie.execontainscode:readsurl&copiescontentstosetup.exe

executesie.exeatWeb

virus.execontainscode:overwriteshome

urlcontainsvirus.exe

[System]

[User]

[Web]

ini4alizehome

trustssetup.exe&executesit

[Admin]

Codedoesnottypecheck[Admincanwritetohome]

Page 39: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

MobileDevicePlaFormsAndroid opera4ngsystem+coreapps

 SDK:JavaAPIstodevelopnewapps

AppscansharecomponentsSharingcontrolledsta<cally(atinstall4me)

CanAliceknowwhetherBob’sappissafe?

CanBobconvinceAlicethattheappissafe?Bob(developer)

Alice(user)

appstore

Page 40: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Cer4fiedInstalla4on(PCC)BobconstructsaproofthathisappissafeAliceverifiestheproofbeforeinstallingtheapp(proofsmaybeimplementedascer<ficates)

Requirements

 Opera<onalseman<csforappsrunningonAndroidformalspecifica<onsofAPIsprovidedbySDKSeparateverifica:onofAPIsforefficiency

 Sta<canalysisofAndroidappsforsafetyformalizedasasecuritytypesystemSoundnessofanalysisprovidesnecessaryproofs

Page 41: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

codemaybelongtootherappsrunwithpermissionsofthoseapps

AndroidApplica4ons

stackofwindows

pooloflisteners

data

componentsinheritedclasses,overriddenmethods

manifestdeclarenecessarypermissions

specifyaccesscontrolsforotherapps

sta<c dynamic

Page 42: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Securityspecifica<onsderivedfrommanifestsofinstalledappsTypecheckingguaranteesthataccesscontrolsenforcesecurity

SupposethatreadingmycontactslistrequirespermissionPThenonlyappsinstalledwithpermissionPcanknowmycontacts

Droid:cer<fiedinstallerforAndroidapps(inprogress)

Sta4cAnalysis

concretecode[Java]

abstractcode (typecheck)

with

Page 43: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

RubyonRails Ruby:dynamicallytypedOOscrip<nglanguage

 Rails:RubyAPIsforautoma<ngdevelopmentofwebapps

Models,Views,Controllersmodelsconnectedtodatabasetablesviewsdescribedbycode‐embeddedmarkup

controllersrouterequeststoresponses

Conven:onoverConfigura:on

WebApplica4onFrameworks

controllers models

databaseviews

request

response

Page 44: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Sta4cAnalysisRailsmakesextensiveuseofmeta‐programminginRubyDirectanalysisisdifficultDRails:translatetoexplicitRubycodethatiseasiertoanalyze

TypecheckingguaranteesthatmethodcallssucceedButalmosteverythingisamethodcallinRuby!

ResultsBugsthatcrashexis4ngapps(confirmedbydevelopers)

concretecode[RubyonRails]

translatedcode[Ruby]

(typecheck)[DRuby]

with

Page 45: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

Simpletypecheckingcannotcatchlogicalerrors/securityaOacksAdvancedtypesystemsdifficulttobuildforRuby

Rubyx:symbolicverifica<onofRubyscripts(inprogress)

Keyidea:executablespecifica<ons

Sta4cAnalysis

concretecode[RubyonRails]

translatedcode[Ruby]

(executeandverify)

with

Page 46: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

SystemsoftheFutureInfluenceofprogramminglanguages

Principles Core,expressiveabstrac4ons Strongguaranteesofsecurityandcorrectness  Implementa4onsasrefinements

Techniques Richtypes/invariantsforspecifica4onandverifica4on Combina4onsofsta4canddynamicmechanisms

Page 47: Towards Provably Secure and Correct Systemsavik/apps/job-talk.pdf · Ruby on Rails Ruby: dynamically typed OO scripng language Rails: Ruby APIs for automang development of web apps

SystemsoftheFutureInfluenceofprogramminglanguages

Revisitacademicprogramminglanguages

“strongfounda4onsreducecomplexity,spurinven4ons”

Viewsystemdesignaslanguagedesign

“generaliza4onsprovideinsight,settrends”

Opportunitytomakelas:ngcontribu:ons