powershell_-_get-system

POWERSHELL - GET-SYSTEM function Get-System { <# .SYNOPSIS

    GetSystem functionality inspired by Meterpreter's getsystem.
    'NamedPipe' impersonation doesn't need SeDebugPrivilege but does create
    a service, 'Token' duplications a SYSTEM token but needs SeDebugPrivilege.
    NOTE: if running PowerShell 2.0, start powershell.exe with '-STA' to ensure
    token duplication works correctly.

    PowerSploit Function: Get-System
    Author: @harmj0y, @mattifestation
    License: BSD 3-Clause
    Required Dependencies: None
    Optional Dependencies: None

.PARAMETER Technique

    The technique to use, 'NamedPipe' or 'Token'.

.PARAMETER ServiceName

    The name of the service used with named pipe impersonation, defaults to 'TestSVC'.

.PARAMETER PipeName

    The name of the named pipe used with named pipe impersonation, defaults to 'TestSVC'.

.PARAMETER RevToSelf

    Reverts the current thread privileges.

.PARAMETER WhoAmI

    Switch. Display the credentials for the current PowerShell thread.

.EXAMPLE

    PS> Get-System

    Uses named impersonate to elevate the current thread token to SYSTEM.

.EXAMPLE

    PS> Get-System -ServiceName 'PrivescSvc' -PipeName 'secret'

    Uses named impersonate to elevate the current thread token to SYSTEM
    with a custom service and pipe name.

.EXAMPLE

    PS> Get-System -Technique Token

    Uses token duplication to elevate the current thread token to SYSTEM.

.EXAMPLE

    PS> Get-System -WhoAmI

    Displays the credentials for the current thread.

.EXAMPLE

    PS> Get-System -RevToSelf

    Reverts the current thread privileges.

.LINK

    https://github.com/rapid7/meterpreter/blob/2a891a79001fc43cb25475cc43bced9449e7dc37/source/extensions/priv/server/elevate/namedpipe.c
    https://github.com/obscuresec/shmoocon/blob/master/Invoke-TwitterBot
    http://blog.cobaltstrike.com/2014/04/02/what-happens-when-i-type-getsystem/
    http://clymb3r.wordpress.com/2013/11/03/powershell-and-token-impersonation/

>

}

Last updated

Was this helpful?