Commit Graph

38 Commits

Author SHA1 Message Date
fulc2um 00f43cf714 Add badsuccessor attack example (#2010)
* added badsuccessor attack changes

* Added explicit error message for SUPERSEDED account in case of KDC_ERR_CLIENT_REVOKED error

* added a link to microsoft docs regarding dmsa set up; fixed a typo

* Added a prerequisite check with a message in case it is not met

* 1. Leveraged logging instead of prints
2. Unified ldaps parameters
3. Renamed PA_DMSA_KEY_PACKAGE to KRB_DMSA_KEY_PACKAGE
4. Refactored ldapConnection to utilize impacket.examples.utils.init_ldap_session
5. Removed "double try" for search_ous replacing with a single one with specified controls value
6. Additional minor fixes

* Adjusted argument handling for -allowed-principals and descriptions for other arguments

* 1. Modified build_security_descriptor function to fix permissions: previously modification of the entry was not impossible with INSUFF_RIGHTS
2. Added modify_dmsa function
3. Cleaned up unused imports

* Minor typo fix: KRB_DMSA_KEY_PACKAGE -> KERB_DMSA_KEY_PACKAGE

* Renamed PA_DMSA_KEY_PACKAGE -> KERB_DMSA_KEY_PACKAGE

* Changed security controls value in search_ous function from 0x15 -> 0x5

---------

Co-authored-by: fulc2um <autouser@localhost>
2025-08-08 17:01:17 -03:00
Gabriel Gonzalez ae0ec300f8 Techdebt examples bootstrapping v2 (#1928)
* Standardized examples logger init method

* Fixing missing import

* Standardized examples init_ldap_session function #1

* Calling new shared function _ldap3_kerberos_login from example addcomputer

* Removed considering -debug in each example. Now it's handled in utils.

* Standardized EMPTY_LM_HASH in impacket.examples.utils

* Unify parse_identity function (phase 1)

* Standardized parse_identity

* Renamed "_ldap3_kerberos_login" to "ldap3_kerberos_login" (as it is called from outside)

* Standardize "logger" init in regsecrets.py

* Standardized LDAP login into a single function in utils.py:ldap_login
2025-03-26 22:58:39 -03:00
Jannik Vieten 835e17550b Fixed warnings with Python 3.12 (#1695)
* fixed SyntaxWarnings due to invalid escape sequence

* fixed DeprecationWarning since datetime.datetime.utcnow() is deprecated in Python 3.12+

* fixed DeprecationWarning since datetime.datetime.utcfromtimestamp() is deprecated in Python 3.12+
2024-10-24 09:00:11 -03:00
gabrielg5 27e7e7478d Updating copyright banner... 2024-08-28 17:52:57 -03:00
shikatano 2b2977a1b4 added ability to set the RENEW ticket option to renew a TGT (#1585) 2024-08-26 09:29:36 -03:00
alexisbalbachan 089603e07e Update getST.py (#1794)
impacket #1650: Fixes encoding unicode errors while performing S4U
2024-08-23 15:57:01 -03:00
adrian manrique f900a886f8 Update getST.py 2024-05-17 09:15:33 -03:00
adrian manrique eb67ec5e70 updated copyright notice 2024-05-17 09:15:19 -03:00
adrian manrique 97007e841d implemented S4U2self only and u2u (#1691) 2024-01-30 15:47:45 -03:00
Gabriel Gonzalez 9b4a139405 Updated Copyright to 2023 2023-07-31 11:48:28 -03:00
Gabriel Gonzalez 8799a1a2c4 Update file banners to reflect Fortra ownership 2022-12-14 17:28:23 -03:00
Colinatorr a98b7b9741 fix: typo (#1314) 2022-05-30 15:01:27 -03:00
0xdeaddood 165361a83a Updated copyright year 2022-03-10 11:34:10 -03:00
Roman Maksimov 435dadfe61 clean up the code 2021-10-30 22:33:43 +03:00
Roman Maksimov 1409b455c8 add the parseFile class method and remove all the duplicate code 2021-10-30 22:33:43 +03:00
0xdeaddood b5599da022 Fixed typos 2021-10-22 18:10:44 -03:00
Shutdown 50d1ec9e80 Co-authored-by: GeisericII <g.giacobbe1@outlook.it> 2021-10-15 12:02:37 +02:00
Shutdown 76f3992655 Added -additional-ticket feature for S4U2Proxy for KCD Kerberos only abuse 2021-10-10 18:47:38 +02:00
exploide ee86a6d606 getST.py: fixed wrong example in usage output 2021-09-13 12:20:23 +02:00
Martin Gallo cd4fe47cfc Arrange tagline, copyright and license notes across all source files
This was a pending change to:
- Use the same tagline, copyright and license notice across files.
- Remove authors' contacts that are no longer valid (due to affiliation changes).
- Update repository location.
- Update license file with missing licenses (althought those were already in source files).

This doesn't include any change on the source code, nor any change on current copyright or licenses. Just formatting and phrasing to make our and distro's maintainers life easier.
2021-07-20 10:04:27 -03:00
Martin Gallo a45f331360 Refactored the credentials parsing functions (#1058)
Similar to and on top of #1053, this moves the credentials/account parsing regex to an utils module and reduces duplicated code in example scripts.

The expected credential format is:
`<DOMAIN></USERNAME><:PASSWORD>`

Note that the regular expression used in `exchanger.py` was different (excluded ':' from the hostname) but I didn't found any reason to keep it different from all other scripts.

This PR:
- Moved credentials parsing routine to an utils module.
- Added unit tests for the new function.
- Using the new function across example scripts that accept a credential/account.
2021-04-22 10:02:29 -03:00
Sam Free5ide 49546f728d Compute NTHash and AESKey for Bronze Bit Attack 2020-12-26 16:49:14 +03:00
Jake Karnes eaaac860a9 Adding CVE-2020-17049 exploit
See https://blog.netspi.com/cve-2020-17049-kerberos-bronze-bit-overview for an overview with links to deep dives into the vulnerability and exploit.
2020-12-08 12:10:07 -08:00
asolino 431959ad35 Fixed typo 2020-10-14 16:55:31 -03:00
Arseniy Sharoglazov abb991572d Normalizing [domain/]user[:password] regexps to the right one 2020-04-02 07:33:52 +03:00
asolino 8d4c91481b Print Library's installation path by default when -debug is specified 2020-02-05 19:52:39 -03:00
0xdeaddood 3b41d48e07 Add the timestamp option to several scripts
- GetADUsers.py, GETNPUsers.py, getST.py, getTGT.py, goldenPac.py, secretsdump.py, ticketer.py
2019-12-18 11:34:56 -03:00
asolino a63e784ac0 Merge branch 'master' into python36 2019-01-27 12:58:44 -03:00
Dirkjan Mollema 0404dc6808 use custom KDC in S4U 2019-01-26 14:07:12 +01:00
asolino 3c6f1d3b4b Merge branch 'master' into python36 2019-01-24 14:49:39 -08:00
asolino ecc05af663 Adding structure and constants for resource-based constrained delegation
* So we can replace the raw binary data
2019-01-24 14:44:50 -08:00
Elad Shamir bb17d8450e Adding resource-based constrained delegation support to S4U 2019-01-19 03:22:39 +11:00
asolino 553881b9da Merge branch 'master' into python36 2018-12-05 12:16:54 -03:00
asolino c328de8252 Changing Copyright notice 2018-12-05 12:14:55 -03:00
asolino de513d7b43 getST.py port to Python3 2018-10-08 17:45:53 -03:00
asolino 0b28d94832 Using raise the right way + removing print from traceback.print_exc() 2018-05-03 21:21:36 -03:00
asolino 8a8b2aabde Fixing typos in description 2018-04-25 23:21:40 -04:00
asolino b022a31ec3 Adding getST.py example
Given a password, hash, aesKey or TGT in ccache, it will request a Service Ticket
and save it as ccache.
If the account has constrained delegation (with protocol transition) privileges
you will be able to use the -impersonate switch to request the ticket on behalf
other user (it will use S4U2Self/S4U2Proxy to request the ticket.)

Similar feature has been implemented already by Benjamin Delphi (@gentilkiwi) in Kekeo (s4u)

Examples:

    ./getST.py -hashes lm:nt -spn cifs/contoso-dc contoso.com/user
It will save the ticket in user.ccache
or
If you have tickets cached (run klist to verify) the script will use them
    ./getST.py -k -spn cifs/contoso-dc contoso.com/user
Be sure tho, that the cached TGT has the forwardable flag set (klist -f).
getTGT.py will ask forwardable tickets by default.

Also, if the account is configured with unconstrained delegation (and with protocol transition)
you can request service tickets for other users, assuming the target SPN is allowed for
delegation:
./getST.py -k -impersonate Administrator -spn cifs/contoso-dc contoso.com/user

The output of this script will be a service ticket for the Administrator user.

Once you have the ccache file, set it in the KRB5CCNAME variable and use it for fun and profit.
2018-04-25 22:54:13 -04:00