The Problem

Sometimes an assessment environment gives you an interactive Windows session but blocks normal file transfer. Browser download is unavailable, upload is unavailable, shared folders are disabled, and the only reliable bridge is copy and paste through the RDP or VM console clipboard.

Copying a full binary as one base64 blob is fragile. Large clipboard payloads can be truncated, terminal paste can lose characters, and it is hard to know whether the received file is intact. The method below treats the clipboard as a narrow text transport: split the file into fixed-size base64 chunks, copy each chunk as text, rebuild the stream on the main machine, then verify the hash.

This is an authorized lab workflow. The example uses a neutral file name, tool.exe, because the technique is about reliable transfer and verification rather than the specific binary being moved.

Chunk The File On Windows

The sender side uses only built-in PowerShell and .NET APIs. The chunk size is set to 524288 characters, which is 512 KB of base64 text per file. That keeps the number of files low while staying more clipboard-friendly than a multi-megabyte paste.

The manifest records the original file name, raw size, base64 size, chunk size, chunk count, and SHA256. That manifest is the control record used later to verify the reconstructed file.

$File = "C:\tool.exe"
$ClipboardSafeChars = 524288
$OutDir = Join-Path $env:TEMP "chunks"

Remove-Item -Recurse -Force $OutDir -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $OutDir -Force | Out-Null

$bytes = [IO.File]::ReadAllBytes($File)
$b64 = [Convert]::ToBase64String($bytes)
$total = [int][Math]::Ceiling($b64.Length / $ClipboardSafeChars)
$sha256 = (Get-FileHash $File -Algorithm SHA256).Hash

@"
FILE=$([IO.Path]::GetFileName($File))
RAW_SIZE=$($bytes.Length)
BASE64_SIZE=$($b64.Length)
CHUNK_CHARS=$ClipboardSafeChars
CHUNKS=$total
SHA256=$sha256
"@ | Out-File -Encoding ascii -FilePath (Join-Path $OutDir "manifest.txt")

for ($i = 0; $i -lt $total; $i++) {
  $start = $i * $ClipboardSafeChars
  $len = [Math]::Min($ClipboardSafeChars, $b64.Length - $start)
  $chunk = $b64.Substring($start, $len)

  $num = ($i + 1).ToString("000")
  $tot = $total.ToString("000")
  $name = "$num`_of_$tot.txt"

  $chunk | Out-File -Encoding ascii -FilePath (Join-Path $OutDir $name)
}

Write-Host "Created $total chunks in $OutDir"
Write-Host "Chunk chars: $ClipboardSafeChars"
Write-Host "SHA256: $sha256"
PowerShell splitting a file into clipboard-safe base64 chunks and printing the final SHA256
PowerShell sender side: read the file, base64 it, split it into 512 KB text chunks, and print the verification hash.

Observed Output

In this run, the file was about 1.25 MB raw and became about 1.66 MB after base64 encoding. With 512 KB text chunks, PowerShell created four chunk files. The first three chunks are full-sized and the fourth contains the remainder.

The important value is the SHA256. If the reconstructed file does not match it exactly, one of the copied chunks was incomplete or modified during transfer.

PS C:\Users\Administrator\AppData\Local\Temp\chunks> Write-Host "Created $total chunks in $OutDir"
Created 4 chunks in C:\Users\ADMINI~1\AppData\Local\Temp\chunks
PS C:\Users\Administrator\AppData\Local\Temp\chunks> Write-Host "Chunk chars: $ClipboardSafeChars"
Chunk chars: 524288
PS C:\Users\Administrator\AppData\Local\Temp\chunks> Write-Host "SHA256: $sha256"
SHA256: 92804FAAAB2175DC501D73E814663058C78C0A042675A8937266357BCFB96C50

PS C:\Users\Administrator\AppData\Local\Temp\chunks> dir

    Directory: C:\Users\Administrator\AppData\Local\Temp\chunks

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/26/2026   8:13 PM         524290 001_of_004.txt
-a----         7/26/2026   8:13 PM         524290 002_of_004.txt
-a----         7/26/2026   8:13 PM         524290 003_of_004.txt
-a----         7/26/2026   8:13 PM          93882 004_of_004.txt
-a----         7/26/2026   8:13 PM            156 manifest.txt
Windows PowerShell directory listing showing four chunk text files and manifest.txt
The chunk directory contains four ordered text chunks plus a manifest with the expected SHA256.

Copy The Chunks Out

Each text file can be opened and copied through the clipboard. If the original names are preserved, alphabetical sorting keeps the chunks in the correct order: 001_of_004.txt, 002_of_004.txt, 003_of_004.txt, and 004_of_004.txt.

If the files are manually renamed during transfer, keep the order explicit. In my test I pasted them on the Linux side as 1.txt, 2.txt, 3.txt, and 4.txt, then concatenated them in that order.

Rebuild On Linux

On the main Linux machine, concatenate the chunks, remove CRLF and whitespace added by the text files, base64-decode the result, and hash the recovered file. The hash must match the manifest from Windows.

cat 1.txt 2.txt 3.txt 4.txt | tr -d '\r\n ' > out.b64
base64 -d out.b64 > recovered.exe
sha256sum recovered.exe

92804faaab2175dc501d73e814663058c78c0a042675a8937266357bcfb96c50  recovered.exe
Linux terminal reconstructing the file from four copied text chunks and verifying the SHA256 hash
Linux receiver side: concatenate the copied chunks, strip whitespace, base64-decode, and verify the hash.

Why It Works

The clipboard is unreliable when treated like a file transport, but it is reliable enough for bounded text chunks. Base64 makes binary data clipboard-safe. Numbered chunks preserve ordering. The manifest gives the operator a clear expected result. SHA256 verification turns the process from hope into evidence.

The chunk size is adjustable. If RDP clipboard sync is unstable, drop the value to 262144 or 32768 characters. If the clipboard is stable and fewer files matter more, 524288 characters is a good practical size. The correct value depends on the transport, terminal, and how the text is being copied.