Vpnclient Start Before Logon Feature Configuration
ccie-sec December 4th, 2008
Today I was tasked with configuring a digital encoder to connect back to our office securely over the Internet. The encoder is nothing more than a box running a Windows XP EmbeddedOS. Originally I wanted to utilize the AnyConnect Start Before Logon Feature Configuration, but I found that the embedded OS didn’t allow me to complete the java installation necessary for AnyConnect. Rather than try and figure out where to locate a Windows XP Embedded installation CD, I figured it best to try and reproduce the feature utilizing Cisco’s vpnclient software version 4.8 and Windows batch scripting.
The client software installed without any hiccups and the service started properly after the initial reboot. The key task at this point was to initiate the client software during the Windows start-up process. To start, I created a batch file called ‘vpntest.cmd’ and placed it in the C:\ directory; here are the contents of ‘vpntest.cmd’:
:start
c:
cd “C:\Program Files\Cisco Systems\VPN Client”
vpnclient connect VPNTEST user cisco pwd CISCO
The main problem with using the batch file method is any end user can simply read the clear-text password in the command window or open up the file (if they know where to look). I’m really not too concerned with the file location because I can copy it to the C:\Windows\System32 directory or any other protected system directory and normal end users won’t be able to access the contents without administrative privileges.
To get around this maximized window dilemma, I tried forcing the batch file to run minimized. In order to do this I had to create a 2nd batch file, ‘launch.cmd’, that would call upon the 1st batch file, ‘vpntest.cmd’:
start “VPNTEST” /MIN /SEPARATE C:\vpntest.cmd
I’ve utilized this step before without any problems, but the problem with the embedded version of XP was it didn’t allow me to define any policies to lock the minimized windows in the task bar. If you happen to be running Windows 2000/2003 server edition or your XP workstation is part of a domain, you will have the ability to lock down the local policy and keep the window minimized.
At this point, I’m basically back to square one where any user that logs onto the workstation can still maximize the running batch file window. After googling around, I found that I could use a VBScript to try and hide the window. I created ‘vpntest.vbs’ and placed it in the C:\ directory. Here are the contents of my .vbs file:
Set WshShell = CreateObject(”WScript.Shell”)
WshShell.Run chr(34) & “C:\vpntest.cmd” & Chr(34), 0
Set WshShell = Nothing
Once the VBScript file was created, I updated my ‘launch.cmd’ to call upon the VBScript, ‘vpntest.vbs’:
START /MIN /WAIT CScript C:\vpntest.vbs //NoLogo
Now time for a reboot to test our 3 files. Upon starting the encoding machine, I can see that ‘launch.cmd’ batch file runs during the Windows start-up session and appears to be loading a vpnclient session in the background. The beautiful thing about this script is it even hides the task from the Task Manager. If you run ‘ipconfig /all’, you should an IP address has been issued for your “Cisco Systems VPN Adapter”.
The obvious security problem is someone with Administrative rights who knows where to locate the file can still view the clear-text password. Luckily enough for me, the end users I’m working with that are using the encoder workstation are somewhat mindless. Just as a precaution, I’ll create a WebACL on the ASA to limit the network access of the vpnclient session.
