Persistence
Common ways for the attacker to remain on the system after initial access
Assign Group Memberships
Assuming you have successfully cracked the passwords for the unprivileged accounts in use, the direct way to make an unprivileged user gain administrative privileges is to make it part of the Administrators group
This can also be done by exporting the current configuration to a temporary file and opening the file and add our user to the lines in the configuration regarding the SeBackupPrivilege and SeRestorePrivilege
Then, convert the .inf file into a .sdb file which is then used to load the configuration back into the system:
Special privileges
In the case of the Backup Operators group, it has the following two privileges assigned by default:
- 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.
To open the configuration window for WinRM's security descriptor, you can use the following command in Powershell (you'll need to use the GUI session for this):
WinRM
- Ports: 5985/TCP (WinRM HTTP) or 5986/TCP (WinRM HTTPS)
Windows Remote Management (WinRM) is a web-based protocol used to send Powershell commands to Windows hosts remotely.
To connect to a remote Powershell session from the command line, we can use the following command
Evil-WinRM
Evil-WinRM is a post-exploitation tool designed for ethical hacking and penetration testing, providing a streamlined and efficient way to interact with Windows systems via Windows Remote Management (WinRM)
Usage
To be able to regain administration privileges from your user, we'll have to disable LocalAccountTokenFilterPolicy by changing the following registry key to 1:
Then, proceed to make a backup of the SAM and SYSTEM files and download them to the attacker's machine:
With those files, we can dump the password hashes for all users using secretsdump.py or other similar tools:
Via Tasks
Via Services
Using SC (Service Control Manager)
Using Powershell
Via Registry
Using SC (Service Control Manager)
Using Powershell
Backdoor after initial access
Create Tasks Remotely
Since the system will run the scheduled task, the command's output won't be available to us, making this a blind attack.
Examples from THM
Escalation
Common ways for the attacker to gain and execute commands with elevated privileges
Obfuscation
Malware obfuscation is a technique used by malicious actors to hide or disguise the true nature and functionality of their code, making it more difficult for security software to detect and for cybersecurity experts to analyze