Exploit database

GH-945bd5267b0d1b94c3f74faf5cda7e5a

blkph0x/cve-2026-83844_poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-83844

5 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files579
blkph0x/cve-2026-83844_pocRevision 193ed44859da
Next files →

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

lab/trace/guest_bfdb_wpr_heap_entry.ps1

PowerShell · 10,075 bytes
param(
    [Parameter(Mandatory = $true)]
    [ValidateSet('primer_a','primer_b')][string]$CaseId
)

# Guest-only, opt-in heap capture. The host stager never executes WPR. This
# entry must run before Paint activation, and must stop/disable tracing before
# it requests the guest's ordinary shutdown.
$ErrorActionPreference = 'Stop'
$inputRoot = 'C:\PaintLab\Input'
$outputRoot = 'C:\PaintLab\Output'
$privateRoot = Join-Path $outputRoot 'bfdb-wpr-heap'
$wpr = Join-Path $env:WINDIR 'System32\wpr.exe'
$focusEntry = Join-Path $inputRoot 'trace\guest_focus_entry.ps1'
$allocatorEntry = Join-Path $inputRoot 'trace\guest_bfdb_allocator_entry.ps1'
$callHelper = Join-Path $inputRoot 'trace\guest_bfdb_wpr_call.ps1'
$expectedFocusSha256 = 'ced4e5f81d5e96142f94964e1ce1a21fe5a6f4ccc6de444fff324baa6ee52e27'
$runId = (Get-Date).ToUniversalTime().ToString('yyyyMMddTHHmmssZ')
$etl = Join-Path $privateRoot 'paint-heap.etl'
$receipt = Join-Path $privateRoot 'receipt.json'
$enabledAttempted = $false
$startAttempted = $false
$started = $false
$focusOk = $false
$captureStarted = $null
$record = [ordered]@{
    schema = 'paint-bfdb-wpr-heap-guest-v1'
    build = 'old'
    case_id = $CaseId
    run_id = $runId
    started_utc = (Get-Date).ToUniversalTime().ToString('o')
    status = 'preflight'
    focus_entry_sha256 = $null
    wpr_sha256 = $null
    heap_config_enable = $null
    heap_start = $null
    focus_batch_status = $null
    heap_stop = $null
    heap_config_disable = $null
    tracing_flags_after_disable = $null
    capture_duration_seconds = $null
    etl_size_bytes = $null
    etl_sha256 = $null
    shutdown_exit_code = $null
    error = $null
}

function Invoke-BoundedWpr([string]$Step,
                           [ValidateRange(5,180)][int]$TimeoutSeconds) {
    $sidecar = Join-Path $privateRoot "wpr-$Step.exit.json"
    $stdout = Join-Path $privateRoot "wpr-$Step.helper.stdout.txt"
    $stderr = Join-Path $privateRoot "wpr-$Step.helper.stderr.txt"
    Remove-Item -LiteralPath $sidecar -Force -ErrorAction SilentlyContinue
    $launched = (Get-Date).ToUniversalTime()
    $powershell = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
    $process = Start-Process -FilePath $powershell `
        -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',
                        $callHelper,'-Step',$Step) -WindowStyle Hidden -PassThru `
        -RedirectStandardOutput $stdout -RedirectStandardError $stderr -ErrorAction Stop
    $exited = $process.WaitForExit($TimeoutSeconds * 1000)
    if (-not $exited) {
        Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
        return [ordered]@{ exit_code = $null; timed_out = $true }
    }
    $process.Refresh()
    if (-not (Test-Path -LiteralPath $sidecar -PathType Leaf)) {
        return [ordered]@{ exit_code = $null; timed_out = $false;
            error = 'Guest WPR native exit sidecar missing' }
    }
    $row = Get-Content -LiteralPath $sidecar -Raw | ConvertFrom-Json
    $recordedStart = [DateTime]::Parse([string]$row.started_utc).ToUniversalTime()
    if ($row.schema -cne 'paint-bfdb-wpr-native-exit-v1' -or
        $row.step -cne $Step -or $recordedStart -lt $launched.AddSeconds(-2) -or
        $null -eq $row.exit_code -or $null -ne $row.error -or
        ($null -ne $process.ExitCode -and $process.ExitCode -ne [int]$row.exit_code)) {
        return [ordered]@{ exit_code = $null; timed_out = $false;
            error = 'Guest WPR native exit sidecar differs' }
    }
    return [ordered]@{ exit_code = [int]$row.exit_code; timed_out = $false;
        native_exit_receipt_sha256 =
            (Get-FileHash -LiteralPath $sidecar -Algorithm SHA256).Hash.ToLowerInvariant() }
}

