The overhead of booting into a full-on virtual machine with VMWare Workstation or any other hypervisor, in addition to the slow graphical performance, can become inconvenient.
Luckily, there is a solution by Microsoft - Windows Subsystem for Linux (WSL). Built into modern versions of Windows, WSL provides access to a full linux kernel, acting as a lightweight virtual machine. This means you get access to a full Linux command line. The positive is that it is very fast - it will boot in seconds and you get native performance in the terminal. Additionally, the latest version of WSL now support most graphical applications! The setup below will install Ghidra into WSL!
For example, if you need gdb and pwntools to solve a challenge, or any other Linux command line tool, WSL will be much faster than a traditional VM. This is especially convenient for pwn challenges. There is fantastic integration with VS Code, as you can use the editor to edit files inside WSL.
There is one important caveat:
We have two options - an automatic one-command installation, or a manual installation.
In either case, you have to first run this command in PowerShell to install WSL on your computer. After it finishes, you will need to restart your computer.
wsl --install --no-distribution
We have a setup that installs a Linux distribution into WSL with all of our tools pre-installed!
All you have to do is open PowerShell and run the following two commands (the lines starting with # are comments and don't need to be run). They will navigate to your downloads folder and download and install an Ubuntu-based Linux distribution with all of our tools baked in! Once installed, it is immediately ready for use!
# Navigate to your downloads folder
cd $HOME/Downloads
# This is the PowerShell equivalent of "curl | bash"
# It downloads a script which does the installation and runs it
# This will take several minutes
iwr https://obarroncs.github.io/pwnbox/wsl.ps1 | iex
Reach out to us if this fails to work. If you want to see the source code for this, go to https://github.com/OBarronCS/pwnbox for more details!
If the one-line command fails to work, please let us know.
You can find the source code for this automated installation here: https://github.com/OBarronCS/pwnbox?tab=readme-ov-file#create-wsl-image-from-the-container
There are two version of WSL, WSL1 and WSL2 - we will use WSL2 (the default nowadays), as it can support graphical applications, and includes a full Linux kernel.
The first time you setup WSL you may need to restart your computer.
The following steps assumes that you have either Windows 10 or Windows 11. Note that some things, such as Windows Terminal, are already installed by default on Windows 11, so you can skip those steps.
First, ensure you have Windows Terminal installed - this should be installed via the Microsoft Store.
Enter an elevated shell (open Windows Terminal with admin privileges), and type:
wsl --update
This will ensure that you have the correct components installed.
We will be installing the "rolling" release of Ubuntu - this step is important, and getting the rolling releases ensure you can run all the programs you come across in CTF.
Go to the Microsoft Store, and search for Ubuntu (Preview). Click install. You will eventually be prompted to set up a username & password - make sure you can remember the password and it is easy to type, as you'll need it quite often (when using the sudo command).
Install curl by typing the following command:
sudo apt install curl
Then, run the installation script with the following command:
curl -L osusec.gitlab.io/ctfleague/setup | bash
Now, start hacking! Everything is ready go to!
The installation should automatically add Ubuntu as a profile into Windows Terminal. So to find Ubuntu again after closing it out, open Windows Terminal, and next to the "plus" sign to create a new tab in windows terminal, click the down arrow and find Ubuntu.
code ., code sol.py, or code name_of_file_or_directory to open VS Code (provided it's installed on your computer)!/opt/ghidra/ghidraRun. You can run ln -s /opt/ghidra/ghidraRun ~/ghidra to create a symlink so you can simply run ./ghidra in your home directory to run it!WSL, by design, is not a sandboxed VM. DO NOT USE WSL AS A SANDBOX TO RUN UNTRUSTED SOFTWARE, such as viruses - processes in WSL have full access to the Windows file system and by extention have full access to the machine. By default, the Windows file system is mounted at /mnt/c - deleting these files will delete them on the Windows side.