33
Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIR SUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC

Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

MacOSXandiOSForensicsLOOKINGINTOTHEPASTWITHFSEVENTSSANSDF IR SUMMIT 2017NICOLE IBRAHIMG-C PARTNERS, LLC

Page 2: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

WhoamI?

• DigitalForensicsExpertatG-CPartners

• Parttimeresearcher

• Parttimeprogrammer

Nicole Ibrahim | Consultant | G-C Partners, [email protected] | @nicoleibrahim

Page 3: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Importance

• Recordshistoricalfilesystemactivityovertime

• CurrentlynotbeingfullyutilizedbyMacexaminers

• ContainsUserandOSactivity• Creations,deletions,renames,permissionchangesandmore.

• Identifynamesoffilesthatwerepreviouslyexistingbuthavesincebeendeleted

• Identifywhatchangesoccurredtofilesoninterest

Page 4: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Agenda

• IntroductiontoFSEvents

• ParsingFSEvents

• Interestingartifacts

• Caveats

Page 5: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

IntroductiontoFSEvents

Page 6: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

IntroductiontoFSEvents• FSEventsorFileSystemEvents

• GeneratedbyAppleOSFSEventsAPI• Introducedin10.5(Onlydirectoryeventsupto10.6)• In10.7fileeventswereintroduced

• StoredinFSEventlogfiles(gzip)• Historicaleventsofchangesonthefilesystem• Logscanspandaystomonths

• FoundoniOS,OSXdevices,externaldevicespluggedintoaMac

Page 7: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

IntroductiontoFSEvents

• LocationinOSX:• /.fseventsd

• LocationiniOS:• Data:/private/var/.fseventsd• System:/.fseventsd• DeveloperPatch:/DeveloperPatch/.fseventsd

• Gzip archiveformat

• NameislastEventIDstoredintheFSevent logfileplus1.• E.g “00000000000a4b3e”or674,622decimal

FSEVENTLOGS

Page 8: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

IntroductiontoFSEvents

LIFECYCLEOFANFSEVENTRECORD

Anobjectischanged

APIchecksmemorybuffertoseeifalready

assignedeventID

Ifyes,recordflagsupdatedinmemory.Ifnot,nextavailableIDassigned.Eventstored

inmemory

Whenmemorybufferisfullorvolume

unmountedallrecordsarewrittentodiskand

bufferiscleared

Page 9: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

DecodingFSEvents

Page 10: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

DecodingFSEvents

•Therelativefullpathtothefilesystemobjectthatincurredachange.FullPath

•EventIDassignedtofullpathonfirstchange.EventID

•Recordflagsindicatingthetypeofobjectthatwaschangedandwhatchangedforit.RecordFlags

FSEVENTRECORDCOMPONENTS

• AnuncompressedFSEventlogcancontain1ormorepageswiththemagicheader“1SLD”

• Eachlogcancontainupto5,000events

• EventsareorderedalphabeticallybyFullPath

• Eachrecordconsistsof3components

Page 11: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

DecodingFSEvents

FSEVENTRECORDFLAGS

• Typeflagsinclude:• File• Folder• Hardlink• Symboliclink

• Reasonflagsinclude:• Created• Removed• Modified• Renamed• Permissions• Inode metadata

• Finderinformation• Mount• Unmount• Lasthardlinkremoved• Endoftransaction• Documentrevisions

Page 12: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital
Page 13: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

ParsingFSEvents

Page 14: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

ParsingFSEvents

BLACKBAG BLACKLIGHT SOFTWARE

• Closedsourceandpaid

• https://www.blackbagtech.com/software-products/blacklight.html

Page 15: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

ParsingFSEvents

G-CPARTNERSFSEVENTSPARSER SCRIPT

• Opensourceandfree

• Python

• Availableathttps://github.com/dlcowen/FSEventsParser

Page 16: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

InterestingArtifacts

Page 17: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts

OS X