function Require-WprSuccess($Result, [string]$Step) {
    if ($Result.timed_out -or $Result.exit_code -ne 0) {
        throw "Guest WPR $Step did not complete successfully."
    }
}

try {
    if ($env:USERNAME -cne 'WDAGUtilityAccount' -or
        -not (Test-Path -LiteralPath $inputRoot -PathType Container) -or
        -not (Test-Path -LiteralPath $outputRoot -PathType Container)) {
        throw 'Disposable Paint guest guard failed before heap tracing.'
    }
    New-Item -ItemType Directory -Path $privateRoot -Force | Out-Null
    if (-not (Test-Path -LiteralPath $wpr -PathType Leaf)) {
        throw 'Guest WPR executable is missing.'
    }
    foreach ($path in @($focusEntry,$allocatorEntry,$callHelper)) {
        if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
            throw "Pinned guest entry is missing: $path"
        }
    }
    $record.focus_entry_sha256 = (Get-FileHash -LiteralPath $focusEntry -Algorithm SHA256).Hash.ToLowerInvariant()
    if ($record.focus_entry_sha256 -cne $expectedFocusSha256) {
        throw 'Pinned tracked Focus entry differs in the guest.'
    }
    $record.wpr_sha256 = (Get-FileHash -LiteralPath $wpr -Algorithm SHA256).Hash.ToLowerInvariant()
    if (@(Get-Process -Name mspaint,cdb -ErrorAction SilentlyContinue).Count -ne 0) {
        throw 'Paint or CDB was already running before heap tracing.'
    }
    $record.status = 'capturing'
    $enabledAttempted = $true
    $record.heap_config_enable = Invoke-BoundedWpr 'enable' 45
    Require-WprSuccess $record.heap_config_enable 'HeapTracingConfig enable'
    $startAttempted = $true
    $record.heap_start = Invoke-BoundedWpr 'start' 45
    Require-WprSuccess $record.heap_start 'start Heap -filemode'
    $started = $true
    $captureStarted = (Get-Date).ToUniversalTime()

    # The allocator wrapper verifies normal heap, signed profile and pinned
    # fixture hashes. SkipShutdown leaves the guest alive for WPR stop/disable.
    & $allocatorEntry -CaseId $CaseId -PerCaseTimeoutSeconds 260 -SkipShutdown
    if (-not $?) { throw 'Allocator guest wrapper failed.' }
    $batches = @(Get-ChildItem -LiteralPath $outputRoot -Filter 'focus-batch-old-*.json' -File)
    if ($batches.Count -ne 1) { throw 'Focused batch missing or ambiguous.' }
    $batch = Get-Content -LiteralPath $batches[0].FullName -Raw | ConvertFrom-Json
    $record.focus_batch_status = [string]$batch.status
    if ($batch.schema -cne 'paint-ab-focus-batch-v1' -or
        $batch.build -cne 'old' -or $batch.status -cne 'complete' -or
        @($batch.selected_cases).Count -ne 1 -or
        [string](@($batch.selected_cases)[0]) -cne $CaseId -or
        $batch.sequence_pairs -cne "$($CaseId):trigger") {
        throw 'Focused two-open batch did not complete.'
    }
    $focusOk = $true
} catch {
    $record.error = $_.Exception.Message
} finally {
    if ($startAttempted) {
        try {
            $record.heap_stop = Invoke-BoundedWpr 'stop' 120
        } catch {
            $record.heap_stop = [ordered]@{ exit_code = $null; timed_out = $false;
                error = $_.Exception.Message }
        }
    }
    # Call disable even if enable/start failed. This is guest-local IFEO state;
    # no host IFEO or WPR setting is touched by this workflow.
    if ($enabledAttempted -and (Test-Path -LiteralPath $wpr -PathType Leaf)) {
        try {
            $record.heap_config_disable = Invoke-BoundedWpr 'disable' 45
        } catch {
            $record.heap_config_disable = [ordered]@{ exit_code = $null;
                timed_out = $false; error = $_.Exception.Message }
        }
        try {
            $ifeo = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\mspaint.exe'
            $property = Get-ItemProperty -LiteralPath $ifeo -Name TracingFlags `
                -ErrorAction SilentlyContinue
            $record.tracing_flags_after_disable = if ($null -eq $property) { 0 }
                else { [int]$property.TracingFlags }
        } catch {
            $record.tracing_flags_after_disable = $null
        }
    }
    if ($captureStarted) {
        $record.capture_duration_seconds = [math]::Round(
            ((Get-Date).ToUniversalTime() - $captureStarted).TotalSeconds, 3)
    }
    if (Test-Path -LiteralPath $etl -PathType Leaf) {
        $record.etl_size_bytes = [long](Get-Item -LiteralPath $etl).Length
        $record.etl_sha256 = (Get-FileHash -LiteralPath $etl -Algorithm SHA256).Hash.ToLowerInvariant()
    }
    $captureValid = $focusOk -and $started -and
        $record.heap_stop -and $record.heap_stop.exit_code -eq 0 -and
        -not $record.heap_stop.timed_out -and
        $record.heap_config_disable -and
        $record.heap_config_disable.exit_code -eq 0 -and
        -not $record.heap_config_disable.timed_out -and
        $record.tracing_flags_after_disable -eq 0 -and
        $record.etl_size_bytes -ge 4096 -and
        $record.etl_size_bytes -le 2147483648 -and
        $record.capture_duration_seconds -le 600
    $record.status = if ($captureValid) { 'capture_complete_unreviewed' }
        else { 'review_required' }
    if (-not $record.error -and -not $captureValid) {
        $record.error = 'WPR capture, size, duration, or guest tracing teardown failed.'
    }
    $record.completed_utc = (Get-Date).ToUniversalTime().ToString('o')
    if (Test-Path -LiteralPath $outputRoot -PathType Container) {
        New-Item -ItemType Directory -Path $privateRoot -Force | Out-Null
        $record | ConvertTo-Json -Depth 8 |
            Set-Content -LiteralPath $receipt -Encoding UTF8
        $null = Get-FileHash -LiteralPath $receipt -Algorithm SHA256
        & (Join-Path $env:WINDIR 'System32\shutdown.exe') /s /t 20 /c 'Paint bfdb WPR heap trial complete'
        $record.shutdown_exit_code = $LASTEXITCODE
        [ordered]@{
            requested_utc = (Get-Date).ToUniversalTime().ToString('o')
            method = 'normal shutdown /s /t 20; no /f'
            exit_code = $record.shutdown_exit_code
        } | ConvertTo-Json -Depth 3 |
            Set-Content -LiteralPath (Join-Path $outputRoot "focus-shutdown-old-$runId.json") -Encoding UTF8
        $record | ConvertTo-Json -Depth 8 |
            Set-Content -LiteralPath $receipt -Encoding UTF8
    }
}
if ($record.status -ne 'capture_complete_unreviewed' -or $record.shutdown_exit_code -ne 0) {
    exit 2
}