us-14-Forshaw-Digging-For_IE11-Sandbox-Escapes

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

7/1/2014DiggingforSandboxEscapesFindingsandboxbreakoutsinInternetExplorerJamesForshaw@tiraniddoBlackhatUSA2014WhatI’mGoingtoTalkAbout•UnderstandingtheIE11sandbox•Howtofindsandboxescapes•Wheretolookforissues•TechnicaldetailsoffixedbugsI’vefoundToolsandSetupResources•ExamplecodeandExploitDotNetDCOMavailable:–•LatestversionofOleViewDotNet:–•ExcellentwriteupofEPMbyMarkVincentYason–BlackhatASIA2014ArchivesBackgroundonIE11SandboxingIEProtectedModeFrameProcessUserPermissionInternetTabProcessIntranetZoneProcessInternetTabProcessInternetZoneProcessLowPermissionNetworkIPCBoundaryUserBrokerLowPermissionProcesses•ProtectedModeusesIntegrityLevels•InternetZoneProcessrunswithLowILinToken–Restrictswriteaccesstomajoritysecurableresources–RestrictsWin32throughUserInterfacePrivilegedIsolation–DoesNOTrestrictreadaccesstomostresources•Processes/Threadsalsohaveno-read-upbydefaultWhatDoesitMean,Enhanced?•EnhancedProtectedMode(EPM)newinWindows8•UsesWindows8AppContainer’stofurtherrestrictwhatsandboxedprocesscandoAppContainerResourceAccess•Restrictsreadandwriteaccesstoresources•DACLmustgiveaccesstooneormoreof:–AppContainerSID–S-1-15-3-4096–SIDforInternetExplorerCapability–ALLAPPLICATIONPACKAGESgroupSID•LowILstillappliesaswelltorestrictwritesFurtherCapabilitiesUserBrokerServices•Mediumintegritybrokerprovidesvariousservicesonbehalfofprotectedmodeprocess–Providesaccesstoresourcesfromlowintegrity•Certainfunctionshookedandredirectedtobrokerautomatically–CreateProcessWandWinExec–CoCreateInstanceandCoCreateInstanceEx–CoGetClassObject•UsesregistrybasedelevationpolicytocontrolwhatisallowedElevationPolicyElevationPolicyTypesExecutableCOMObjectElevationPolicyTypesValueResult3ProtectedModesilentlylaunchesthebrokerasamediumintegrityprocess.2ProtectedModepromptstheuserforpermissiontolaunchtheprocess.Ifpermissionisgranted,theprocessislaunchedasamediumintegrityprocess.1ProtectedModesilentlylaunchesthebrokerasalowintegrityprocess.0ProtectedModepreventstheprocessfromlaunching.COM101•MajorityofBrokerServicesexposedoverCOM•ObjectsidentifiedbyaClassID(CLSID)GUID•ImplementedbyaServer,eitheraDLLoranExecutable•AnobjectcanhavemultipleInterfacesidentifiedbyInterfaceID(IID)•AllobjectssupporttheIUnknowninterface.–ImplementsQueryInterfacemethod,allowscallertoquerybetweenobjects•Abstractprogrammingmodel,canbeusedlocallyorremotely(DistributedCOM/DCOM).PotentialAttackSurfaceFrameProcessUserPermissionInternetZoneProcessLowPermissionIPCBoundaryUserBrokerAccessibleResourcesAllowedThroughElevationPolicyIEProcessStructure•IEXPLORE.EXEdoesn’tdoverymuch,justhandsofftoieframe!IEWinMain•Ieframe.dllalsocontainsmostofthebrokerimplementation•Supportlibrariesierutil.dllandieproxy.dllalsoofimportanceEnablingEPM•WasdefaultonRTM8.1•DisabledagaininMS13-088•Alsosupports64bittabprocesses•DefaultifusingModernModeTestingSandboxEscapes•Wanttotestsandboxescapes?•NoRCE?Noproblem.•UseasimpleDLLinjectorvoid*pBuf=VirtualAllocEx(hProc,0,strlen(dllpath)+1,MEM_COMMIT,PAGE_READWRITE);WriteProcessMemory(hProc,pBuf,dllpath,strlen(dllpath)+1)LPVOIDpLL=GetProcAddress(GetModuleHandle(Lkernel32),LoadLibraryA);CreateRemoteThread(hProc,NULL,0,pLL,pBuf,0,NULL)SetAppropriatePermissions•CreateadirectoryforDLLs•Add“ALLAPPLICATIONPACKAGES”ACEtodirectoryDACL•FileswillinheritACESimpleDLLTestHarnessDWORDCALLBACKExploitThread(LPVOIDhModule){//DoWorkthenexitandfreelibraryFreeLibraryAndExitThread((HMODULE)hModule,0);}BOOLAPIENTRYDllMain(HMODULEhModule,DWORDul_reason_for_call,LPVOIDlpReserved){switch(ul_reason_for_call){caseDLL_PROCESS_ATTACH:CreateThread(NULL,0,ExploitThread,hModule,0,NULL);break;default:break;}returnTRUE;}FindingandExploitingAccessibleResourcesSearchingforAccessibleResourcesSet-Location'HKCU:\'$iesid=S-1-15-3-4096$aapsid=APPLICATIONPACKAGEAUTHORITY\ALLAPPLICATIONPACKAGESForEach($keyin(Get-ChildItem-recurse)){$acl=Get-Acl-path$key.PSPathForEach($acein$acl.Access){If($ace.RegistryRights-eq[Security.AccessControl.RegistryRights]::FullControl-and$ace.IdentityReference.Value-in$iesid,$aapsid){Write-Output$key.PSPath}}}ProcessMonitorfortheWin!•IdentifiedkeysalwayscreatedbymediumintegrityIEprocessatstart-upProcessMonitorfortheWin!•IdentifiedkeysalwayscreatedbymediumintegrityIEprocessatstart-up•IESetProtectedModeRegKeyOnlylooksinterestingIESetProtectedModeRegKeyOnlyIESetProtectedModeRegKeyOnly•Createskeyifitdoesn’texist•IfnotaccessiblefromAppContainer–Addlowintegritylabel–AddIECapabilitySIDtoDACLStartDoesKeyExist?CreateKeyIsKeyAccessible?NOYESMakeAccessibleNOEndYESSoWhat?•CaninducemediumintegrityIEtocreatekeys•AnykeywecreatewillhaveACLallowingEPMprocessfullaccess•Butsurelywecan’tcreateanyinterestingkeys?•Wellobviouslywecan!RegistrySymbolicLinksFindingaTargetKeyExploitation:Step1•Createasymboliclinkfromaccessibleregistryareatotarget:SymbolicLinkNtCreateKey(&hKey,KEY_ALL_ACCESS,&oa,0,NULL,REG_OPTION_CREATE_LINK,&disposition);RltInitUnicodeString(&valuename,LSymbolicLinkValue);NtSetValueKey(hKey,&valuename,0,REG_LINK,dst,wcslen(dst)*sizeof(WCH

1 / 74
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功