Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


October 2004

You've Been Hacked. Now What?

Detect, disable and recover from a network attack
RSS
Subscribe to Windows IT Pro | See More Registry Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
SideBar    Lessons from the Cyber Trenches

It's finally Friday. You're looking forward to a long 3-day weekend at that exclusive resort you've been wanting to try. Just before you leave the office, a user complains that the network is running slowly, particularly when he tries to access the Internet. You check it out and discover that the server and network are indeed incredibly slow. You check your firewall's traffic statistics and notice unusually heavy Internet traffic. You run the Netstat command on the server and find several unauthorized connections to your server that look like they're coming from the Internet. You check the server's registry and notice several unfamiliar programs set to automatically load. Cancel your plans; you have a long weekend of work ahead. You've just been hacked.

Depending on the nature of the attack, it's not always easy to determine that you've been hacked. Knowing where to look and what to look for can help you discover hacks and take remedial action before they cause additional damage. I'll show you where to begin looking for malicious programs that can wreak havoc on your systems, and I'll help you develop a hacking recovery plan. I'll wrap up with three case studies that show how I used these tactics to help organizations detect and recover from a network hack and prevent future attacks.

Where to Look
Obviously, you need to find a hack before you can take measures to stop the attack and recover from it. Where do you begin? Every hack is unique, but you should always check certain places first. Here are the key locations in which to start your search.

Registry subkeys. If you suspect that a particular machine has been hacked, check the Run subkeys in that machine's registry first. Look for any unfamiliar programs that load from these subkeys. Not only do attackers favor the Run subkeys as a launching point for rogue programs, but intruders can launch viruses from those subkeys as well. The subkeys apply to Windows Server 2003, Windows XP, Windows 2000, Windows NT, Windows Me, and Windows 9x. The specific subkeys to check are:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce

If you're running Windows 2003, XP, Win2K, or NT systems, you also need to check the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Windows\CurrentVersion\Policies\Explorer\Run subkey.

Any program that you don't recognize is a potential hacking program. Use Google or a similar search engine to search the Internet for the program name and determine whether the program is legitimate. You should be especially suspicious of programs that load from C:, C:\windows, and C:\windows\system32. I strongly suggest that you make a habit of regularly reviewing these registry keys so you become familiar with all the programs that are set to automatically load on your computers.

The following subkeys are less commonly used to launch hacking programs, but you need to check them also. These subkeys apply to all Windows OSs. If the default registry key contains a value other than "%1" %*, the program is most likely a hacker program.

  • HKEY_CLASSES_ROOT\batfile\shell\open\command
  • HKEY_CLASSES_ROOT\comfile\shell\open\command
  • HKEY_CLASSES_ROOT\exefile\shell\open\command
  • HKEY_CLASSES_ROOT\htafile\shell\open\command
  • HKEY_CLASSES_ROOT\piffile\shell\open\command
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open\command
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\comfile\shell\open\command
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\shell\open\command
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\htafila\shell\open\command
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\piffile\shell\open\command

Services. Review the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services registry subkey on all Windows OSs. The entries under this subkey specify the services that are defined on your computer. I suggest that you look directly in the registry instead of using Windows' Services GUI because some services (e.g., Type 1 services) don't show up in the Services GUI. Again, check for programs you don't recognize. If possible, compare the Services subkey entries and values to a machine that you know is hack-free and investigate any differences you find.

Startup Folder. Check the C:\Documents and Settings\All Users\Start Menu\Programs\Startup and C:\Documents and Settings\user_name>\Start Menu\Programs\Startup folders for unfamiliar programs and hidden files. To display a list of hidden files in the current folder and any subfolders, at a command prompt, enter

dir /a h /s

Task Scheduler. Check the C:\windows\tasks folder for unauthorized tasks. Investigate any scheduled task that you don't recognize.

Win.ini. Malicious users can load hacking programs automatically from C:\windows\win.ini. Look in the following section of the win.ini file:

[windows]
Run=
Load=

Any program listed after Run= or Load= will load automatically when Windows starts.

System.ini. Intruders can use shell commands to load programs in C:\windows\system.ini. Search system.ini for:

[boot]
shell=explorer.exe 

Any program listed after explorer.exe will load automatically when Windows starts.

Other locations exist from which a hacker can automatically load programs to launch when Windows starts. Sysinternals' Autoruns freeware utility shows you which programs are configured to load during startup on NT and later systems. You can download the tool from http://www.sysinternals.com/ntw2k/freeware/autoruns.shtml.

Open Ports and Unauthorized Users
After you've run your initial key-locations check for hacking activity, look for unexpected or suspicious open ports.

Root kits

