Skip to content

Commit 642c333

Browse files
authored
Merge pull request #494 from peass-ng/update_PEASS-winpeas-HTB__TheFrizz__High-level__redacted__20250827_190719
[WINPEAS] Add privilege escalation check: HTB TheFrizz (High-level, redacted for s...
2 parents cc5ab76 + c314cfd commit 642c333

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

winPEAS/winPEASexe/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ winpeas.exe -lolbas #Execute also additional LOLBAS search check
7474
7575
The goal of this project is to search for possible **Privilege Escalation Paths** in Windows environments.
7676
77+
New in this version:
78+
- Detect potential GPO abuse by flagging writable SYSVOL paths for GPOs applied to the current host and by highlighting membership in the "Group Policy Creator Owners" group.
79+
80+
7781
It should take only a **few seconds** to execute almost all the checks and **some seconds/minutes during the lasts checks searching for known filenames** that could contain passwords (the time depened on the number of files in your home folder). By default only **some** filenames that could contain credentials are searched, you can use the **searchall** parameter to search all the list (this could will add some minutes).
7882
7983
The tool is based on **[SeatBelt](https://github.com/GhostPack/Seatbelt)**.

winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public void PrintInfo(bool isDebug)
8484
PrintLSAInfo,
8585
PrintNtlmSettings,
8686
PrintLocalGroupPolicy,
87+
PrintPotentialGPOAbuse,
8788
AppLockerHelper.PrintAppLockerPolicy,
8889
PrintPrintersWMIInfo,
8990
PrintNamedPipes,
@@ -1131,6 +1132,94 @@ private static void PrintLocalGroupPolicy()
11311132
}
11321133
}
11331134

1135+
private static void PrintPotentialGPOAbuse()
1136+
{
1137+
try
1138+
{
1139+
Beaprint.MainPrint("Potential GPO abuse vectors (applied domain GPOs writable by current user)");
1140+
1141+
if (!Checks.IsPartOfDomain)
1142+
{
1143+
Beaprint.NoColorPrint(" Host is not joined to a domain or domain info is unavailable.");
1144+
return;
1145+
}
1146+
1147+
// Build a friendly group list for the current user to quickly spot interesting memberships
1148+
var currentGroups = winPEAS.Info.UserInfo.User.GetUserGroups(Checks.CurrentUserName, Checks.CurrentUserDomainName) ?? new System.Collections.Generic.List<string>();
1149+
var hasGPCO = currentGroups.Any(g => string.Equals(g, "Group Policy Creator Owners", System.StringComparison.InvariantCultureIgnoreCase));
1150+
1151+
if (hasGPCO)
1152+
{
1153+
Beaprint.BadPrint(" [!] Current user is member of 'Group Policy Creator Owners' — can create/own new GPOs. If you can link a GPO to an OU that applies here, you can execute code as SYSTEM via scheduled task/startup script.");
1154+
}
1155+
1156+
var infos = GroupPolicy.GetLocalGroupPolicyInfos();
1157+
1158+
bool anyFinding = false;
1159+
foreach (var info in infos)
1160+
{
1161+
var fileSysPath = info.FileSysPath?.ToString();
1162+
if (string.IsNullOrEmpty(fileSysPath))
1163+
{
1164+
continue;
1165+
}
1166+
1167+
// Only look at domain GPOs stored in SYSVOL
1168+
var isSysvolPath = fileSysPath.StartsWith(@"\", System.StringComparison.InvariantCultureIgnoreCase) &&
1169+
fileSysPath.IndexOf(@"\SysVol\", System.StringComparison.InvariantCultureIgnoreCase) >= 0 &&
1170+
fileSysPath.IndexOf(@"\Policies\", System.StringComparison.InvariantCultureIgnoreCase) >= 0;
1171+
1172+
if (!isSysvolPath)
1173+
{
1174+
continue;
1175+
}
1176+
1177+
// Check write/equivalent permissions on common abuse locations inside the GPO
1178+
var pathsToCheck = new System.Collections.Generic.List<string>
1179+
{
1180+
fileSysPath,
1181+
System.IO.Path.Combine(fileSysPath, @"Machine\Scripts\Startup"),
1182+
System.IO.Path.Combine(fileSysPath, @"User\Scripts\Logon"),
1183+
System.IO.Path.Combine(fileSysPath, @"Machine\Preferences\ScheduledTasks")
1184+
};
1185+
1186+
foreach (var p in pathsToCheck)
1187+
{
1188+
var perms = PermissionsHelper.GetPermissionsFolder(p, Checks.CurrentUserSiDs, PermissionType.WRITEABLE_OR_EQUIVALENT);
1189+
if (perms != null && perms.Count > 0)
1190+
{
1191+
if (!anyFinding)
1192+
{
1193+
Beaprint.LinkPrint("https://book.hacktricks.wiki/en/windows-hardening/active-directory-methodology/gpo-abuse.html", "Why it matters");
1194+
}
1195+
anyFinding = true;
1196+
Beaprint.BadPrint($" [!] Writable applied GPO detected");
1197+
Beaprint.NoColorPrint($" GPO Display Name : {info.DisplayName}");
1198+
Beaprint.NoColorPrint($" GPO Name : {info.GPOName}");
1199+
Beaprint.NoColorPrint($" GPO Link : {info.Link}");
1200+
Beaprint.NoColorPrint($" Path : {p}");
1201+
foreach (var entry in perms)
1202+
{
1203+
Beaprint.NoColorPrint($" -> {entry}");
1204+
}
1205+
Beaprint.GrayPrint(" Hint: Abuse by adding an immediate Scheduled Task or Startup script to execute as SYSTEM on gpupdate.");
1206+
}
1207+
}
1208+
}
1209+
1210+
if (!anyFinding && !hasGPCO)
1211+
{
1212+
Beaprint.NoColorPrint(" No obvious GPO abuse via writable SYSVOL paths or GPCO membership detected.");
1213+
}
1214+
}
1215+
catch (Exception ex)
1216+
{
1217+
// Avoid noisy stack traces in normal runs
1218+
Beaprint.GrayPrint($" [!] Error while checking potential GPO abuse: {ex.Message}");
1219+
}
1220+
}
1221+
1222+
11341223
private static void PrintPowerShellSessionSettings()
11351224
{
11361225
try

0 commit comments

Comments
 (0)