Having been in many situations where the Windows environment I was working in was secured from external file transfer, I've devised a few methods for transferring binary files without the need of physical drives or network connections. Such environments are found in kiosks, POS terminals, Citrix/RDP/VNC/etc. remote terminals and other "thin" clients.
I'm gonna show you some methods of exploiting functionality not often thought of as useful for attackers in hardened environments using plain text encoding.
Tip:If the target environment has a working unzip/decompress application like that built into Windows XP/Vista, compress the binary before encoding it.
Outlook Express/Windows Mail
E-mail applications use MIME to attach non-text files to messages. This feature can be used locally to encode files into a plain text format (usually base64). Here's how to transfer a binary file with the keyboard:
1. In the source environment, compose a new e-mail message.
2. Change the message format to Plain Text, this will reduce clutter in the file.
3. Attach the binary file you want to transfer.
4. In the File menu, choose "Save As...". Save the file as the Mail (*.eml) type.
5. Open the saved .eml file in Notepad to view the contents.
6. Open Notepad in the target environment and copy the contents of the saved .eml file.
7. Save the file with a .eml extension.
8. Open the .eml file with OE/WM.
9. Right-click the attachment and choose "Save As...".
Caveat:OE/WM restricts access to executable files from attachments by default. Adjust the security settings or rename your file if necessary.
Windows Scripting Host
The Windows Scripting Host gives access to components which are capable of taking plain text encoded data and saving it as a binary file.
For example, this pair of scripts will hex-encode a binary file to a plain text file and back:
Some remote terminal environments like RDP support copy and paste operations, but most won't -- namely Citrix MetaFrame (or whatever they call it these days). A great way to manipulate this keyboard/mouse only interactivity is to run a WSH script in the host environment. The following script reads a file and types it into the target environment:
Tip:Useful binary files small enough to be typed into an environment are hard to come by. Compile your own.
You may not be able to attach a USB Mass Storage Device, but it's highly likely your target will allow you to attach USB HID (Human Interface Device) or PS/2 keyboard. Both use a standard Windows driver and would not require elevated privileges to install.
It's simple to create hardware devices that emulate HID or PS/2 devices. Encoded files can be loaded onto a microcontroller and "typed" for you.
Schematics and source code for such a device may show up here eventually.
Notepad missing? Windows has some other options like wordpad/write.exe, edit.com, web browsers.
In some cases you may need to encode certain HTML entities to prevent the browser from parsing them. Also be cautious of how the browser saves the file. The browser might attempt to change CR/LF to whitespace or save the file as Unicode which can create parsing problems.
It seems a requisite for a secure environment is a read-only filesystem.