Top Banner
Welcome to Rootkit Country CanSecWest 03/2011
29
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: Cigarette VS Bubble Gum

Welcome to Rootkit Country CanSecWest 03/2011

Page 2: Cigarette VS Bubble Gum

Graeme Neilson

Security Consultant & Researcher

Aura Software Security

[email protected]

Page 3: Cigarette VS Bubble Gum

Rootkit == cancerous software

“A rootkit is software that enables continued privileged access to a computer while actively hiding its presence from administrators by subverting standard operating system functionality or other applications.” Wikipedia

BIOS Applications Kernel System

Page 4: Cigarette VS Bubble Gum

Patches and Gum

•  Mandatory access control •  Memory access restrictions •  File integrity checks (checksums, hashes) •  Immutable files (secure run levels, ro filesystems) •  Signed software •  Encrypted software

Page 5: Cigarette VS Bubble Gum

UTMs / Firewalls / Routers?

Why are they a target? •  Route traffic •  Mirror traffic •  Layer 2 control •  VPN endpoint •  Management network connectivity •  Choke points for many networks Endpoint physical access can be outside owner's control.

Page 6: Cigarette VS Bubble Gum

UTMs / Firewalls / Routers?

How can they be attacked? •  Insider •  Social Engineering •  Physical Access •  Supply Chain •  [ Exploits ] Can I trust the integrity of the operating systems? How easy is it to rootkit these devices?

Page 7: Cigarette VS Bubble Gum

Platforms

Page 8: Cigarette VS Bubble Gum

Roll your 0wn 1.  Go shopping. 1.  Obtain firmware. Download, backups, compact flash, hard disk, VM 2.  Identify the firmware. Linux, FreeBSD, vxWorks, proprietary 3.  Gain root level access.

ñ  Break restricted shell ñ  Crack password ñ  Bypass encryption ñ  Reverse engineer firmware ñ  NO custom hardware

4.  Determine layer to attack. BIOS, Kernel, System, Application

Page 9: Cigarette VS Bubble Gum

WatchGuard

OS XTMOS Linux 2.6.21 Arch i686

Bootloader GRUB

Storage Removable CF Firmware Format Gzip image with custom

header Restricted Shell yes Root access Hardcoded password Integrity Checksum command

Page 10: Cigarette VS Bubble Gum

SilkGuard Rootkit

Root access: •  add static compiled shell busybox •  add authorized_key to /root/.ssh/ •  remount rootfs read write Layers to attack: •  kernel, libraries and applications

Page 11: Cigarette VS Bubble Gum

Netgear ProSecure

OS Linux 2.6.21 Arch MIPS

Bootloader GRUB

Storage Removable CF Firmware Format SquashFS Root access Random password at boot File System RO unionfs Integrity none

Page 12: Cigarette VS Bubble Gum

NetHill Rootkit

Root access: •  squashsfs 3.4 (big-endian support) •  new rootfs.img with root password blanked Layers to attack: •  apt-get can be enabled •  system-map & config present on system •  /dev/kmem (LKM), libraries, application

Page 13: Cigarette VS Bubble Gum

CheckPoint Secure Platform

OS CP Linux (RHEL) 2.6.18 Arch i686 / Virtual

Bootloader GRUB

Storage ISO Firmware Format ISO Restricted Shell Yes Root access Yes File System ext Integrity none

Page 14: Cigarette VS Bubble Gum

LuckyPoint Rootkit

Root access: •  Built in through “expert” mode •  RHEL but no SELinux Layers to attack: •  System map and config available but /dev/mem restricted to first 2056 records •  Libraries and applications

Page 15: Cigarette VS Bubble Gum

Checkpoint Nokia

Nokia IP71 common endpoint device for CheckPoint SP - has removable, flashable BIOS - BIOS integrity check is a simple checksum - BIOS modification and rootkit possible

Page 16: Cigarette VS Bubble Gum

Fortinet FortiOS

OS FortiOS Linux

Arch i686

Bootloader GRUB

Storage Removable CF Firmware Format Gzip Restricted Shell yes Root access no File System Encrypted AES CBC Integrity FortiBIOS

Firmware encrypted, signed & hashed

Page 17: Cigarette VS Bubble Gum

Export-F Rootkit

Root access: Fortigate will load firmware with •  no certificate, no hash, unencrypted •  start of MBR must contain a filename

