|
|
|
by John Verry
August 19, 2003
Ethical hacking is one of the most intriguing and exciting elements of our work at Pivot Point Security. In most engagements, our efforts involve attempting to penetrate a client's network, documenting the results of our efforts, and recommending optimal strategies for mitigating the risks we have identified. A recent engagement for a software development firm took an interesting twist at the onset of the project, as we quickly discovered the client's FTP server had already been hacked and was being used for illegal purposes. I'll describe the techniques we used to meet the client's requirements and explain how our efforts turned from hacking their network to hacking the hacker. We convened with the client for a brief kickoff meeting to reconfirm the objectives of the Limited Knowledge Penetration Test (PT) and to gather sufficient information to ensure that the testing did not affect normal business operations. We began our preliminary research by reviewing publicly available information relating to the target company, including news releases, newspaper articles, annual reports, SEC filings, and the corporate Web site. Hackers commonly use these resources to gather potentially vital information relating to a company, including names of key employees, product lines/releases, key dates (such as the date a partnership was formed and a network administrator's birthday), empire locations, hardware/software used, etc.
During these operations, we discovered that an internal user at the client's organization was the leading poster of messages and/or content to a Web site that distributed illegal pornographic images. This was immediately reported to Client Management, which became increasingly concerned as it disclosed that there were multiple instances of often unexplainable periods of full utilization of the outbound Internet links during odd hours. (We are still unsure why it didn't disclose this at the kickoff meeting.) After using nMap to footprint the external network, we focused our attention on an FTP server that was curiously installed outside the firewall. A port scan against the box returned extremely troubling results. In addition to the expected open port (port 21), we found a half dozen other open ports, including 139, 2187, 3437, and 14120.
Some key details of our FTPing the site include:
The client's first concern was the potential correlation between the posting of messages / content to a site that housed illegal images and the distribution of large files from its FTP Server. Was an employee using their FTP server to distribute pornography? We advised the client that if it intended to prosecute, it would need to work within the legal framework of forensic investigations. Most notably, it would be critical for the forensic data to be authenticated as genuine. Many of the actions an individual might take, including rebooting the machine, copying files from the server, and reviewing security logs, can alter the drive data. The client's management was adamant about conducting the investigation in a manner that would provide the opportunity to prosecute if necessary. The client's lawyer also believed that by demonstrating due diligence, it would minimize the risk of a third party taking legal action against the organization as a result of the hack. A particularly important legal case, "Gates Rubber Co. vs. Bando Chemical Indus, Ltd," helped define the mandatory legal duty of a forensic investigator with regard to creating a mirror image copy of the hard drive in a manner that maintains chain of evidence and custody. In that case, the investigator's decision to perform logical "file-by-file" copying to preserve the evidence precluded legal use of the data because the copying might have resulted in lost information and the creation of new temporary files on the media. We used Encase software, which is used extensively by law enforcement professionals, to gather a mirrored image of the drive. We then mounted it in a Windows 2000 machine but were unable to navigate/view the directory structure of the illicit FTP Server. There are a number of ways that hackers (and Windows itself) can hide directories and files. A simple way to make folders invisible (dependent upon Explorer settings) is to set a folder's property to +s[ystem] within Windows Explorer or via DOS. For example, although users may clear their Internet History, the data is still maintained in hidden files that can be accessed by an investigator. Other methods include using device driver names such as " To access the hidden directories and determine the content being distributed, we added the drive to a Windows 2000 Server and mounted it read-only from a Red Hat 9 Linux machine. Assessing the facts before looking at the drive, we knew the following:
We first viewed the FTP root of the Serv-U daemon. Three files immediately caught our attention:
The first two files were used by the hacker to measure the available bandwidth of the server and gauge the efficacy of using this machine to conduct other attacks. The Space.asp Active Server Page was used to enumerate drives and their free space on the server. These files illustrate the dangers of anonymous uploads. Next, we looked at the Serv-U daemon. Normally, Serv-U is run through the
information contained in an ini configuration file. We searched the drive for
.ini files and examined the output. This resulted in the discovery of
Further examination of the
More anomalies present in the directory were IIS log file directories for February 15 through 18. An examination of the abbreviated logfiles showed the upload of the speed test files and space.asp page on the 15th. We could also observe the creation of a directory and upload of a copy of Photoshop. Examining the Another directory found in
We also discovered that the attacker had removed most of the log files
generated by these tools. (They had been stored in
In light of the potential liability associated with the distribution of copyrighted materials and the attack on government agencies, the client authorized us to attempt to identify the source of the hack. Most notably, we recognized that the attacker was very comfortable using IRC. We examined the communications of the installed IRC bot and determined the IP Address it was connecting to. Using the information in At this point, we knew which host the attacker was connecting from. Provided the host legally belonged to the attacker, we could obtain his identity from his ISP. From the IRC site, we identified nine additional servers that had been compromised in the same manner, including two universities and a large regional bank. (We notified the ISP and the owners of the IPs of our findings.) We began with an attempt to verify whether this connection was being proxied. We discovered that the server at xxx.xxxxxx.xx wouldn't allow IRC connections from unsecured proxy servers. (Note: We've replaced all IP addresses with Xs.) We then probed the attacker's machine to view the available services. We used nMap to identify the services running on the hacker's system and found that the attacker was using a Windows XP Professional machine, located in Belgium (determinable by an IP address belonging to a Belgium ISP). He was running a private Serv-U FTP Daemon on TCP 1412, as well as a publicly available Serv-U FTP service (port 21). We could see that he employed a common tactic: By having a publicly available FTP site, loaded with his hacking tools, he could compromise a machine and download the tools and files he needed. Note the absence of any banner advising that the machine was private and that public connections were not allowed so we were not actually "hacking" the hacker. We then proceeded to download the contents of the FTP server. Examining the files, we could piece together his attack methodology and actions:
He then patched the machine to prevent other attackers from using the same exploits:
Based upon what we found, we were able to create specific Web queries to determine the attacker's real identity. Our final report to the client included this information about the hacker:
Although the client was relieved to learn it wasn't trafficking illegal pornography, it was concerned to be trafficking intellectual property. It was also concerned that its FTP server had been used to conduct scans and/or attacks on other networks. Our report included many recommendations, most notably:
Executing on the basics of IT security is not enough to ensure that your organization will not be hacked, but it will significantly reduce the chances. Further, if you are hacked, you'll be able to recognize and remediate it before significant damage to the organization is done. The basics for systems that need to be externally accessible (Web, e-mail, FTP) include these steps:
Although this seems like (and truly is) "Security 101," I can assure you that many organizations are not executing on the basics. Virtually all of the hacks we investigate are caused by a failure to execute on some combination of these fundamentals. | ||||||
|