• Justscratchingthesurfaceofinterestingartifacts:• .Trashactivity• Userfoldersactivity• Internetactivity• Mountevents

Page 18: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:OSXTRASHACTIVITY• FilessenttotheTrash

• EmptyingtheTrash

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE'Users/%/.Trash/%'

Page 19: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:OSXUSERFOLDERSACTIVITY• Activityin:

• “Documents”• “Downloads”• “Desktop”

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE'Users/%/Documents/%’OR"filename"LIKE'Users/%/Downloads/%’OR"filename"LIKE'Users/%/Desktop/%'

Page 20: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:OSXINTERNETACTIVITY• Websitesvisited

• Chrome• Safari

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE

'Users/%/Library/Caches/Metadata/Safari/History/%'OR"filename"LIKE'Users/%/Library/ApplicationSupport/Google/Chrome/Default/LocalStorage/%'

Page 21: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:OSXMOUNTACTIVITY• Mountactivityrelatedto:

• DMGs• Externaldevices• Sharednetworkdrives

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"mask"LIKE'%mount%'

Page 22: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Artifacts

IOS

• iCloudsyncedfiles

• Internetactivity

• Emailactivity

Page 23: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:iOSICLOUDSYNCEDFILES• iCloudsyncedfilesfromotherdevices

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE'mobile/Library/Mobile

Documents/com~apple~CloudDocs/%'

Page 24: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:iOSINTERNETACTIVITY• Websitesvisited?

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE'%websitedata/local%'

Page 25: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

RecordArtifacts:iOSEMAILACTIVITY• Inbox

• Sent

• Attachments

SELECT*,_ROWID_"NAVICAT_ROWID"

FROM"fsevents"

WHERE"filename"LIKE'mobile/Library/Mail/%’

Page 26: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats

Page 27: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats• LostFSEvents

• Lackoftimestamps

• Externaldevices

• Anti-forensics

• Coalescingofmultiplechanges

Page 28: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats:LostFSEvents

PROBLEM

• FSEventsarelostduetoeither:• Ahardresetofasystem• Asystemcrash• Notproperlyunmountingavolume

• Systemupgrades

REMEDIES

• Carveforgzip files

Page 29: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats:LackofTimestamps

• FSEventRecordsconsistof:• EventID• FullPath• Flags

• Notetimestampsarenotmentioned

PROBLEM REMEDIES

• Usetemporaldatafromthenamesoflogs

Page 30: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats:ExternalDevices

PROBLEM

• Unsaferemovalresultsinlostevents

• Saferemovalwasperformed,butFSEventsnotfinishedwritingtodisk

• Filesystemcompatibilityissuesresultsinlostevents

REMEDIES

• Hopethattheuserhasproperlyunmountedtheirdevices• CarvingforthoselosteventsmightnotbepossibleduetoFSEventsbeingstoredinmemory

Page 31: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats:Coalescingofmultiplechanges

PROBLEM

• TheFSEventsAPIcoalescesmultiplechangesintoasinglerecordresultingin:• Inabilitytodetermineorderofchanges

• Inabilitytodeterminefrequencyofchanges

REMEDIES

• NoneThisfilemayhavebeencreated3timesandremovedtwice,butwewillneverknow

Page 32: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Caveats:Anti-Forensics

PROBLEM

• Ano_log filewasplacedinthe.fseventsd directory• FSEventsarenotrecordedforthevolume

REMEDIES

• None.However,thisscenarioisunlikelyandrequiresrootprivilegesandadvancedknowledgeofFSEvents

Page 33: Mac OS X and iOS Forensics - PUT.AS€¦ · Mac OS X and iOS Forensics LOOKING INTO THE PAST WITH FSEVENTS SANS DFIRSUMMIT 2017 NICOLE IBRAHIM G-C PARTNERS, LLC. Who am I? •Digital

Questions?

Nicole Ibrahim | Consultant | G-C Partners, [email protected] | @nicoleibrahim