matching a device & version ID •  kernel must have a specific name Layers to attack: •  Load replacement kernel and file system

Page 18: Cigarette VS Bubble Gum

Sonicwall OS SonicOS vxWorks Arch i686

Bootloader ?

Storage Secure Compact Flash

Firmware Format Encrypted / Compressed

Restricted Shell Yes Root access No File System vxWorks Integrity Signature

Page 19: Cigarette VS Bubble Gum

Cancer Free

Root access: •  Removable Storage Compact Flash ...but its unreadable... •  Removable BIOS ...but its unreadable... •  Firmware can be backed up ...but its signed...

Page 20: Cigarette VS Bubble Gum

Cisco IOS - Da Los Rootkit

OS IOS Arch MIPS / PowerPC

Bootloader Proprietary

Storage Flash Firmware Format Compressed Restricted Shell Yes Root access No File System Memory Integrity Checksum

Sebastian Muniz, Killing the myth of Cisco IOS rootkits: DIK

Page 21: Cigarette VS Bubble Gum

Juniper ScreenOS

OS ScreenOS Arch PowerPC

Bootloader Proprietary

Storage Flash Firmware Format Compressed

(modded LZMA or GZIP) Restricted Shell Yes Root access No File System Memory Integrity Checksum, optional signature

Page 22: Cigarette VS Bubble Gum

Junboro Light Rootkit

Root Access: l  Firmware is compressed (non standard LZMA header) l  Reverse engineer format l  Disassemble ScreenOS •  Reverse engineer firmware checksum algorithm l  Firmware is signed but certificate can be loaded and unloaded Layers to attack: l  Flat memory, monolithic firmware, access to everything l  Hand code PowerPC ASM into firmware

Page 23: Cigarette VS Bubble Gum

Juniper JUNOS

OS ScreenOS Arch i686 / Virtual

Bootloader FreeBSD

Storage Flash, HDD Firmware Format Package Restricted Shell Yes Root access Yes File System RO iso9660 Memory Restricted access Integrity Veriexec, secure level 1,

Package hashes, optional signature

Page 24: Cigarette VS Bubble Gum

Junboro Rootkit Root access •  Root by default but there are restrictions •  JUNOS binaries are symlinks from rw fs to iso9660 ro fs •  Secure run level 1 is set •  Veriexec used for integrity and to stop unknown binaries running •  +x shell scripts will not run directly but will run if invoked by /bin/sh Layers to attack: •  JUNOS doesn't require/enforce signed packages •  Install trojaned package using customised +INSTALL script

Page 25: Cigarette VS Bubble Gum

Demos

Make Arch OS

1. Fortinet Intel Linux 2. Juniper PPC ScreenOS 3. Juniper VM JUNOS

Page 26: Cigarette VS Bubble Gum

Device & OS Encrypt Sign Immutable Integrity Memory

Sonicwall Y Y Y Y -

Juniper JUNOS N Y Y Y -

Fortinet Y Y N Y - Juniper ScreenOS N Y N Y -

Cisco IOS N N N Y -

Checkpoint N N N N Y

Netgear N N N N N

Watchguard N N N N N

Page 27: Cigarette VS Bubble Gum

Conclusion

•  Some platforms don't even try to ensure integrity •  A PS3 has better integrity protection than most platforms (IP vs your data?) •  Often signatures and encryption requirements can be bypassed •  Do periodic offline comparisons of system binary / firmware hashes •  Check supply chain, third party support

Page 28: Cigarette VS Bubble Gum

References Runtime Kernel Mem Patching, http://vxheavens.com/lib/vsc07.html, Silvio Cesare Killing the myth of Cisco IOS rootkits: DIK (Da Ios rootKit), http://eusecwest.com/esw08/esw08-muniz.pdf Hacking Grub for fun and profit, Phrack Volume 0x0b, Issue 0x3f, CoolQ Static Kernel Patching, Phrack Volume 0x0b, Issue 0x3c, jbtzhm Playing Games With Kernel Memory ... FreeBSD Style, Phrack Volume 0x0b, Issue 0x3f, Joseph Kong Implementing and detecting ACPI BIOS rootkit, http://www.blackhat.com/presentations/bh-federal-06/ BH-Fed-06-Heasman.pdf

Page 29: Cigarette VS Bubble Gum

Questions?