Top Banner
SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre MarGn1, ChrisGan Priebe2, Joshua Lind2, Divya Muthukumaran2, Dan O’Keeffe2, Mark L SGllwell2, David Goltzsche3, David Eyers4, R¨udiger Kapitza3, Peter Pietzuch2, and Christof Fetzer1 1Fakult¨at InformaGk, TU Dresden, [email protected] 2Dept. of CompuGng, Imperial College London, [email protected] 3InformaGk, TU Braunschweig, [email protected] 4Dept. of Computer Science, University of Otago, [email protected] Saeid Mofrad
24

SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Apr 10, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

SCONE:SecureLinuxContainerswithIntelSGXSergeiArnautov1,BohdanTrach1,FranzGregor1,ThomasKnauth1,AndreMarGn1,ChrisGanPriebe2,JoshuaLind2,DivyaMuthukumaran2,DanO’Keeffe2,MarkLSGllwell2,DavidGoltzsche3,DavidEyers4,R¨udigerKapitza3,PeterPietzuch2,andChristofFetzer11Fakult¨atInformaGk,TUDresden,[email protected],ImperialCollegeLondon,[email protected],TUBraunschweig,[email protected],UniversityofOtago,[email protected]

SaeidMofrad

Page 2: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

1-INTRODUCTION:LinuxContainers:ContainersuseOS-levelvirtualizaGonandtheyarepopularforpackaging,deployingandmanagingservicessuchaskey/valuestoresandwebservers.UnlikeVMs,theydonotrequirehypervisorsoradedicatedOSkernel.Instead,theyusekernelfeaturestoisolateprocesses,andthusdonotneedtotrapsystemcallsoremulatehardwaredevices.•  Containerprocesscanrunasnormalsystemprocess.Theyarelightweight(theyusethehostOSforI/OoperaGons,resourcemanagement,etc.)fasterI/OthroughputandlatencythanVMsIsolaGonisweaksinceitisusingso`warekernelmechanisms,makeiteasierforaaackerstocompromisetheconfidenGalityandintegrityofapplicaGondatawithincontainers.•  DockerandLXCareusingforthepackagingofthecontainers.•  DockerSwarmorKubernetesareusingfortheirdeployment.

Page 3: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

WhatisSCONE?SCONEisaSecureContainerEnvironmentforDockerthatusesSGXtorunLinuxapplicaGonsinsecurecontainers.GoalofSCONE:1.  RununmodifiedLinuxapplicaGons2.  Incontainers3.  Inanuntrustedcloud4.  SecurelywithacceptableperformanceSCONEProper7es:1.  SecurecontainershaveasmallTCB.2.  Securecontainershavealowoverhead.3.  SecurecontainersaretransparenttoDocker.

Page 4: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Designtrade-offs:whatsystemsupportshouldbeplacedinsideanenclavetoenablethesecureexecuGonofLinuxprocessesinacontainer?Challenges:SecuritydecisionaboutthesizeoftheTCBandtheexposedinterfacetotheoutsideworldandperformanceimpactbecauseoftheSGXlimitaGon).TCBSIZE:BiggerTCBLargerAaacksurfaceExternalcontainerinterface:Toexecuteunmodifiedprocessesinsidesecurecontainers,thecontainermustsupportaCstandardlibrary(libc)interface.SinceanylibcimplementaGonmustusesystemcalls,whichcannotbeexecutedinsideofanenclave,asecurecontainermustalsoexposeanexternalinterfacetothehostOS.AsthehostOSisuntrusted,theexternalinterfacebecomesanaaackvector.

Page 5: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

TojusGfythedesignofSCONE,Theyexploredalternatedesignchoices.

Figure1ashowsapriordesignpoint,asdemonstratedbyHaven,whichminimizestheexternalinterfacebyplacinganenGreWindowslibraryOSinsidetheenclave.Abenefitofthisapproachisthatitexposesonlyasmallexternalinterfacewith22callsbecausealargeporGonofaprocess’systemsupportcanbeprovidedbythelibraryOS.ThelibraryOS,however,increasestheTCBsizeinsideoftheenclave.

Page 6: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

TojusGfythedesignofSCONE,Theyexplorealternatedesignchoices.(cont.) Figure1bshowstheopposite,extremedesign

point:theexternalinterfaceisusedtoperformalllibclibrarycallsmadebytheapplicaGon.ThisraisesthechallengeofprotecGngtheconfidenGalityandintegrityofapplicaGondatawhilstexposingawideinterface.Forexample,I/Ocallssuchasreadandwritecouldbeusedtocompromisedatawithintheenclave,andcodeinsidethesecurecontainercannottrustreturneddata.AbenefitofthisapproachisthatithasminimalTCBinsidetheenclave—onlyasmallshimClibraryneedstorelaylibccallstothehostlibclibraryoutsideoftheenclave.

Page 7: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

TojusGfythedesignofSCONE,Theyexploredalternatedesignchoices.(Cont.)

Figure1cshowsamiddlegroundbydefiningtheexternalinterfaceatthelevelofsystemcallsexecutedbythelibcimplementaGon.•  shieldlibrariescanbeusedtoprotectasecurity-sensiGvesetofsystemcalls:filedescriptorbasedI/Ocalls,suchasread,write,send,andrecv,areshieldedbytransparentlyencrypGnganddecrypGngtheuserdata.

Page 8: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Table1ShowstheperformanceandresourcemetricsforeachserviceusingtheLinuxlibraryOScomparedtoanaGveglibcdeployment.Onaverage,thelibraryOSincreasestheTCBsizeby5x,theservicelatencyby4xandhalvestheservicethroughput.

Page 9: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Observation: System call overhead and Memory Access Overhead. A micro-benchmarkonanIntelXeonCPUE3-1230v5at3.4GHzmeasuringthemaximumrateatwhichpwritesystemcallscanbeexecutedwithandwithoutanenclave.

Page 10: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Endofpresenta7on

Page 11: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre
Page 12: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

3.2Externalinterfaceshielding:SCONEsupportsasetofshields.Shieldsfocuson:(1)PrevenGnglow-levelaaacks,suchastheOSkernelcontrollingpointersandbuffersizespassedtotheservice(2)ensuringtheconfidenGalityandintegrityoftheapplicaGondatapassedthroughtheOS.SCONEsupportsshieldsfor:(1) thetransparentencrypGonoffiles(2)thetransparentencrypGonofcommunicaGonchannelsviaTLS(3)thetransparentencrypGonofconsolestreams.AshieldalsohasconfiguraGonparameters,whichareencryptedandcanbeaccessedonlya`ertheenclavehasbeeniniGalized.

