February 18th, 2005, 03:08 PM
Using Bartís PE Builder to Make an Anti-Spyware and Rescue CD
A better formatted version with graphics can be found at http://www.irongeek.com/i.php?page=s...uildertutorial
Using Bartís PE Builder to Make an Anti-Spyware and Rescue CD
Sometimes a Windows install can get corrupted or compromised in such a way that itís hard to correct without removing the hard drive and using another computer and Operating System to fix it. Bartís PE Builder is a free tool that allows you to create a bootable Windows CD or DVD from an existing install CD of Windows XP or Windows Server 2003. This Windows boot CD runs a cut down version of XP, with network, gui and FAT/NTFS/CDFS file system support. Since you can run Windows applications from this boot CD itís a useful tool for fixing various problems on Windows 2000/2003/XP/9x system that can not easily be fixed while booted from the copy of Windows on the hard drive. The company Winternals makes a similar tool called ERD Commander, but it costs $149 to $299 and lacks the third party plugin support that Bartís PE Builder has. By using the PE Builder Plugins that others have created you can easily add software to your bootable CD to do all sorts of tasks:
ē Run Anti-Spyware tools like Ad-Aware Pro SE or HiJackThis.
ē Use MSConfig to configure what apps start on login.
ē Read and write to NTFS and FAT partitions.
ē Edit the registry on the local hard drive.
ē Copy files off of a hosed machine to another computer over the network.
ē Access USB drives.
ē Use MMC and Disk Manager to partition drives.
ē Change local passwords.
ē Defrag the hard drive with out booting from it (running defrag this way does a better job since there are no locked system files on the hard drive).
ē Load the CD with SSH, Remote Desktop Client and VNC so you can use the boot CD as a workstation.
ē Recover deleted files from slack space.
ē Perform a byte for byte wipe of the hard drive so others canít recover deleted files.
ē Read event logs off the hard drive.
ē Undo Syskey and get password hashes for later cracking if you lost a password.
ē Use Internet Explorer and Firefox from the boot CD to surf the web.
ē Run security tools for checking your network.
ē Make a locked down web terminal for patrons. Since the CD is read only media deviant users can do little to corrupt the workstation that canít be fixed by a quick reboot.
One great use for a PE Builder CD is to remove spyware from a computer and that is the task that this article will focus on. A lot of spyware is hard to remove when you are running the removal tools while booted in the Windows OS from the local hard drive. Some spyware will try to reinstall itself as soon at its files or registry keys are deleted. You can get around some of these problems by running the anti-spyware tools in safe mode, but even then some spyware can find a way to keep itself alive. By booting a copy of Windows from a boot CD and running tools like Ad-Aware and HiJackThis you can eliminate this problem almost entirely.
Things you will need
Before you can start creating your own boot CD there are a few things you will need to collect. First, get a copy of Barts PE builder from:
The current version as of this writing is 3.1.3. For convenience download the EXE self extracting package and let it install to the default location (C:\pebuilder313).
Next you need to copy the setup files from a Windows XP SP2 install CD to your hard drive. If you do not have an XP Pro CD integrated with Service Pack 2 just copy the files from the one you have and integrate SP2 yourself using the Source->Slipsteam menu option in PE Builder. I chose to copy the files to a folder called C:\WinXPProSP2-CD\ and will be using that path in this tutorial. Bartís PE Builder comes with a lot of useful plugins but there are a few more you will want to download and setup before you begin creating your own boot CD.
After you have setup PE Builder and copied the Windows XP SP2 files to the hard drive the next thing you need to do is download Sherpyaís XPE and Nu2XPE ShortCuts Converter v0.3 plugins from:
When you download them choose the CAB packages because the ZIP files are just the source code. The current version of XPE as of this writing is v1.0.2. While we are downloading third party plugins we also want to get the following packages - the Ad-Aware SE Pro plugin and the Runscanner plugin (necessary to let other plugins read the registry off of the local hard drive) from:
The PE Builder package comes with an Ad-Aware Plugin, but itís not as good as Paragliderís. Now download the HiJackThis and MSConfig plugins from:
Preparing to build the CD
Once you have everything downloaded you need to extract all of the files into C:\pebuilder313\plugin\. Many of the plugins come as CAB archives so if you donít have software to extract them just use the Add option when you select your plugins in PE Builder. Each of the plugins should come with an HTML file detailing how to install the plugin and what files you will need to copy from your system to the plugin directory, where to download them from, and where to put them. For example, Paragliderís Ad-Aware SE Pro needs you to install Ad-Aware on your system and copy the files from ďc:\Program Files\Lavasoft\Ad-Aware SE Plus\Ē into the ďFilesĒ folder inside of the Ad-Aware pluginís directory. The HiJackThis plugin needs you to download the HiJackThis executable from http://www.spychecker.com/program/hijackthis.html and put it in the files folder in the HiJackThis pluginís directory.
Now that we have everything downloaded start up PE builder by running C:\pebuilder313\pebuilder.exe. Choose the path to the Windows XP Source Files (C:\WinXPProSP2-CD) which you copied to the hard drive earlier.
Click on the ďPluginsĒ button, add the plugins that came in CAB archives, and enable the plugins you wish to install (make sure all of the ones you downloaded above are enable). Disable the following Plugins so XPE will work properly:
ē nu2Shell v1.0
ē PE Loader 0.4
ē PENETCFG: Automatically start PE Network configurator
ē PENETCFG: PE Network configurator (theTruth)
ē Profiles folder
You will most likely see two Ad-Aware plugins. The one labeled as ďAd-Aware SE ProĒ is the one you want enabled, make sure the plugin labeled as just ďAd-Aware SEĒ is disabled. Once you are done enabling and disenabling plugins click the ďCloseĒ button.
There are a few items you will want to customize before you continue. Look in the c:\pebuilder313\plugin\xpe-1.0.2\ folder and rename ďz_xpe-custom.inf.sampleĒ to ďz_xpe-custom.infĒ. Open up z_xpe-custom.inf in Notepad or another text editor. By editing z_xpe-custom.inf we can change quite a few of XPEís options. The following are some useful suggestions:
First letís change the name displayed on start up. Find:
And change it to:
"txtsetup.sif","SetupData","loaderprompt","""Starting Windows XPE [The Horse Power]..."""
Next you should set the default web page that Internet Explorer loads. Find:
"txtsetup.sif","SetupData","loaderprompt","""My Rescue CD..."""
And change "about:blank" to whatever home page URL you wish IE to use.
; IE Start Page
0x1,"Software\Microsoft\Internet Explorer\Main","Start Page","about:blank"
You will want to add some shortcuts to the Programs menu and Desktop. Find the line that reads:
and right below it insert the following two lines to add shortcuts to Ad-Aware in the Programs menu and on the Desktop (make sure each entry is on only one line):
; XPEinit startup menu & desktop
Finally, at the bottom of the z_xpe-custom.inf file choose where you want the TaskBar to show up. In my case I comment out:
0x2,"Sherpya\XPEinit\Programs","Anti-Spyware\Run Adaware on C","%SystemDrive%\programs\adaware\Ad-AwareScan.cmd||%SystemDrive%\Programs\adaware\Ad-Aware.exe,0"
0x2,"Sherpya\XPEinit\Desktop","Run Adaware on C","%SystemDrive%\programs\adaware\Ad-AwareScan.cmd||%SystemDrive%\Programs\adaware\Ad-Aware.exe,0"
; TaskBar on Top - Autohide
and I uncomment:
; TaskBar on Top - Autohide
; TaskBar on Bottom - No Autohide
If all of this is too much for you just download my z_xpe-custom.inf from http://www.irongeek.com/i.php?page=security/pebuilder . Then you can just skip the customization steps above.
; TaskBar on Bottom - No Autohide
Making and burning the ISO
Once all of the customizations are done go back to the PE Builder program. If you want PE Builder to burn the CD for you check the ďBurn to CDĒ checkbox and select your burner. I prefer to use Nero to burn the ISO myself but you can choose any CD burning software you like. I recommend using a CD-RW for your first few attempts at making a boot CD. CD-Rs are compatible with more CD drives but CD-RWs can be used over and over again for testing CD images as you construct new PE Builder CDs with different plugins and options. Check the ďCreate ISO imageĒ check box then click the ďBuildĒ button to generate an ISO of your CD. Click ďYesĒ and ďI agreeĒ on the two windows that pop up and Bartís PE Builder should begin to build your CD.
Using the CD
After you burn the ISO, test the PE Builder CD by rebooting your computer, going into the BIOS, and setting the CD-ROM as the first boot device. On some computers thereís a function key you can hit at boot up that will let you choose the drive to boot from (itís F12 on most Dellís made in the last few years). Once you boot from the CD you should see the Windowsís Classic Start menu interface. Assuming the proper drivers are on the CD you should be able to get a network connection and surf the web or connect to a file server. You can also try defragging, copying files to and from or partitioning the local hard drives. When you use Ad-Aware make sure you set it to do a custom scan and point it to the C: drive.
Other useful plugins:
Below is a list of other useful security, Anti-spyware and recovery plugins for Bartís PE Builder I did not include above for the sake of space and simplicity. If you have any problems setting them up feel free to contact me, or better yet look at the web pages listed in the ďFurther ResearchĒ section at the end of this article.
Great for finding out what hosts are on your network.
Great for scrubbing the hard drive clean of all data.
Firefox-1.9 and Firefoxflash-1.1
Use these plugins to run the Firefox web browser from your boot CD.
Normal a PE Builder boot CD only looks for hardware on startup, but if you plug in something like a USB thumb drive after you boot, PE will fail to find it. The HWPnP plugin will allow you to plug in USB devices anytime you like.
InsidePro Tools v1.0.0
Great tool for bypassing Syskey and grabbing password hashes from the SAM file. I use the older SAMInside v22.214.171.124 version because the newer demo versions disable the export to PWDUMP file option thatís useful for importing into L0phtcrack.
The Keyfinder-PE plugin will extract the XP registration key from the hard drive.
Registry Editor PE v0.9c
Sometime you may need to do finer work to the registry then Ad-Aware or HiJackThis will allow. Registry Editor PE lets you load the registry hives off of the local hard drive and edit any key you like.
Sam Spade is a collection of useful network tools for finding out information about hosts on the Internet. Sam is quite popular with spam-fighters.
Windows Password Renew 1.0-RC2 for WinPE
Password Renew lets the user change the password of the local Administrator account or create a new admin level user with a password of their choice. This is a great tool for getting into Windows boxes you donít have an admin password for.
I hope you have found this article useful. If you have any questions or comments please feel free to e-mail them to me at Irongeek@irongeek.com.
911 Rescue CD Forums, the best place to ask questions about PE Builder and its plugins:
Adrianís PE Builder Website:
Bartís PE Builder Homepage:
Bartís notes on adding additional network and SCSI drivers:
Sherpyaís XPE and collection of plugins:
A huge collection of PE Builder plugins:
Another great step by step tutorial on using PE Builder and XPE:
October 19th, 2006, 09:45 PM
Sorry to bring up this old thread, but I thought this might be helpful to some. Here is an updated video version of this tutorial: