UNIX Cracking Presentation - Spring 2001 for InfraGard

Version 0.2

Presented by the LSU Office of Computing Services, High Performance Computing Staff.

Return to the Top of Page


Introduction

The Presenters

The Presentation

This presentation will demonstrate a live crack of a GNU/Linux server. Although we have "pre-staged" the software, and have obviously tested the entire scenario, all the techniques and software we will use were gathered from the Internet.

This presentation is not a lesson on "How To Crack." Instead, the focus will be on demonstrating the mechanics of a crack with a typical cracker scenario. As such, we will spend much of the time looking at the state of the cracked system. Our point is to show how simple it can be to crack a vulnerable system, given the necessary tools, preparation, and enough time.

Throughout the presentation we will attempt to make each step clear by defining the purpose of a task and giving a top-level explaination of the technology being used. Please feel free to ask clarifying questions as the presentation progresses.

Scenario

These systems are all part of the Here.com domain that belongs to a fictitious company which is connected to the Internet. We are assuming that the system the cracker is going to use, emaca.here.com, has already been compromised, or is a disgruntled employee within the organization, or is a true cracker "stealing" a connection from the company's IP space.

Return to the Top of Page


Hardware Description

This is a description of each of the systems used in the demonstration. They are all connected to a completely private Ethernet network.

Cracked System

Cracker's System

Employee / Presentation System

Network

Return to the Top of Page


Software Description

This is a description of all the major software used on each of the systems. Again, all of this software was pulled directly from the Internet.

Cracked System

Cracker's System

Employee / Presentation System

Return to the Top of Page


The Crack

Here is a top level view of how the crack will proceed:

Return to the Top of Page


nmap of Here.com

The cracker

nmap, available from http://www.nmap.org, provides "network-wide ping sweep, portscan and OS detection." It is a tool widely used, by both crackers and network/system administrators, to map out a network.

The cracker runs nmapfe, the graphical interface to nmap, using the defaults:

The cracker only needs to enter the IP network to scan: 192.168.3.0/24 (which is the base network address with the number of bits in the sub-net mask).

The command-line would be:

Here's the output:

Now knowing that server is a GNU/Linux system (nmap told us it was running a GNU/Linux kernel), the cracker uses telnet to try and determine which version of GNU/Linux is running, hoping for a default "welcome message:"

The server

Various logs on the server system will show some information about what has been done so far.

Security conscious system administrators looking at their logs will see a telnet connection without a corresponding login and may become suspicious.

Return to the Top of Page


Initial Sniff

The cracker

After detecting the systems on the network, the cracker decides to sniff the network and see what can be seen. With ethereal, the cracker simply calls up the GUI, selects "Capture packets in promiscuous mode," and deselect "Enable name resolution," and starts capturing packets.

Functioning just like Network General's sniffer, data can be viewed in a very raw form. ethereal also allows the cracker to choose Tools | Follow TCP Stream and "see" a connection to the server. In this case, the cracker can see john logging in to server to do real work, capturing his password.

Notice that you can see each typed character and its echo back to the client. The cracker was lucky to get this information, but we'll pretend we didn't learn this and proceed with the planned crack.

The server

The server will show user john's legitimate login, but it will not show any indication that the network is being sniffed. Here is the server system's /var/log/messages entry for john's login:

And here is the server system's /var/log/secure entry for john's login:

Being suspicious, the system administrator issues a who to see who's on the system:

Return to the Top of Page


Initial Exploit

The cracker

Seeing from the nmap scan that the server system is running sunrpc services and knowing that server is a RedHat GNU/Linux system, the cracker attempts to use an rpc.statd exploit specifically made for GNU/Linux. The rpc.statd is part of the Network File System (NFS) which is installed by default on both client and server installations and is rarely used.

Here's what happens:

This exploit failed. It's attempting to "buffer-overflow" the rpc.statd program. A buffer-overflow is a technique to send too much data to a service. The extra data is actually system executable code that runs and provides a "root shell" to the cracker.

The server

The administrator of the server system can see the exploit attempt by looking in the /var/log/messages log.

The buffer overflow is clearly visible. Unfortunately, you can not see which system tried to exploit you. The system administrator looks at the /etc/passwd file to verify the integrity of the system:

Return to the Top of Page


Successful Exploit

The cracker

Not daunted by the first failure, the cracker attempts a second exploit. Based on the nmap and telnet from above and a little extra knowledge, the cracker has the following information:

Based on this, the cracker tries a wu-ftpd exploit.

This exploit works! The cracker can then do the following:

The exploit gives the cracker a "root shell" into the server system, but there is no prompt for the shell because it's being handled by the FTP server. Here are the actual commands the cracker types and the real output:

At this point, the server system is effectively under the control of the cracker (owned)!

The server

The system administrator on server now sees the following information:

At this point, the administrator would realize they have been cracked and would start looking, in detail, at their system. The easiest thing to look at is the /etc/passwd file:

Return to the Top of Page


Complete the Takeover

The cracker

At this point the exploit succeeded and the cracker "owns" the system. The cracker should now think about the following:

Hiding

The cracker will grab their pre-compiled, ready to run RootKit. A RootKit replaces several system commands with trojaned versions so the cracker can hide things on the system like files, processes, connections, etc.

The cracker will connect to the server system:

The cracker becomes r00t and unpacks their tools:

Next, the cracker installs the pre-compiled RootKit:

The fix commands running above are attempting to change the checksums, from the sum command, to match the original versions of the commands that are being replaced by their trojaned versions.

The cracker will use pre-configured configuration files for the RootKit:

The cracker will save needed tools:

To prevent a spurious message from appearing at user login time, the cracker edits the /etc/login.defs file and comments out the CREATE_HOME entry.

Backdoor

As part of the RootKit, many standard items are replaced with trojaned versions. In particular login and rshd allow special access to the server system:

The root connection is from the console and the john connection is from our legitimate user doing their work. Also note that on the initial telnet connection the message configuration error - unknown item 'CREATE_HOME' (notify administrator) is displayed. This should be an indication to the system administrator of server that something is wrong!

Clean Up

The cracker removes the login records of the two special users r00t and jroberts that were created as well as the ftp connections:

The cracker removes the two special users that were created:

Collect Data

Another part of the RootKit is linsniffer, which has been preconfigured to capture just usernames and passwords:

Use the System

The cracker can now safely install any type of application they want to. With a RootKit, directories containing their applications can be hidden, the processes that are running can be hidden, the network connections they make can be hidden, and the disk space they consume can be hidden. It is common to run an IRC server to create a private chat area for other crackers.

The cracker could either automate the transfer of linsniffer logs or could periodically login, unseen, and collect them. At this point, the cracker can move around completely invisible to the real system administrator and do whatever they want (almost...).

Server

There is nothing to show on ther server system for this part. If the cracker did their job correctly, all records of the activity will have been erased. The system administrator who suspects their system has been compromised needs to start doing data forensics, which is a whole other presentation!



The statements and opinions included in these pages are those of Isaac W. Traxler, Brian D. Ropers-Huilman, Allen B. Gordon only. Any statements and opinions included in these pages are NOT those of Louisiana State University or the LSU Board of Supervisors.
© 1999-2001 Isaac W. Traxler, Brian D. Ropers-Huilman, Allen B. Gordon

This page last updated 2001/09/21 15:38:52.