An overview of historical hacking approaches Johnny Long http://johnny.ihackstuff.com
[email protected]
“Old School”: Slow, careful, precise, invasive “Pros”: Fast, careful, precise, sometimes invasive “Skript Kiddies”: Slow, reckless, imprecise, invasive “Defacers”: Fast, reckless, precise, mildly invasive
For years, information security pundits have followed f ollowed and believed in a “hacking methodology” which which described the steps a hacker classically followed when performing an attack. That methodology followed the following basic steps:
Information Gathering Probe Attack Advancement Entrenchment Infiltration/Extraction
Decide and discover which targets to attack Often begin with a specific network or a specific company Whois, nslookup queries samspade.org Search engines (“googlescanning”)
Scan specific targets for vulnerabilities
Search sweeping ranges of ports with a portscan (nmap) Grab details such as service versions from the discovered ports aka “banner grabbing” (netcat) NT: Connect to and enumerate information from NETBios (enum) Search the Internet for vulnerabili vulnerabilities ties based on versions of software found on targets
NMAP ( http://www.insecure.org/nmap) Superscan (http://www.webattack.com/get/ superscan.shtml) Nessus: (http://www.nessus.org) Whisker: (http://sourceforge.net/projects/whisker/) Netcat: (http://www.atstake.com/research/tools/) Enum (http://razor.bindview.com/tools/index.shtml) THC-Probe ( http://www.thehackerschoice.com/download.php?t=r )
Nmap is used to scan the ports of the target system. Using the –O option would also report the Operating System of the target.
Nmap’s guess at the operating system type
some services listen behind RPC. rpcinfo can give us this info.
Gather compatible exploits Compile exploits (if required) Launch exploits against targets Modify parameters, re-launch exploits (if required)
There are many different types of attacks which can be broken down into several classifications. The attacks are performed from one of two perspectives: Local: The attacker has access to a command c ommand prompt or has gained the ability to execute commands on the target Remote: The attacker exploits the target box without first gaining access to a command c ommand shell
Aka the “Boundary Condition Error”: Stuff more data into a buffer than it can handle. The rresulting esulting overflowed data “falls” into a precise location and is executed by the system
Local overflows are executed while logged into the target system Remote overflows are executed by processes running on the target that the attacker “connects” to
Result: Commands are executed at the privilege level of the overflowed program Example: SNMPXDMID overflow (Solaris 6-8) http://www.securityfocus.com/bid/2417
An process does not “strip” input before b efore processing it, ie special shell characters such as semicolon and pipe symbols An attacker provides data in unexpected fields, ie SQL database parameters
Example: Trillian IRC Module Format String Vulnerability ( http://online.securityfocus.com/bid/5388) “A format string vulnerability has been reported in the Trillian IRC module. An attacker can exploit this vulnerability by enticing a user to join a channel with a malicious channel name (e.g. #%n%n%n). An attacker in control of a malicious server may exploit vulnerable clients who have connected.”
An attacker forces an action during a sensitive time window between two operations A program checks to make sure output file “/tmp/temp_output” does not exist The program wanders off and does other stuff… An attacker quickly creates a symlink fr from om “/tmp/temp_output” to “/etc/shadow” The program writes to the “/tmp/temp_output” which clobbers “/etc/shadow” Example: RedHat Linux diskcheck ( http://online.securityfocus.com/bid/2050 )
An attacker makes a change to a program’s environment that was not expected For example, a program relies on the UNIX environment variable $USER to determine who is running the program An attacker changes this value to “root” before executing the program
Attacks: Weak Passwords
accounts with weak passwords are guessed by a remote attacker Accounts with weak passwords are cracked by attacker with access to a password database THC-HYDRA THC-HYDR A Login Lo gin Hacker (http://www.thehackerschoice.com/releases.php)
SecurityFocus: (http://www. securityfocus.com) Packetstorm: (http://packetstormsecurity.org) New Order: (http://neworder .box. .box.sk/) Hack in the Box: (http://www.hackinthebox.org/ ) phreak.org (http://www.phreak .org/archives/exploits/unix/)
The Attack is most often broken into i nto several phases (perhaps running cyclically) Locating Exploits Getting Exploits Modification of Exploits Building Exploits Testing Exploits Running Exploits
The ‘wget’ program downloads the exploit to the attacker’s machine
(-lsocket won’t work)
Most exploits will not work across all platforms, so modifications generally need to be made. In this case, -lsocket is removed for running on out RedHat 7.2 attack box.
Some exploits come complete with a Makefile, so a simple ‘make’ command is all that’s required to build the exploit.
The make command successfully produces the exploit, in this case ‘automountdexp’
The ‘–h’ parameter shows the usage for this exploit.
This attack executes commands on the target (a Solaris 2.5.1 box) as root. In this case, the attacker drops a line into /etc/inet/inetd.conf and a line into /etc/services. When the system is restarted (or inet is restarted) a listening root shell is opened on port 31337.
The attacker connects to the 31337 port on the target and is greeted with a root prompt.
If needed, gain further access to targets by further exploitation
Trojans Local Exploits
The advancement phase will somewhat mirror the Attack phases unless the attacker has already tested the exploits
Modify targets to ensure future access
Backdoors Rootkits
Linux Non-listening backdoor programs = No listening port!
SAdoor (http://cmn.listprojects.darklab.org/) Cd00r (http://www.phenoelit.de/stuff/cd00rdescr.html)
NT/2K
Fake GINA Username and password interceptor ( http://www.rootkit.com/projects/ginatroj/ )
NTKap Removes NT ACL protection ( http://www.rootkit.com/projects/ntkap/ )
Linux
LRK5: (http://online.securityfocus.com/data/tools/lrk5.src.tar.gz) ADORE: (http://online.securityfocus.com/tools/1490 ) KNARK (http://online.securityfocus.com/tools/1163 )
NT
NT Rootkit (http://www. http://www.rootkit.com/projects/ ntroot/) NULL.SYS ( http://www.rootkit.com/projects/nullsys/ )
Install sniffers to monitor network traffic, gather usernames/passwords Extract data from compromised systems Compromise neighboring targets based on captured data or trust relationships
Professional hackers, or ethical hackers, tend to follow the following methodologies:
Information Gathering Probe Attack Advancement Infiltration/Extraction
Most often, professional ethical hackers rely on “Vulnerability Scanners” to perform their jobs.
Nessus Retina by eeye Network Associates CyberCop H.E.A.T. Internet Security Systems Internet Scanner
(see http://www http://www.networkcomputing.com/120 .networkcomputing.com/1201/1201f1b1.html) 1/1201f1b1.html) http://www.networkcomputing. http://www.networkcomputing.com/1201/1201f1b1.html) com/1201/1201f1b1.html)
Vulnerability Scanner Demo
Skript Kiddies, named for their annoying ability to (sometimes) successfully compromise a system using pre-written scripts, generally follow a very simple non-cyclical methodology. (See http://project.honeynet.org/papers/enemy/ for an interesting writeup on the topic) Exploit Selection Target Selection Attack
Nearly identical to the “Old School” method of locating exploits, skript kiddies generally use Search engines to locate exploits Skript Kiddies are generally not a technically savvy lot, so exploit selection is made m ade based on attack platforms available (generally Windows-based)) and ease of use. Windows-based
Most target selection involves noisy scanners, often launched from Windows platforms An increasing number of Skript Kiddies, however, are gaining familiarity with Linux and use fairly standard tools such as nmap.
Unlike old-school attacks, Skript Kiddies tools are generally pre-compiled, or written in interpretive languages such as PERL If an exploit needs to be built, most kiddies will not be able to get them working If a built exploit fails, a skript kiddie usually moves along to another target instead of fixing the exploit. This makes the process noncyclical.
While “old school” methods are still in use, web defacers statistically own the hacking landscape http://www.alldas.org
Handle: intrud3rm4n Age: 21 Group: Leader of ISOTK (In Search of the Knowledge!) Defacement count (8/09/02): 960 sites, 785 addresses, 175 mass defacements My favorite defacement: http://defaced.alldas.org/mirror/2002/07/21/java.capgemini.nl/
Country of Origin: Brazil Language: Portuguese Favorite Hacking food: Hamburgers and Fries Favorite Hacking Music: Metallica =) Favorite exploit: whacking LINUX boxen Reason for defacing: FUN
http://www.alldas.org
http://www.zone-h.com/en/defacements
http://www.delta5.com.br/mirror/
Web Defacers, for the most part, have a slightly different methodology. Instead of basing the exploit on the target, the target is selected based on it’s vulnerability to the exploit! The web defacement methodology m ethodology (again, often cyclical) is generally as follows: Exploit Selection Target Selection Attack Defacement
Amateur defacers usually stick with one exploit and one target platform,,,
An attacker’s level of comfort with an Operating System will often decide the types of exploits used
UNIX-based attackers often opt for C-based remote overflows o verflows overflows Windows-based attackers often opt for perl-based remote overflows, visual basic tools, or command-line “net” commands Attackers with only browser-based experience or simplistic attackers seeking privacy through proxies will opt for URLURLbased attacks such as UNICODE or DECODE, Front Page exploits, or PHP-Nuke attacks
Often an amateur defacer will monitor popular security sites (such as securityfocus) to select exploits
Armed with an exploit, most web defacers now seek for vulnerable targets using various methods
Web searching
Netcraft Netstat Google
Host scanning
Nmap Custom scanners
http://www.netcraft.com
Using search engines to locate vulnerable servers is a very interesting and fruitful technique which hasn’t been explored in great detail. http://johnny.ihackstuff.com/security/googledorks.shtml
Google query: intitle:”Index of” “Apache 1.3.11”
Here, Apache 1.3.11 servers are located through creative use of the Google search engine.
http://www.netstat.ru
Nmap’s OS detection feature (-O) provides a decent guess as to the operating system of the target
http://packetstormsecurity.com provides a great resource for custom vulnerability scanners.
Once the target and the exploit e xploit are selected, the attacker launches the attack against the server. If the attack fails, the attacker will often modify the attack and try again.