πŸ“˜
DFIR
search
⌘Ctrlk
πŸ“˜
DFIR
  • Networking
    • Networking
  • Windows
    • Administration
    • Forensics
      • System Info
      • Memory
        • Pagefile.sys
        • PowerShell Dump
        • Memory Forensics
      • Network Logs
      • File System
      • Registry
      • Network Share
      • Exfiltration
      • Evidence of Execution
      • Hacktool Artifacts
      • Event Logs
      • 3rd Party Apps
      • Example Page
    • Cheat Sheet
    • Investigation
    • Internals
    • Active Directory
    • MISC
  • Linux
    • Forensics
    • SSH
    • Linux WebShells
    • Directories of Interest
    • Internals
  • Enterprise Architecture
    • CI/CD Pipline
    • Citrix
    • Web Applications
    • The Cloud
    • vSphere
    • Containers
    • Troubleshooting
  • Mac
    • Forensics
  • Attacker Information
    • Adversary Operations
    • Actor Playbooks
    • Abused Domains
  • IR Playbook
    • Activity from Unmanaged Host
    • Recommendations
  • Reverse Engineering
    • Python - Pyinstaller
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
  1. Windowschevron-right
  2. Forensicschevron-right
  3. Memory

PowerShell Dump

LogoExtracting Activity History from PowerShell Process Dumpswww.leeholmes.comchevron-right
LogoExtracting Forensic Script Content from PowerShell Process Dumpswww.leeholmes.comchevron-right

hashtag
Connect Dump File to WinDBG

hashtag
Run in ISE to Extract Files:

PreviousPagefile.syschevron-leftNextMemory Forensicschevron-right

Last updated 2 years ago

  • Connect Dump File to WinDBG
  • Run in ISE to Extract Files:
Connect-DbgSession -ArgumentList '-z "C:\Users\lee\AppData\Local\Temp\powershell.DMP"'
function Get-ScriptBlockCache
{
    $nodeType = dbg !dumpheap -type ConcurrentDictionary |
        Select-String 'ConcurrentDictionary.*Node.*Tuple.*String.*String.*\]\]$'
    $nodeMT = $nodeType | ConvertFrom-String | Foreach-Object P1
    $nodeAddresses = dbg !dumpheap -mt $nodeMT -short
    $keys = $nodeAddresses | % { dbg !do $_ } | Select-String m_key
    $keyAddresses = $keys | ConvertFrom-String | Foreach-Object P7
    foreach($keyAddress in $keyAddresses) {
        $keyObject = dbg !do $keyAddress

        $item1 = $keyObject | Select-String m_Item1 | ConvertFrom-String | % P7
        $string1 = dbg !do $item1 | Select-String 'String:\s+(.*)' |
            % { $_.Matches.Groups[1].Value }

        $item2 = $keyObject | Select-String m_Item2 | ConvertFrom-String | % P7
        $string2 = dbg !do $item2 | Select-String 'String:\s+(.*)' |
            % { $_.Matches.Groups[1].Value }

        [PSCustomObject] @{ Path = $string1; Content = $string2 }
    }
}