Page 13: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Filesystemshield:ThefilesystemshieldprotectstheconfidenGalityandintegrityoffiles.Containerimagecreatormustdefinethreedisjointsetsoffilepathprefixes:(1) Unprotectedfiles,(2) encryptedandauthenGcatedfiles,(3) authenGcatedfiles.-ProcessesinasecurecontainerhaveaccesstothestandardDockertmpfs,butitiscostlyaslightweightalternaGveSCONEsupportsasecureephemeralfilesystemthroughitsfilesystemshield.theephemeralfilesystemmaintainsthestateofmodifiedfilesinnon-enclavememoryanditisfasterthantmpfs.Theephemeralfilesystemisresilientagainstrollbackaaack:a`errestarGngthecontainerprocess,thefilesystemreturnstoapreconfiguredstartupstatethatisvalidatedbythefilesystemshield,andthereforeitisnotpossibleforanaaackertorollbackthefilesystemtoanintermediatestate.ThisisalsotrueduringrunGme,sincethemetadataforfiles’blocksresideswithintheenclave.

Page 14: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Networkshield:SCONEpermitsclientstoestablishsecuretunnelstoitandwrapsallsocketoperaGonsandredirectsthemtoanetworkshield.Thenetworkshield,uponestablishinganewconnecGon,performsaTLShandshakeandencrypts/decryptsanydatatransmiaedthroughthesocket.TheprivatekeyandcerGficatearereadfromthecontainer’sfilesystem.Thus,theyareprotectedbythefilesystemshield.Consoleshield:Containerpermitauthorizedprocessestoaaachtothestdin,stdout,andstderr.SCONEsupportstransparentencrypGonforthem.ThesymmetricencrypGonkeyisexchangedbetweenthesecurecontainerandtheSCONEclientduringthestartupprocedure.Aconsoleshieldencryptsastreambysplijngitintovariable-sizedblocks.AstreamisprotectedagainstreplayandreorderingaaacksbyassigningeachblockauniqueidenGfier,whichischeckedbytheauthorizedSCONEclient.

Page 15: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

3.3Threadingmodel:SCONEsupportsanM:NthreadingmodelinwhichMapplicaGonthreadsinsidetheenclavearemappedtoNOSthreads.->fewerenclavetransiGons.

-MulGpleOSthreadsinSCONEcanenteranenclave.Eachthreadexecutesthescheduler.Schedulerchecksif:(1)anapplicaGonthreadneedstobewokenduetoanexpiredGmeoutorthearrivalofasystemcallresponse;or(2)anapplicaGonthreadiswaiGngtobescheduled.Inbothcases,theschedulerexecutestheassociatedthread.-ThenumberofOSthreadsinsidetheenclaveistypicallyboundbythenumberofCPUcores.-Thesystemcallthreadsresideinthekernelindefinitelytoeliminatetheoverheadofkernelmodeswitches.-Whentherearenopendingsystemcalls,thethreadsback-offtoreduceCPUload.

Page 16: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

3.4 Asynchronous system calls: Thisinterfaceconsistsoftwolock-free,mulG-producer,mulG-consumerqueues:arequestqueueandaresponsequeue.

1.  When system call happens copies memory-based

arguments outside of the enclave 2.  addsadescripGonofthesystemcalltoasyscallslotdatastructurecontainingthesystemcallnumberandarguments.Thesyscallslotandtheargumentsusethread-localstorage.3.  NexttheapplicaGonthreadyieldstothescheduler,which

willexecuteotherapplicaGonthreadsunGlthereplytothesystemcallisreceivedintheresponsequeue.

4.  Thesystemcallisissuedbyplacingareferencetothesyscallslotintotherequestqueue.

5.Whentheresultisavailableintheresponsequeue,buffersarecopiedtotheinsideoftheenclave,andallpointersareupdatedtopointtoenclavememorybuffers.6.TheassociatedapplicaGonthreadisscheduledagain.

Page 17: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

3.5Dockerintegra7on:TheintegraGonofsecurecontainerswithDockerrequireschangestothebuildprocessofsecureimage,andchangetoclient-sideextensions.SCONEdoesnotrequiremodificaGonstotheDockerEngineoritsAPI.

Containerstartup:EachsecurecontainerrequiresastartupconfiguraGonfile(SCF).TheSCFcontainskeystoencryptstandardI/Ostreams,ahashoftheFSprotecGonfileanditsencrypGonkey.SinceSGXdoesnotprotecttheconfidenGalityofenclavecode,pujngthestartupconfiguraGonintheenclaveitselfisnotanopGon.Instead,a`ertheexecutablehasiniGalizedtheenclave,theSCFisreceivedthroughaTLSprotectednetworkconnecGon,duringenclavestartup.

