Skip to content

Back to the Category Index / Back to the Command Index

Creates a ticket with a modified PAC to test MS14-068. The ticket can be saved, or its resulting privileges can be used for SMB-based execution.

ItemDetails
Implementationexamples/goldenPac.py
CategoryKerberos / Ticket Handling
Size1136 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Check python examples/goldenPac.py -h for the current option definitions.

ArgumentDescription
target[[domain/]username[:password]@]<targetName>
-tsAdd timestamps to log output.
-debugEnable debug logging.
commandCommand to run on the target, or arguments when using -c, without a path. Defaults to cmd.exe. Use None to skip PSEXEC and only save the ticket.
-cUpload a file for later execution; pass its arguments through command.
-wWrite the golden ticket in ccache format to <pathname>.
-dc-ipDomain controller IP address, needed to obtain the user’s SID. Defaults to the domain (FQDN) in target.
-target-ipTarget host IP address. Defaults to targetName.
-hashesNTLM hashes in LMHASH:NTHASH format.

The command gathers domain and user SIDs and DC information through RPC and LDAP/Kerberos, builds and signs a TGT/PAC, and exchanges it with the KDC. With the resulting service ticket, it can save a ccache or install a PSEXEC-style service, use named-pipe I/O, and open an interactive shell. It cleans up the service and pipes on exit.

To reproduce the vulnerable PAC-validation path in MS14-068, this command builds the ticket and PAC at a lower level than an ordinary Kerberos client. It first obtains the user SID, domain SID, and DC/forest information from SAMR/LSA and other sources, then establishes an initial KDC exchange with valid account credentials.

The core vulnerability test builds a PAC with privileged group information and embeds it in a request with a signature layout the KDC will accept. The resulting ticket and session key are either saved to a ccache or used to request an SMB service ticket. In the latter case, credentials are passed to the PSEXEC implementation in the same file to install a service and start a named-pipe shell.

Ticket creation and remote execution have different responsibilities, but this example combines them in one end-to-end flow. When changing it, verify PAC/NDR offsets, Kerberos key usage, and SMB service cleanup separately. Distinguish rejection by a patched KDC from network or authentication failures; an unsuccessful exploit is also a valid test result.

SymbolLocationEntry Point for Tracing Behavior
RemComMessage69Structure and constant definitions
RemComResponse79Structure and constant definitions
PSEXEC91__init__(), run(), openPipe()
Pipes220__init__(), connectPipe()
RemoteStdOutPipe253__init__(), run()
RemoteStdErrPipe280__init__(), run()
RemoteShell298__init__(), connect_transferClient(), do_help(), do_shell(), do_get(), do_put(), do_lcd(), emptyline(), default(), send_data()
RemoteStdInPipe407__init__(), run()
MS14_068417__init__(), getGoldenPAC(), getKerberosTGS(), getForestSid(), getDomainControllers(), getUserSID(), exploit()
ModuleMain Names Used
impacket.dcerpc.v5epm, samr, transport
impacket.dcerpc.v5.drsuapiDRSBind, DRS_EXTENSIONS_INT, DRS_EXT_GETCHGREPLY_V6, DRS_EXT_GETCHGREQ_V6, DRS_EXT_GETCHGREQ_V8, DRS_EXT_STRONG_ENCRYPTION, MSRPC_UUID_DRSUAPI, NTDSAPI_CLIENT_GUID, NULLGUID, hDRSDomainControllerInfo
impacket.dcerpc.v5.dtypesMAXIMUM_ALLOWED, RPC_SID
impacket.dcerpc.v5.lsadPOLICY_INFORMATION_CLASS, hLsarOpenPolicy2, hLsarQueryInformationPolicy2
impacket.dcerpc.v5.lsatMSRPC_UUID_LSAT, POLICY_LOOKUP_NAMES
impacket.dcerpc.v5.nrpcMSRPC_UUID_NRPC, hDsrGetDcNameEx
impacket.dcerpc.v5.rpcrtRPC_C_AUTHN_LEVEL_PKT_INTEGRITY, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, TypeSerialization1
impacket.krb5.pacKERB_SID_AND_ATTRIBUTES, KERB_VALIDATION_INFO, PACTYPE, PAC_CLIENT_INFO, PAC_CLIENT_INFO_TYPE, PAC_INFO_BUFFER, PAC_LOGON_INFO, PAC_PRIVSVR_CHECKSUM, PAC_SERVER_CHECKSUM, PAC_SIGNATURE_DATA, PKERB_VALIDATION_INFO
impacket.exampleslogger, remcomsvc, serviceinstall
impacket.examples.utilsparse_target
impacket.smbconnectionSMBConnection, smb
impacket.structureStructure
impacketversion
impacket.krb5.typesKerberosTime, Principal, Ticket
impacket.krb5constants
impacket.krb5.kerberosv5KerberosError, getKerberosTGS, getKerberosTGT, sendReceive
impacket.krb5.asn1AD_IF_RELEVANT, AP_REQ, AS_REP, Authenticator, AuthorizationData, ETYPE_INFO2_ENTRY, EncASRepPart, EncTGSRepPart, KERB_PA_PAC_REQUEST, TGS_REP, TGS_REQ, seq_set, seq_set_iter
impacket.krb5.cryptoKey
impacket.dcerpc.v5.ndrNDRULONG
impacket.dcerpc.v5.samrGROUP_MEMBERSHIP, NULL, SE_GROUP_ENABLED, SE_GROUP_ENABLED_BY_DEFAULT, SE_GROUP_MANDATORY, USER_DONT_EXPIRE_PASSWORD, USER_NORMAL_ACCOUNT
impacket.krb5.ccacheCCache
impacket.ntlmcompute_lmhash, compute_nthash
Import NameDistribution PackageUsage / Declaration Status
CryptodomepycryptodomexImported directly; declared dependency
pyasn1pyasn1Imported directly; declared dependency
sixsixImported directly; declared dependency

Output, Side Effects, and Required Privileges

Section titled “Output, Side Effects, and Required Privileges”
  • Primarily queries and authentication attempts. Repeated runs can affect audit logs, account lockouts, and target load.
  • Depending on options, creates or updates a local file. Check how existing files are handled and the permissions on output containing secrets.
  • Some paths use temporary resources such as remote services, tasks, files, shares, and WMI/RPC resources. Cleaning them up after abnormal termination is part of the behavior contract.
  • On failure, use protocol status to determine whether name resolution, connection, authentication, service state, or permissions stopped the operation.
  • Even without an explicitly named cleanup function, check for a finally-equivalent path and closure or deletion of protocol handles.

This command depends on krb5.*, PAC/NDR, SAMR/LSA/RPC, SMB, and examples.remcomsvc / serviceinstall. MS14_068 handles ticket processing; the PSEXEC classes in the same file handle execution.