Docsity

Computer Security Rootkits, Lecture Slides - Computer Science, Slides of Computer Security

Partial preview of the text

Download Computer Security Rootkits, Lecture Slides - Computer Science and more Slides Computer Security in PDF only on Docsity!

Rootkits

CS 161/194-

Anthony D. Joseph

December 2, 2005

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 2

Administrivia

  • Final exam:
    • 1 LeConte Hall
    • Tuesday 12/13 12:30-3:
    • Comprehensive
    • Open books, notes, …
    • No electronic devices
  • No office hours for me next Mon/Tue
    • Substitute hours: Th 12-1, Fr 10-
  • Project 2 is on web page

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 3

Outline

• How to tell you’ve been 0wned?

• What is a rootkit?

• History of rootkits

• User-mode rootkits

• Kernel module/hooking rootkits

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 4

You’ve Been 0wned!

• How can you tell when your machine has

been compromised or taken over?

• “Odd” processes

• “Odd” windows

• “Extra” files

• Changed registry/configuration files

• “Extra” network connections, open ports

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 7

Rootkit Function: Maintain Access

  • Backdoor: telnet, rsh, ssh, irc, custom
    • UDP/TCP/ICMP protocol running on “high” port
    • Could require activation by “magic” TCP/IP

packet, be a stealthy network sniffer, or use a

covert channel, …

  • Outbound connection
    • Works behind firewalls, no open inbound port to

detect

  • Can be tunneled over outbound port 80

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 8

Rootkit Function: Attack Local or Other Systems

  • Collect local information
  • Install network sniffer
  • Perform DDoS attack
  • Attempt to propagate
  • …

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 9

Rootkit Function: Destroy Evidence

• Execute a log cleaner

• Hide its files

• Hide its processes

• Hide its network connections

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 10

How Rootkits Get On

Your Machine

• Cracker scans for vulnerable hosts

  • Or uses privilege elevation exploit
  • Or uses a worm or virus payload

• Exploits vulnerability to gain shell access

• Then copies over and installs rootkit …

  • Hides existence, records
  • Modifies start files
  • Starts daemon

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 13

Binary Library Rootkits: T0rn v

  • User-mode rootkit
  • Easy to use (precompiled binaries)
    • Just type ./t0rn.
    • Includes a log cleaner called t0rnsb
    • Also a network sniffer named t0rns and a log parser called t0rnp
  • Replaces the tools that would show the rootkit:
    • /usr/bin/du, /usr/bin/find, /sbin/ifconfig, /usr/sbin/in.fingerd, /bin/login, /bin/ls, /bin/netstat, /bin/ps, /usr/bin/sz, /usr/bin/top
  • Replaces system dynamic libraries to hide rootkit

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 14

Detecting T0rn v

  • Several serious implementation errors:
    • Different output from ps –eb than real one
    • Running netstat causes seg fault
  • Wrong file sizes versus real files
  • Easy to detect with lsof (list open files/ports)
    • Shows daemon listening on t0rn’s default port
    • Shows all processes running under t0rn daemon (since it has open files)
  • Can also be remotely detected
    • Use nmap to detect open ports
    • This is a common detection mechanism for non-stealthy rootkits
  • Libraries only work for dynamically linked programs

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 15

Kernel Module-based Rootkits

  • Target Linux, Free/OpenBSD and Solaris
  • Hook into the system kernel and replace/remap

or modify/intercept) various system calls

  • Ones used by file system tools, and core kernel components
  • Operating system core is no longer trustworthy
  • Config file or built-in filename regexps lists files

to hide:

  • Its own files, process, and sub-processes
  • Any of its inbound/outbound network connections (by address, protocol, listening process)

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 16

Detecting Kernel Module Rootkits

  • Challenge is detection “from within the box”
    • Rootkit controls the vertical and the horizontal
  • Leverage implementation errors
  • Look for inconsistencies between different views
    • Can use cryptographic hashes of all important files (but have to protect hash values…)
    • Use tcsh’s built-in ls: ls-F
    • Compare results from lower level interface
  • Ideal solution:
    • Compare against known good system or CDROM
      • Boot from CDROM/remote system and then examine disk

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 19

Detecting Windows Kernel Rootkits

  • Examine startup registry entries
    • Works for many rootkits
  • In the box checks
    • Compare Win32 API results with results from low level kernel calls (e.g., process list, master file table,…)
    • Compare cryptographic hashes against known correct values
    • Look for hiding actions (create file/dir with prefixes)
  • Out of the box checks
    • Compare against known good media/system

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 20

Rooting a Windows Kernel Rootkit

  • Microsoft Research Tricks for using rootkit

against itself

  • Same name attack
    • Copy cmd.exe to same name/prefix as rootkit
    • Launch with start command
    • Rootkit can’t hook itself, so built-in commands can run and see rootkit files, processes, directories, …
  • Tools same name attack
    • Pick tool of choice for removing rootkit
    • Use same name attack, as rootkit won’t block itself

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 21

Kernel Hooking Abuses

• Many anti-virus, firewall, anti-spyware and

other tools use kernel hooking tricks

  • Can affect system stability when multiple

programs are hooking kernel

  • MS Vista will block unsigned program hooking

• Sony XCP used kernel hooking to hide

itself

• Problem is that crackers may be able to

exploit cloaking to hide their tools!

December 2, 2005 (^) Joseph/Tygar/Vazirani/WagnerCS161 Fall 2005 22

The Future of Rootkits

• On going arms race between crackers and

detection tools…

• Out of the box detection will always be

possible

• In the box detection will increase in

difficulty