There are several reasons that I am drawn to IT security and incident response.
- The discovery of what occurred.
- Protecting a business and its employees from people doing them harm.
- The need for a breadth and depth of knowledge in many areas.
When I was but a young security professional I always wanted to actively go head to head with a malicious hacker. Last month, I finally got my chance.
Tom Liston (OMG, he has a Wikipedia page!?!) and myself, of InGuardians, came to our client’s site and integrated ourselves with the other security team members already on-site. Our addition rounded out the team with a good cross-section of skill sets and experiences. Perfect for what we were going to experience in the next few days.
By the time Tom and I arrived on-site the incident response team understood that the client’s website was being modified to serve malware to its visitors but they did know know how the modifications were being accomplished. They had already start getting resources in place to provide data that would get us answers our questions.
- Snapshots of the dynamic websites were being saved to a strategic location.
- Web logs were configured to log centrally instead of locally.
- Full network packet captures were configured and stored in another location the incident responders could easily access.
- A method for remotely conducting data analysis and data acquisition was implemented.
Although I won’t say that I always ask for these things during an incident response, I will say that these are usually some of the recommendations that are made at the end of an engagement. The reason these technologies are valuable is because they provide responders with the system and network-based artifacts that can be used to make quick decisions.
The response effort started normally. We used our time to become familiar with the environment, located compromised webpages, and tried to piece together the initial compromise vector, persistence mechanisms, and propagation techniques being utilized by the attacker. During this time we were able to devise methods for quickly locating anomalous activity within the information provided by the weblogs, packet captures, and file differences. Analysis of systems did not detect anything significant so the team believed that the compromise was limited to the modification of dynamic web pages.
We quickly came to realize that the attackers had been modifying files for quite a while. The specific code that provided them their initial access was eluding us and we made various recommendations to reduce the number of blatantly vulnerable web applications. Our analysis identified various obfuscated PHP web administration tools (such as the web shell WSO and Web-based file manager webadmin.php) that the attackers were using to modify files and stomp the file’s metadata. The combination of all of these things made timeline analysis very difficult and less fruitful than I am use to during active incidents.
This type of activity is fairly normal during incident response and we were starting to get to the point where our team was just going through the motions of detecting modifications and addressing them as quickly as possible. While this was happening the systems and website administrators worked on individual sites and servers to close vulnerabilities (no small task, indeed). These websites are the primary business of this client and each of the affected web applications and their servers had to be left online during the attack. In other words, it was cost effective for them to keep us chasing the bad guys and to keep the sites alive despite the attack.
And then, we had contact with the enemy.
Tom and I had just sat down for our last day on-site. All of our team had their systems up and running and we were going through our usual motions. I had just sat down with my coffee when the client’s security manager walked in and told us that one of their primary sites was being blocked due to malicious code. The only thing I can relate this moment to is somebody yelling “Contact Left!!” and the Marine squad turning in unison and entering the fray. Each one of our team turned to our computers and start gathering information with a flurry of keystrokes. One man starting rolling through the web logs for the last hour. Another man starting pulling down the last hour’s worth of packet captures. Tom located the malicious code in the infected webpage and I, using that information, tracked down the source of the inserted code to a PHP include file (obviously used since it would get tacked onto every page served by the web application). I quickly handed the PHP code off to Tom for de-obfuscation (damn, he is seriously fast at it, too) and I turned to investigating the last “known good” snapshot of the website to try and get a good timeline for the team members conducting log analysis. At the same time, two of us remotely acquired images of the web servers in an attempt to detect any malicious interactions with the operating system and provide more detail to our timeline information.
All of our quick action payed off. About fifteen minutes into this activity the team member analyzing the packet captures said “Holy sh*t!!! I just grabbed the latest packet capture and I think he is on the system right now.” He paused and then said, “Holy sh*t!! He’s got root.” It turns out that all of our work during the week had hampered the attacker enough that s/he wanted to know what as going on with the system. So, instead of merely managing the malicious activities via the web shell s/he dropped to interacting with the operating system. The packet captures pointed us to several system-based artifacts which we grabbed for analysis. This was a boon because until this point, as I mentioned, we had not detected this type of interaction (those web shells provide some nasty functionality – “It’s a feature!!”). Now we knew the types of tools s/he was using, how s/he got them onto the system, how s/he was hiding them, and the tool’s capabilities.
About thirty minutes in the fray the excitement wore off. We could see where the attacker logged off of the system (possibly moving onto their next compromised site). We spent the rest of the day working through the information we found and firming up our findings and recommendations. I actually flew out of there later that day; high on adrenaline and wishing I could stay. After all, I would much rather stay and face the enemy than to return to the rear and write a report about it.
So, the incident response-related lessons learned from this engagement:
- Centralized logging of application logs and full network captures are critical during an incident response;
- Being prepared with remote acquisition and data analysis techniques is also extremely important;
- Team organization, tool familiarization, and overall experience will produce positive results from stressful situations;
- Management support and confidence breeds success.
These are the tools and concepts that will help your incident response team fight-the-fight while the mission critical assets stay online and ensures that everybody (client and consultant) gets paid. When an incident response team asks for these resources or recommends they be put in place, they are not doing it because the technologies are cool. They are making the recommendations because they are effective and will reduce the time and effort associated with the incident. Pre-deploying these technologies or generating procedures for doing so will make them even more effective.
Go forth and do good things,
Don C. Weber