are stealth programs that run at the OS level and open ports on a compromised machine that an intruder can use for remote access. Root kits are common in the UNIX world, but more and more malicious hackers are writing them to exploit Windows. To determine connections and listening ports on a Windows-based computer, open a command line and run the command

Netstat -a

Table 1 lists ports that you'll typically find open on an XP computer. Don't be alarmed if you see more open ports on your particular workstation or server. Ports can be dynamically assigned depending on the type of service. For example, remote procedure calls (RPCs) use dynamic ports when you remotely administer DHCP and WINs. For more information, refer to the Microsoft article "How To Configure RPC Dynamic Port Allocation to Work with Firewall" at http://support.microsoft.com/?kbid=15459. When you run Netstat, look for the following items:

  • A large number (10 or more, depending on your environment) of established connections, especially to IP addresses outside your company.
  • Unexpected open ports, especially high-order ports (i.e., port numbers larger than 1024). Hacking programs and root kits often use high-order ports to establish remote connections.
  • Many pending connection attempts, which is a sign of a possible SYN flood attack.
  • Unrecognized batch files. Some root kits create batch files in the following folders: C:\, C:\winnt\, C:\windows\, C:\winnt\system32, and C:\windows\system32. Root kits or other unauthorized programs can also create files and folders under the Recycle Bin, so look for hidden or unauthorized folders within the Recycle Bin folder. By default, the Recycle Bin files are located in the C:\recycler folder. Be suspicious of files and folders that still exist after you empty the Recycle Bin.
   Previous  [1]  2  3  4  Next 


Reader Comments
I will definately use some of the information from the article.

horseman69 October 12, 2004 (Article Rating: )


h

Anonymous User October 22, 2004 (Article Rating: )


good article

seco November 01, 2004 (Article Rating: )


Table 1 is missing in the online version. Is there anyway to get Table 1 included? It lists the typical XP ports as described in the article.

RWB-IT November 05, 2004 (Article Rating: )


Table 1 is still missing!!!!Why?????????

JunLiu November 15, 2004 (Article Rating: )


Do you people want some cheese with your whine? If the site's broken, send them an email about it. It doesn't help much to cry about it on some reader comments section.

Anonymous User November 16, 2004


A wonderful article with extremely useful information. Hope we can have more of this kind.

stphxu December 22, 2004 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Interact! October-­December 2004: Blog

Learning Path To get up to speed on various security topics:
"Security Administrator newsletter"


To learn more about spam attacks:
"“A New Kind of Attack”"


To listen to a Webcast about how to protect your organization from security threats:
"Microsoft Security Strategies Roadshow"



"Intrusion Detection FAQ"


Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of September 8, 2008

An often irreverent look at some of the week's other news, including the long-awaited back to school season, Microsoft's first Seinfeld/Gates ad, some EU insights, another Netbook improvement, Opera silliness, and much, much more ...

VMware and the Future of Virtualization

What's next for virtualization and business IT? Windows IT Pro senior editor Jeff James speaks with VMware President and CEO Diane Greene on the future of virtualization technology. ...

IE 8.0 and Chrome Could Enable Next-Gen Web Apps—Unless Your ISP's Bandwidth Cap Gets in the Way

Both browsers are being positioned as the core system application that will enable the next generation of web apps--however, ISP usage caps could throw a major monkey wrench at web-based application delivery. ...


Security Whitepapers Protecting (You and) Your Data with Exchange Server 2007

Extended Validation SSL Certificates

Unauthorized applications: Taking back control

Related Events Check out our list of Free Email Newsletters!

Security eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

Related Security Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

IT Connections
Dive into the new Microsoft platforms and products you implement and support with the experts from Microsoft, TechNet Magazine, Windows ITPro and industry gurus. There are 70+ sessions and interactive panels with networking opportunities.

Attention User Group Leaders...
Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes and add Windows IT Pro & SQL Server Mag articles alongside your own message!.

Master SharePoint with 3 eLearning Seminars
Learn how to build a better SharePoint infrastructure and enable powerful collaboration with MVPs Dan Holme and Michael Noel. Register today!

Get SQL Server 2008 at WinConnections
Don’t miss Microsoft Exchange and Windows Connections conferences, the premier events for Microsoft IT Professionals in Las Vegas, November 10-13. Every attendee will receive a copy of SQL Server 2008 Standard Edition with one CAL.



Interested in Email Encryption?
Read about the advantages of identity-based encryption in this free report.

Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Virtualization Congress Oct. 14-16 in London
Don't miss Virtualization Congress, the premiere EMEA conference dedicated to hardware, OS and application virtualization. Oct. 14-16.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technical Resources Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing