1 of 62

A Worm in the Apple

Exploration of Mac malware

Wes Widner

@kai5263499

wes@manwe.io

2 of 62

Introduction

Information security engineer by day, malware researcher by night

Also father of 4, so nights tend to be pretty short

Previous talks have been about malware pipelines in general

3 of 62

Macs are secure, right?

4 of 62

5 of 62

Before 2012

6 of 62

After 2012

7 of 62

Flashback

  • Actually it started in September 2011
  • Got its name by offering a Flash upgrade
  • Poor English and other errors gave it away
  • In February 2012 it changed tactics
  • Took advantage of an unpatched Java vulnerability
  • Apple still argues it was Sun’s fault
  • Claimed 600k (~1%) according to Dr Web
  • Generated revenue (~$14k) through click fraud
  • Contained advanced features that weren’t used
  • Self-encrypting

8 of 62

9 of 62

10 of 62

Flashback part 2

  • ~20k infections as recently as 2014
  • Tracked by Intego sinkhole
  • No big deal
  • In reality Apple spent the rest of the year cleaning up the mess
  • Apple suddenly found themselves playing catch up

11 of 62

But that was a fluke, right?

12 of 62

Apple and many experts still don’t recommend using protection

  • Infections are rare
  • Apple is taking care of it

13 of 62

Perhaps some history will help

14 of 62

Mac malware history

  • 1982 Prehistory: Elk Cloner
  • 1987 nVIR
  • 1988 HyperCard
  • 1990 MDEF
  • 1991 German folk tunes
  • 1995 Word macro viruses
  • 1996 Laroux – viruses for Excel
  • 1996 AutoStart 9805 and Sevendust
  • 2004 MW2004 / Renepo, aka Opener / Renepo and Amphimix
  • 2005 Cowhand

15 of 62

  • 2006 Exploit.OSX.Safari, aka OSX.Exploit.Metadata / Leap, aka Oompa Loompa, the first virus for Mac OS X / Inqtana / OSX.Exploit.Launchd / Macarena
  • 2007 RSPlug, aka DNSChanger, aka Jahlav, aka Puper / OpenOffice BadBunny and RSPlug financial malware
  • 2008 MacSweeper, aka Immunizator / AsTHT, aka Hovdy, aka AplS.Saprilt / PokerStealer, aka Corpref / Lamzev, aka Malev / Scareware, backdoors and Jahlav
  • 2009 iServices, aka iWorkServices, aka Krowi / Tored
  • 2010 HellRTS, aka Pinhead, aka Hellraiser / OpinionSpy, aka Premier Opinion, aka Spynion / Koobface, aka Boonana

16 of 62

  • 2011 BlackHole RAT, aka MusMinim, aka DarkHole / MacDefender, aka MacSecurity, aka MacProtector, aka MacGuard, aka MacShield, aka Defma / QHost, also HostMod-A / Revir, aka Imuler, aka Muxler / Flashback, aka Flashfake / DevilRobber, aka Miner-D / FinFisher
  • 2012 FileSteal, Hackback, KitM / Tibet, aka MacControl, aka MaControl, aka MacKontrol / Sabpab, aka Sabpub, aka Mdropper, aka Lamadai, aka Olyx / FkCodec/Codec-M / Maljava / GetShell, aka SET.gen, aka ShellCode, aka MetaData, aka TESrel / Crisis, aka Morcut, aka DaVinci / NetWeird, aka Wirenet / Jacksbot / Dockster / SMSSend
  • 2013 Pintsized / CallMe / Minesteal / KitM / Janicab / ClickAgent / Leverage / Icefog
  • 2014 LaoShu / CoinThief / XSLCmd / iWorm / Ventir / WireLurker, aka Machook / DMA “evil maid” attacks

17 of 62

  • 2015 Lamadai / Kitm / Hackback / LaoShu / Appetite, trojan targeting government organizations / Imuler / Coin Thief / Suspend-resume rootkit
  • 2016 KeRanger, first ransomware / Mokes / Keydnap / USB attack
  • 2017 Quimitchin / Fruitfly backdoor targeting medical research

18 of 62

19 of 62

20 of 62

21 of 62

22 of 62

23 of 62

24 of 62

Apple still actively fights with vendors

  • iOS is a heavily walled garden
  • OSX is becoming a walled garden

25 of 62

26 of 62

27 of 62

28 of 62

29 of 62

30 of 62

31 of 62

32 of 62

33 of 62

34 of 62

The Apple fights back

35 of 62

36 of 62

37 of 62

38 of 62

39 of 62

iDroid

40 of 62

41 of 62

42 of 62

  • 2009 XProtect / File Quarantine
  • 2011 Sandboxing
  • 2012 Gatekeeper
  • 2015 System Integrity Protection
  • 2016 XProtect + Yara

43 of 62

44 of 62

45 of 62

Firewall

  • OSX comes with one one but two firewalls
    • Application level firewall (alf)
    • Packet Filter (pf)

46 of 62

Little Snitch

47 of 62

Icefloor - open source GUI pf manager

48 of 62

Software installation

  • Archives everywhere
  • Application bundles
  • DMG
    • What magic bytes?
    • FileVault encryption
  • PKGs
    • the self-executables of the OSX world
    • Natively compressed in xar format
    • Can specify sandbox rules
  • App Store
    • Signed and sandboxed

49 of 62

Code signing

  • XNU
  • Hybrid
  • BSD
    • POSIX interface
    • Mandatory Access Control Framework
  • Mach
    • Microkernel developed at Carnegie Mellon�For parallel computing
    • Released in 1985
    • Provides the basis for some interesting OSX rootkits

Huxley the Platapus

50 of 62

MachO

  • Similar to ELF
    • Biggest difference is native code-signing support
  • Same magic bytes (0xCAFEBABE) as Java class files
  • IPC ports
    • Not network ports
    • Unix ports but in kernel land
  • Resource forks

51 of 62

52 of 62

53 of 62

54 of 62

Little Flocker

55 of 62

Boot - in the beginning

  • UEFI
    • FAT boot partition
    • Firmware passwords
    • Pystar and Rebel EFI
    • Copyrighted bootloader
    • Physical attacks
      • Firewire DMA
      • Evil USB
  • kext - Kernel extensions
  • dyld
    • Preloaded libraries in
    • Mac interposes its own malloc function
  • launchd
    • .plist

56 of 62

57 of 62

58 of 62

59 of 62

60 of 62

61 of 62

Books worth getting

62 of 62

Thanks for attending!

Mac malware feed: http://ow.ly/O1WM303qAkV

Mac infosec homebrew tap: http://ow.ly/c1LZ303pKwa

OSX Security Awesome: http://ow.ly/uWEj303pKuf

These slides: http://ow.ly/DpNQ305KfPd