Exploit databaseDownload repository ZIP
GH-945bd5267b0d1b94c3f74faf5cda7e5a
blkph0x/cve-2026-83844_poc
Sources for CVE-2026-83844
5 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files6
blkph0x/cve-2026-83844_pocRevision 193ed44859da
- ↑..Parent directory
- ROUTE_PROTOCOL.md
- guest_route.ps1
- guest_route_entry.ps1
- inventory.py
- prepare_route_trial.ps1
- route-contract.json
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
lab/routes/guest_route.ps1
PowerShell · 21,487 bytesparam(
[Parameter(Mandatory = $true)]
[ValidateSet('old', 'new')]
[string]$Build,
[Parameter(Mandatory = $true)]
[ValidateSet('association_edit', 'explorer_edit_in_paint', 'protocol_empty', 'com_activation')]
[string]$Route,
[string]$CaseId = '00_valid_png',
[switch]$TraceExisting,
[ValidateRange(2, 30)]
[int]$ObserveSeconds = 10
)
# Activation/UI probe with an optional pre-armed CDB trace for file routes.
# Shell/COM handlers are invoked only in a disposable guest.
$ErrorActionPreference = 'Stop'
$inputRoot = 'C:\PaintLab\Input'
$outputRoot = 'C:\PaintLab\Output'
$marker = 'C:\PaintLab\guest.marker'
if ($env:USERNAME -ne 'WDAGUtilityAccount' -or
-not (Test-Path -LiteralPath $marker -PathType Leaf) -or
(Get-Content -LiteralPath $marker -Raw).Trim() -ne 'PaintABLab-Sandbox-v1' -or
-not (Test-Path -LiteralPath $inputRoot -PathType Container) -or
-not (Test-Path -LiteralPath $outputRoot -PathType Container)) {
throw 'Guest guard failed: activation-route probe runs only in the Paint Sandbox.'
}
$versions = @{ old = '11.2605.81.0'; new = '11.2609.401.0' }
$builds = Get-Content -LiteralPath (Join-Path $inputRoot 'runner\builds.json') -Raw | ConvertFrom-Json
$contract = Get-Content -LiteralPath (Join-Path $inputRoot 'routes\route-contract.json') -Raw | ConvertFrom-Json
$expected = $contract.builds.PSObject.Properties[$versions[$Build]].Value
$expectedHash = $builds.PSObject.Properties[$versions[$Build]].Value.mspaint_exe_sha256.ToLowerInvariant()
$caseManifestPath = Join-Path $inputRoot 'corpus\manifest.json'
$manifest = Get-Content -LiteralPath $caseManifestPath -Raw | ConvertFrom-Json
$runId = (Get-Date).ToUniversalTime().ToString('yyyyMMddTHHmmssZ')
$outputDir = Join-Path $outputRoot "routes\$Build\$Route\$CaseId\$runId"
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
$resultPath = Join-Path $outputDir 'result.json'
$result = [ordered]@{
schema = 'paint-ab-route-ui-v1'
build = $Build
expected_version = $versions[$Build]
route = $Route
case_id = $(if ($Route -in @('protocol_empty', 'com_activation')) { $null } else { $CaseId })
started_utc = (Get-Date).ToUniversalTime().ToString('o')
status = 'preflight'
installed_package = $null
installed_exe_sha256 = $null
manifest_sha256 = $null
installed_module_checks = @()
loaded_module_checks = @()
loaded_module_error = $null
contract_sha256 = (Get-FileHash -LiteralPath (Join-Path $inputRoot 'routes\route-contract.json') -Algorithm SHA256).Hash.ToLowerInvariant()
fixture = $null
route_registration = $null
bootstrap_cleanup = $null
pid_before = @()
launch_returned_pid = $null
launch_error = $null
pid_after = @()
screenshot = $null
application_error_events = @()
dump_files = @()
final_cleanup = $null
parser_reach = 'not_measured'
trace_requested = [bool]$TraceExisting
trace_status = 'not_requested'
traced_pid = $null
debugger_pid = $null
debugger_armed = $false
debugger_log = $null
markers_before_action = @()
markers_after_action = @()
interpretation = 'unreviewed'
error = $null
}
$debuggerProcess = $null
function Trace-Markers([string]$Path) {
if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return @() }
@(
foreach ($line in (Get-Content -LiteralPath $Path -ErrorAction SilentlyContinue)) {
if ($line -match '^PAINT_TRACE_HIT=([a-z0-9_]+)\s*$') { $Matches[1] }
}
)
}
function Paint-Snapshot {
@(
Get-Process -Name mspaint -ErrorAction SilentlyContinue | ForEach-Object {
$path = $null
$hash = $null
$title = $null
try { $path = $_.Path } catch { }
try { if ($path) { $hash = (Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash.ToLowerInvariant() } } catch { }
try { $title = $_.MainWindowTitle } catch { }
[ordered]@{
pid = $_.Id
path = $path
exe_sha256 = $hash
matches_installed_paint = [bool]($path -and $path -ieq $script:installedExe -and $hash -eq $script:expectedHash)
title = $title
}
}
)
}
function Close-Paint {
$initial = @(Get-Process -Name mspaint -ErrorAction SilentlyContinue)
$requested = @()
foreach ($process in $initial) {
try {
if ($process.MainWindowHandle -ne [IntPtr]::Zero -and $process.CloseMainWindow()) {
$requested += $process.Id
}
} catch { }
}
$deadline = (Get-Date).AddSeconds(7)
do {
$remaining = @(Get-Process -Name mspaint -ErrorAction SilentlyContinue | Where-Object { $initial.Id -contains $_.Id })
if ($remaining.Count -eq 0) { break }
Start-Sleep -Milliseconds 350
} while ((Get-Date) -lt $deadline)
$forced = @($remaining | ForEach-Object { $_.Id })
foreach ($process in $remaining) {
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
}
Start-Sleep -Milliseconds 300
[ordered]@{
initial_pids = @($initial | ForEach-Object { $_.Id })
close_requested_pids = $requested
forced_pids = $forced
remaining_pids = @(Get-Process -Name mspaint -ErrorAction SilentlyContinue | ForEach-Object { $_.Id })
}
}
function Save-Screenshot([string]$Path) {
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$bitmap = [System.Drawing.Bitmap]::new($bounds.Width, $bounds.Height)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
try {
$graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
$bitmap.Save($Path, [System.Drawing.Imaging.ImageFormat]::Png)
} finally {
$graphics.Dispose()
$bitmap.Dispose()
}
}
try {
if ($contract.schema -ne 'paint-route-contract-v1' -or
-not $contract.registration_fields_equal -or
$manifest.schema -ne 'paint-ab-corpus-v1') {
throw 'Unexpected route contract or corpus manifest.'
}
$packages = @(Get-AppxPackage -Name Microsoft.Paint -ErrorAction Stop)
if ($packages.Count -ne 1 -or [string]$packages[0].Version -ne $versions[$Build]) {
throw 'Installed Paint package does not match the route profile.'
}
$package = $packages[0]
$installedExe = Join-Path $package.InstallLocation 'PaintApp\mspaint.exe'
$result.installed_package = [ordered]@{
version = [string]$package.Version
full_name = [string]$package.PackageFullName
install_location = [string]$package.InstallLocation
}
$result.installed_exe_sha256 = (Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant()
if ($result.installed_exe_sha256 -ne $expectedHash) { throw 'Installed Paint EXE hash mismatch.' }
$result.manifest_sha256 = (Get-FileHash -LiteralPath (Join-Path $package.InstallLocation 'AppxManifest.xml') -Algorithm SHA256).Hash.ToLowerInvariant()
if ($result.manifest_sha256 -ne $expected.manifest_sha256) { throw 'Installed route manifest hash mismatch.' }
$traceManifestPath = Join-Path $inputRoot "trace\$Build.auto.cdb.txt.json"
$traceManifest = Get-Content -LiteralPath $traceManifestPath -Raw | ConvertFrom-Json
if ($traceManifest.profile -ne $Build -or $traceManifest.version -ne $versions[$Build]) {
throw 'Trace module manifest differs from the installed route profile.'
}
foreach ($entry in $traceManifest.modules.PSObject.Properties) {
$modulePath = Join-Path $package.InstallLocation (Join-Path 'PaintApp' $entry.Name)
$moduleHash = (Get-FileHash -LiteralPath $modulePath -Algorithm SHA256).Hash.ToLowerInvariant()
if ($moduleHash -ne [string]$entry.Value.sha256) {
throw "Installed module hash mismatch: $($entry.Name)"
}
$result.installed_module_checks += [ordered]@{ module = $entry.Name; sha256 = $moduleHash }
}
$fixturePath = $null
if ($Route -in @('association_edit', 'explorer_edit_in_paint')) {
$cases = @($manifest.cases | Where-Object { $_.id -eq $CaseId })
if ($cases.Count -ne 1 -or $cases[0].file -notmatch '^[A-Za-z0-9_-]+\.(png|bmp|jpg)$') {
throw 'Case ID or fixture name is absent or unsafe.'
}
$fixturePath = Join-Path (Join-Path $inputRoot 'corpus') $cases[0].file
$hash = (Get-FileHash -LiteralPath $fixturePath -Algorithm SHA256).Hash.ToLowerInvariant()
if ($hash -ne [string]$cases[0].sha256) { throw 'Fixture hash mismatch.' }
$result.fixture = [ordered]@{ file = $cases[0].file; sha256 = $hash }
$extension = [IO.Path]::GetExtension($fixturePath).ToLowerInvariant()
if ($Route -eq 'association_edit') {
$association = @($expected.associations | Where-Object { $_.types -contains $extension -and @($_.verbs | Where-Object id -eq 'Edit').Count -gt 0 })
if ($association.Count -ne 1) { throw 'The signed manifest does not register Edit for this file type.' }
$result.route_registration = [ordered]@{ kind = 'file_type_verb'; name = $association[0].name; verb = 'Edit'; extension = $extension }
} else {
$verbs = @($expected.explorer_verbs | Where-Object { $_.type -eq $extension -and $_.id -eq 'EditInPaint' })
if ($verbs.Count -ne 1) { throw 'The signed manifest does not register EditInPaint for this file type.' }
$result.route_registration = [ordered]@{ kind = 'explorer_command'; verb = 'EditInPaint'; extension = $extension; clsid = $verbs[0].clsid }
}
} elseif ($Route -eq 'protocol_empty') {
if ($expected.protocols -notcontains 'ms-paint') { throw 'The signed manifest does not register ms-paint.' }
$result.route_registration = [ordered]@{ kind = 'protocol'; name = 'ms-paint'; supplies_file_bytes = $false }
} else {
$classes = @($expected.com_classes | Where-Object prog_id -eq 'Paint.Picture')
if ($classes.Count -ne 1) { throw 'The signed manifest does not register Paint.Picture.' }
$result.route_registration = [ordered]@{ kind = 'com_class'; prog_id = 'Paint.Picture'; clsid = $classes[0].id; supplies_file_bytes = $false }
}
if ($TraceExisting) {
if ($Route -notin @('association_edit', 'explorer_edit_in_paint')) {
throw 'Existing-PID trace is only meaningful for a file-supplying route.'
}
$before = @(Paint-Snapshot)
if ($before.Count -ne 1 -or -not $before[0].matches_installed_paint) {
throw 'Pre-armed trace requires exactly one verified bootstrap Paint PID.'
}
$result.pid_before = $before
$result.traced_pid = [int]$before[0].pid
$traceScript = Join-Path $inputRoot "trace\$Build.auto.cdb.txt"
$traceManifest = Get-Content -LiteralPath $traceManifestPath -Raw | ConvertFrom-Json
if (-not $traceManifest.auto_continue) { throw 'Existing-PID route trace requires auto-continue CDB checkpoints.' }
$debuggerPath = Join-Path $inputRoot 'debugger\cdb.exe'
$logPath = Join-Path $outputDir 'cdb.log'
$result.debugger_log = 'cdb.log'
$debuggerProcess = Start-Process -FilePath $debuggerPath -WindowStyle Hidden `
-ArgumentList @('-G', '-p', $result.traced_pid, '-logo', $logPath, '-cf', $traceScript) `
-PassThru -ErrorAction Stop
$result.debugger_pid = $debuggerProcess.Id
$deadline = (Get-Date).AddSeconds(18)
do {
Start-Sleep -Milliseconds 300
$logText = if (Test-Path -LiteralPath $logPath -PathType Leaf) {
Get-Content -LiteralPath $logPath -Raw -ErrorAction SilentlyContinue
} else { '' }
$ready = $logText -match "(?m)^PAINT_TRACE_PROFILE=$Build\s*$" -and
$logText -match '(?m)^\d+:\d+> g\s*$'
$debuggerProcess.Refresh()
} while (-not $ready -and -not $debuggerProcess.HasExited -and (Get-Date) -lt $deadline)
if (-not $ready) { throw 'CDB did not arm and resume before the route action.' }
$result.debugger_armed = $true
$result.trace_status = 'armed_existing_pid'
$result.markers_before_action = @(Trace-Markers $logPath)
} else {
$result.bootstrap_cleanup = Close-Paint
if (@($result.bootstrap_cleanup.remaining_pids).Count -gt 0 -or
@($result.bootstrap_cleanup.forced_pids).Count -gt 0) {
throw 'Bootstrap Paint did not close normally; route action was not run.'
}
$result.pid_before = Paint-Snapshot
}
$result.status = 'route_running'
$routeStarted = Get-Date
try {
switch ($Route) {
'association_edit' {
$opened = Start-Process -FilePath $fixturePath -Verb Edit -PassThru -ErrorAction Stop
if ($opened) { $result.launch_returned_pid = $opened.Id }
}
'explorer_edit_in_paint' {
$opened = Start-Process -FilePath $fixturePath -Verb EditInPaint -PassThru -ErrorAction Stop
if ($opened) { $result.launch_returned_pid = $opened.Id }
}
'protocol_empty' {
$opened = Start-Process -FilePath 'ms-paint:' -PassThru -ErrorAction Stop
if ($opened) { $result.launch_returned_pid = $opened.Id }
}
'com_activation' {
$class = [type]::GetTypeFromProgID('Paint.Picture', $false)
if (-not $class) { throw 'Paint.Picture ProgID is not visible to this guest COM client.' }
$instance = [Activator]::CreateInstance($class)
if ($instance -and [Runtime.InteropServices.Marshal]::IsComObject($instance)) {
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($instance)
}
}
}
} catch {
$result.launch_error = $_.Exception.Message
}
Start-Sleep -Seconds $ObserveSeconds
$result.pid_after = Paint-Snapshot
if ($TraceExisting -and $result.debugger_armed) {
$allMarkers = @(Trace-Markers $logPath)
$beforeCount = @($result.markers_before_action).Count
if ($allMarkers.Count -ge $beforeCount) {
$result.markers_after_action = @($allMarkers | Select-Object -Skip $beforeCount)
}
$validLabels = @($traceManifest.checkpoints | ForEach-Object { "$($_.path)_$($_.label)" })
foreach ($label in $result.markers_after_action) {
if ($validLabels -notcontains $label) { throw "Unexpected CDB marker: $label" }
}
try {
$traced = @(Get-Process -Id $result.traced_pid -ErrorAction SilentlyContinue)
if ($traced.Count -eq 1) {
foreach ($module in $traced[0].Modules) {
$moduleEntry = $traceManifest.modules.PSObject.Properties[$module.ModuleName]
if ($null -eq $moduleEntry) { continue }
$expectedPath = Join-Path $package.InstallLocation (Join-Path 'PaintApp' $module.ModuleName)
$loadedHash = (Get-FileHash -LiteralPath $module.FileName -Algorithm SHA256).Hash.ToLowerInvariant()
$matched = $module.FileName -ieq $expectedPath -and $loadedHash -eq [string]$moduleEntry.Value.sha256
$result.loaded_module_checks += [ordered]@{
module = $module.ModuleName
sha256 = $loadedHash
matches_signed_package = $matched
}
if (-not $matched) { throw "Loaded trace module identity mismatch: $($module.ModuleName)" }
}
}
} catch { $result.loaded_module_error = $_.Exception.Message }
$newPids = @($result.pid_after | Where-Object { $_.pid -ne $result.traced_pid -and $_.matches_installed_paint })
$samePid = @($result.pid_after | Where-Object { $_.pid -eq $result.traced_pid -and $_.matches_installed_paint })
$decoderHit = $result.markers_after_action -contains 'image_decoder'
$streamHit = $result.markers_after_action -contains 'stream_direct_stream' -or
$result.markers_after_action -contains 'stream_async_stream'
$hitModules = @(
foreach ($label in $result.markers_after_action) {
$point = @($traceManifest.checkpoints | Where-Object { "$($_.path)_$($_.label)" -eq $label })
if ($point.Count -eq 1) { $point[0].module }
}
)
$verifiedModules = @($result.loaded_module_checks | Where-Object matches_signed_package | ForEach-Object { $_.module })
$allHitModulesVerified = -not $result.loaded_module_error -and
@($hitModules | Where-Object { $verifiedModules -notcontains $_ }).Count -eq 0
if ($newPids.Count -gt 0) {
$result.trace_status = 'new_paint_pid_not_prearmed'
$result.parser_reach = 'inconclusive_new_pid'
} elseif (($decoderHit -or $streamHit) -and -not $allHitModulesVerified) {
$result.trace_status = 'hit_module_identity_unverified'
$result.parser_reach = 'inconclusive_module_identity'
} elseif ($samePid.Count -eq 1 -and ($decoderHit -or $streamHit) -and $allHitModulesVerified) {
$result.trace_status = 'same_pid_decoder_or_stream_hit'
$result.parser_reach = 'checkpoint_reached_in_prearmed_pid'
} else {
$result.trace_status = 'no_decoder_or_stream_hit_in_prearmed_pid'
$result.parser_reach = 'not_observed_in_this_prearmed_pid'
}
}
$shot = Join-Path $outputDir 'screen.png'
try { Save-Screenshot $shot; $result.screenshot = 'screen.png' } catch { $result.screenshot = $null }
try {
$result.application_error_events = @(
Get-WinEvent -FilterHashtable @{ LogName = 'Application'; StartTime = $routeStarted.AddSeconds(-1); Id = 1000,1001 } -ErrorAction Stop |
Where-Object { $_.Message -match '(?i)mspaint\.exe|Microsoft\.Paint' } |
Select-Object -First 20 |
ForEach-Object { [ordered]@{ id = $_.Id; provider = $_.ProviderName; time_utc = $_.TimeCreated.ToUniversalTime().ToString('o') } }
)
} catch { }
$dumpRoot = Join-Path $outputRoot 'dumps'
if (Test-Path -LiteralPath $dumpRoot -PathType Container) {
$result.dump_files = @(
Get-ChildItem -LiteralPath $dumpRoot -File -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -ge $routeStarted.AddSeconds(-1) } |
Select-Object -ExpandProperty Name
)
}
$result.interpretation = if ($result.launch_error) { 'route_invocation_error' }
elseif (@($result.pid_after | Where-Object matches_installed_paint).Count -eq 0) { 'no_matching_paint_process_observed' }
elseif ($TraceExisting) { $result.trace_status }
else { 'registered_paint_process_observed_parser_unmeasured' }
$result.status = 'complete'
} catch {
$result.status = 'failed'
$result.error = $_.Exception.Message
} finally {
$result.final_cleanup = Close-Paint
# A fault during normal window closure can appear after the earlier route
# snapshot. Sample the same event/dump window again after process exit.
Start-Sleep -Milliseconds 700
$eventWindowStart = if ($routeStarted) { $routeStarted.AddSeconds(-1) }
else { ([datetime]$result.started_utc).AddSeconds(-1) }
try {
$result.application_error_events = @(
Get-WinEvent -FilterHashtable @{ LogName = 'Application'; StartTime = $eventWindowStart; Id = 1000,1001 } -ErrorAction Stop |
Where-Object { $_.Message -match '(?i)mspaint\.exe|Microsoft\.Paint' } |
Select-Object -First 20 |
ForEach-Object { [ordered]@{ id = $_.Id; provider = $_.ProviderName; time_utc = $_.TimeCreated.ToUniversalTime().ToString('o') } }
)
} catch { }
$dumpRoot = Join-Path $outputRoot 'dumps'
if (Test-Path -LiteralPath $dumpRoot -PathType Container) {
$result.dump_files = @(
Get-ChildItem -LiteralPath $dumpRoot -File -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -ge $eventWindowStart } |
Select-Object -ExpandProperty Name
)
}
if ($result.status -eq 'complete' -and (
$result.launch_error -or
@($result.pid_after | Where-Object matches_installed_paint).Count -eq 0 -or
@($result.final_cleanup.forced_pids).Count -gt 0 -or
@($result.final_cleanup.remaining_pids).Count -gt 0 -or
@($result.application_error_events).Count -gt 0 -or
@($result.dump_files).Count -gt 0
)) {
$result.status = 'review_required'
}
if ($debuggerProcess) {
$debuggerProcess.Refresh()
if (-not $debuggerProcess.HasExited) {
Stop-Process -Id $debuggerProcess.Id -Force -ErrorAction SilentlyContinue
}
}
$result.completed_utc = (Get-Date).ToUniversalTime().ToString('o')
$result | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $resultPath -Encoding UTF8
Write-Output "Route $Route $($result.status): $resultPath"
}
if ($result.status -ne 'complete') { exit 2 }