Page 18: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

Evalua7on:TheyUsedTwowebservers,Apache,andNGINX,Memcached;Redis;andSQLite.TheapplicaGonsincludeamixofcompute(e.g.,SQLite)andI/Ointensive(e.g.,ApacheandMemcached)workloads.Threevariantsforeachapplica7on:1-onebuiltwiththeGNUClibrary(glibc);2-onebuiltwiththemuslClibraryadaptedtoruninsideSGXenclaveswithsynchronoussystemcalls(SCONE-sync);3-onebuiltwiththesamemuslClibrarybutwithasynchronoussystemcalls(SCONE-async).ForapplicaGonsthatdonotsupportencrypGon(e.g.,MemcachedandRedis),theyuseStunneltoencrypttheircommunicaGonintheglibcvariant.

Page 19: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre
Page 20: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre
Page 21: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre
Page 22: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

FIGURE 14 SHOWS HOW MANY PWRITE() CALLS CAN BE EXECUTED BY SCONE-ASYNC, SCONE-SYNC AND NATIVELY.

Page 23: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

CONCLUSION

•  SCONEincreasestheconfidenGalityandintegrityofcontainerizedservicesusingIntelSGX.

•  TCBisbetween0.6–2theapplicaGoncodesizeandarecompaGblewithDocker.

•  asynchronoussystemcallsandakernelmodulemakeSGXoverheadless.

•  Forallevaluatedservices,theyachievedatleast60%ofthenaGvethroughput;

Page 24: SCONE: Secure Linux Containers with Intel SGX · 2016-11-12 · SCONE: Secure Linux Containers with Intel SGX Sergei Arnautov1, Bohdan Trach1, Franz Gregor1, Thomas Knauth1, Andre

REFERENCE:

•  haps://www.ibr.cs.tu-bs.de/users/goltzsch/papers/osdi2016scone-preprint.pdf

•  haps://www.usenix.org/sites/default/files/conference/protected-files/osdi16_slides_knauth.pdf