Commit Graph

4233 Commits

Author SHA1 Message Date
adrian manrique e1d303a3cd fixed typo 2026-05-19 17:13:57 -03:00
adrian manrique 71bb26bd64 added python 3.14 2026-05-19 17:10:16 -03:00
Gabriel Gonzalez e082cf6c90 Bump version to 0.14.0-dev 2026-05-19 12:41:09 -03:00
Kali c456746d7a tests: initialize DCOM connection for RemoteGetClassObject
Use DCOMConnection in test_RemoteGetClassObject instead of a raw
  DCE/RPC connection from self.connect(). RemoteGetClassObject returns an
  interface whose RemRelease path expects the DCOMConnection PORTMAPS cache
  to be initialized for the target; the raw connection path leaves that
  cache empty and can raise KeyError keyed by the target address.

  Wrap the interface use in a try/finally so the DCOM connection is always
  disconnected after the test.
impacket_0_13_1
2026-05-15 12:40:42 -03:00
Kali 9dcc815344 do not use hardcoded paths for tests.
do cleanup on finally block even in test fails
2026-05-15 11:27:47 -03:00
Gabriel Gonzalez 132c4e76bb Update image tag in README
Removed width and height attributes from image.
2026-05-14 16:24:49 -03:00
gabrielg5 427f44ce1b About to tag v0.13.1 release 2026-05-14 13:37:14 -04:00
Gabi Gonzalez 7526eb68ad Update 0.13.1 contributors 2026-05-12 17:44:07 -03:00
Gabriel Gonzalez 4fca9f10b2 Remove Contributors section from ChangeLog
Removed the 'Contributors' section from the ChangeLog.
2026-05-12 10:22:47 -03:00
Gabi Gonzalez 1e7031456f Setting tickets links to 'links' in ChangeLog 2026-05-12 10:05:05 -03:00
Gabi Gonzalez b7436bd13c Updated ChangeLog.md 2026-05-12 09:59:13 -03:00
alexisbalbachan 46e9b038be secretsdump: Filter offline NTDS accounts by local domain SID (#2178)
* Filter offline NTDS rows by local domain SID

* Use remoteops.getDomainSid when isRemote == True

* Skip offline NTDS rows with unavailable PEK indexes

* Allow snapshot enumeration over SMB 3.1.1

---------

Co-authored-by: gabrielg5 <gabriel.gonzalez@fortra.com>
2026-05-08 12:08:09 -03:00
Herbenderbler 0be6514bdf BUG-2099: Fix Unhandled ValueError during authentication (#2151)
* Fix #2099: handle truncated SMB responses (SessionError + debug log)

- structure: asciiz without NUL raises clear ValueError with field name
- smb: catch ValueError at session/negotiate parse sites; log at debug, raise SessionError
- smbconnection: docstring notes invalid/truncated server response
- ci: fix flake8 F824 (goldenPac, ldapattack)
- tests: regression for asciiz NUL and session setup parsing; align with TESTING.md
- docs: ChangeLog

* Fix #2099 struct.error mapping.
2026-05-06 01:53:30 -03:00
Tomik f1cb36178e GetUserSPNs.py - Added a switch not to force RC4-HMAC when requesting a TGT (#2141)
* Added a switch not to force RC4-HMAC when requesting a TGT as newer servers (e.g., 2025) won't issue service tickets when provided with RC4-HMAC TGT.

* Update examples/GetUserSPNs.py

Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>

---------

Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
2026-05-05 13:46:31 -03:00
ThatTotallyRealMyth 8601e43614 Fix Issues with ACE type filtering and ObjectType GUID parsing in BadSuccessor.py search_ous() that causes False negatives (#2170)
* Added processing to object specific ACEs in search_ous()

* Fixed GUID parser for ObjectType handling for object-specific ACEs

* Apply suggestion from @alexisbalbachan

Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>

---------

Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
2026-05-05 13:07:11 -03:00
alexisbalbachan 899ef248d8 ticketer.py: preserve KDC-issued lifetime for diamond tickets (issue #2058) (#2181)
* preserve request-based ticket lifetime and add regression test

* tests: expand coverage for request-based ticket lifetime preservation

* Updated tests to comply with the code review

* Update examples/ticketer.py

* update description of the -duration parameter

---------

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
2026-05-01 00:56:43 -03:00
alexisbalbachan 3236169747 Fix TS_ALL_PROCESSES_INFO parsing for RpcWinStationGetAllProcesses (#2155)
* Fixed TS_ALL_PROCESSES_INFO parsing for RpcWinStationGetAllProcesses

* Removed ldap3 dependency, fixed mismatched data type for rawsid, added missing test

* Removed unused imports, renamed imagenamesize -> imagename to match docs. Added missing test
2026-04-30 11:56:58 -03:00
alexisbalbachan 426f354767 Fix large-page ESE tag-state parsing for Windows Server 2025 NTDS.dit (issue #1924) (#2158)
* Fix issue #1924 large-page tag count parsing

* Applied code review changes, added unit test

* improved code
added testcase

* Fix USER_PROPERTIES parsing per MS-SAMR spec

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-04-30 11:41:05 -03:00
Julien Egloff b58e72b689 Add dpapidump to impacket (#1917)
* Adding dpapidump to impacket

* Apply suggestions from code review

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>

* Update examples/dpapidump.py

* Update examples/dpapidump.py

* Update examples/dpapidump.py

* Update examples/dpapidump.py

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>

---------

Co-authored-by: laxa <laxa@ddracepro.net>
Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
2026-04-30 10:24:21 -03:00
Julien EGLOFF 3439d335a1 Modify ticketer and ccache logic (#2159)
* Modify ticketer and ccache logic

* ticketer now update existing ccache if KRB5CCNAME is specified
* ticketConverter now convert all TGS within the Kirbi or provided Ccache
* Fix a bug during the conversion from ccache to kirbi that does not correctly preserve ticket flags

* Update kirbi test cases. Improve Kirbi to Ccache conversion.
2026-04-29 17:13:05 -03:00
Julien EGLOFF 46e39eb35e Fix describe ticket (#2117)
* Fix describe ticket

* fix describeTicket credential indexing after skipped decrypts

  Use enumerate() when iterating ccache credentials so output keeps the
  correct credential index even when a ticket is skipped due to missing or
  invalid decryption material.

  Also update the Kerberoast debug message to report the ticket encrypted
  part etype, matching the value now used for the extraction decision.

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-04-27 17:36:33 -03:00
0xpaperman 4790a2f325 Added 'rget' command to smbclient.py (#2110)
* Add rget command for recursive file download

* rget no longer swallows listing or download failures. It now restores self.pwd with try/finally and lets real exceptions propagate, so partial recursive downloads don’t fail silently.
  The local path calculation now uses ntpath.relpath() from the starting remote directory instead of raw string replacement, which preserves nested paths like subdir/dir_backup/...
  correctly.

---------

Co-authored-by: TheFlamingCrab <96930137+TheFlamingCrab@users.noreply.github.com>
Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-04-24 19:18:21 -03:00
r3seh 8e0a44a46a fix confusion with name 'lastLogonTimesptamp' and the same field in AD (#1049)
Co-authored-by: r3seh <r3seh>
2026-04-24 16:53:34 -03:00
n3rada 383d016348 Fix WINRMS relay error handling and add NTLMv2 detection (#2163)
* fix(smbrelayserver): guard missing SMBClient and handle NTLM negotiate failures

* fix(winrmrelayclient): handle connection errors and detect NTLMv2 to abort futile relay

* fix(winrmrelayclient): update logging message

* Enhancing a bit the NTLMv2 detection - and clean up logging

* Clean up log

* Fixing wrong var name

---------

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
2026-04-24 14:51:03 -03:00
huh? 2f130643d4 raiseChild: fix PAC buffer preservation and add AES support for modern Windows (#2164)
* raiseChild: fix PAC buffer preservation and add AES support for modern Windows

Two bugs fixed:

1. makeGolden() hardcoded exactly 4 PAC buffers, discarding all others.
   Windows Server 2022 with CVE-2021-42287 patches requires PAC_REQUESTOR
   (type 18) to be present. Stripping it causes KDC_ERR_TGT_REVOKED.
   Fix: preserve all original PAC buffers, only update modified ones.

2. getKerberosTGT() called with aesKey=None hardcoded, ignoring -aesKey.
   Fix: pass aesKey, try AES first then fall back to RC4.

Additional improvements:
- Auto-retry golden ticket with AES if RC4 is rejected by KDC
- Fix signature zeroing to use actual length instead of hardcoded 12/16
- Updated help text with AES key usage examples

Tested against Windows Server 2022 Build 20348. Backward compatible.

* krb5: share PAC rebuild and signing helpers

* krb5: share AES ticket key selection helpers

* Fix password fallback suppression and TGT re-acquisition on golden ticket retry

* raiseChild: fix credential retry flow

* raiseChild: pass normalized AES key to target exec login

---------

Co-authored-by: plur1bu5 <plur1bu5@users.noreply.github.com>
Co-authored-by: Gabi Gonzalez <gabriel.gonzalez@fortra.com>
Co-authored-by: Your Name <you@example.com>
2026-04-24 10:30:19 -03:00
alexisbalbachan a4bdf59796 Fix SCMR failure actions marshaling and add regression test (Issue #2046) (#2160)
* Fix SCMR failure actions marshaling and add regression test

* Update tests/dcerpc/test_scmr.py

Applied Code review suggestions to the test

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Applied code review suggestion

* Update impacket/dcerpc/v5/scmr.py

set lpsaActions to NULL by default

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>

* Update tests/dcerpc/test_scmr.py

Added regression test

Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
2026-04-23 10:22:56 -03:00
maple 06fd05dca4 smbclient: shares list shows type and comments (#2156) 2026-04-23 02:18:20 -03:00
i-am-not-an-ai c64818ca5a Support multibyte template names for AD CS (#2127) 2026-04-22 04:32:20 -03:00
Ashok Chand c9456e9543 Update owneredit.py DN search. (#2162)
* Update owneredit.py DN search.

Update DN search. Currently DN lookup is from root partition only.

* Update owneredit.py

looked up owner DN update. previously typo mistake.
2026-04-21 10:02:08 -03:00
Chris Thompson 43fe4ce7cb Add TDS 8.0 (Force Strict Encryption MSSQL Server setting) support to ntlmrelayx (#2122)
* Add support for TDS 8.0 when Force Strict Encryption = Yes

* Match log syntax

* Only use TDS 8.0 if Force Strict Encryption is set to Yes

* Add comments back and fix typos

* Use short timeout, remove excessive debug logs, add comments

* Testing changes to make TDS more broadly applicable by moving to tds.py

* Add TLS 1.2 cap and EPA channel binding for TDS 8.0

* Fix TDS 8.0 DONE parsing and TLS state handling

* Use negotiated TDS version for DONE rowcount parsing

* Align strict TDS login with modern LOGIN7 flow

* Keep relay TLS socket for strict TDS sessions

* Reassemble relay TDS packets over TLS

* tds: stop advertising UTF-8 support

* tds: fix relay login failure token packing

* mssqlrelay: fix PRELOGIN thread id encoding

* tds: preserve default LOGIN7 version in serializer

* tds: only retry strict fallback on connection close

* ntlmrelayx: support strict MSSQL SOCKS reuse

* Reassemble TDS frames on TLS-backed MSSQL reads

---------

Co-authored-by: Gabi Gonzalez <gabriel.gonzalez@fortra.com>
2026-04-21 09:33:52 -03:00
Roman Karwacik 9afc09b933 Several ntlmrelayx SMBv1 server fixes (#2129)
* ntlmrelayx smbrelayserver (SMBv1): Fix relayToHost variable

* ntlmrelayx smbrelayserver (SMBv1): Fix infinite loop if multirelay is disabled

* ntlmrelayx smbrelayserver (SMBv1): Do not set NativeOS/NativeLanMan
2026-04-20 12:33:56 -03:00
Julien EGLOFF 5c68193080 Add timestamp to SAM parsing (#2142)
* Add timestamp to SAM parsing

* Make SAM output consistent with NTDS output when using -pwd-last-set
2026-04-16 16:33:15 -03:00
7own 7fc084ad19 Add enable_rpc/disable_rpc commands to mssqlshell (#2134)
Add shell commands to enable and disable the 'rpc out' option for
linked SQL servers via sp_serveroption. This allows executing stored
procedures remotely on linked servers directly from the SQL shell.
2026-04-07 17:23:53 -03:00
Deft_ 76ee87746d Custom fake CBT flag for MSSQLClient via TDS.py (#2098)
* Add fake CBT value for NXC

* Add fake CBT value for NXC

* Add checkMSSQLstatus.py

* Fixed required modifications

---------

Co-authored-by: Aurélien CHALOT <aurelien.chalot@orangecyberdefense.com>
2026-03-26 15:08:34 -03:00
ctjf 8f8172055c fix connection issue when Smb2DialectMin is SMB311 on target SMB server (#2085) 2026-03-26 11:27:30 -03:00
Alex d400a6aa6a Add RegisterRemoteSubscription and RemoteSubscriptionNext RPC calls (#2152)
* Add RegisterRemoteSubscription and RemoteSubscriptionNext RPC calls

* added testcases for EvtRpcRegisterRemoteSubscription and EvtRpcRemoteSubscriptionNext

* Remove redundant init definition

* Remove item definitions

* Use spec conform handle

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-03-20 09:37:55 -03:00
mollysec 2c77435e4f Update secretsdump.py (#2154)
It was missing a 'to' as far as I see. Refined the help message.
2026-03-18 21:59:53 -03:00
alexisbalbachan 084aff60df ntlmrelayx: NTLM SEAL flag drop paths for CVE-2025-33073 and --remove-mic (#2133)
* Added remove_sign_seal flag, drop seal flag when remove mic

* moved seal flag removal from sendauth/remove-mic and into sendauth/remove-sign-seal

* Added missing token regeneration after removing seal
2026-03-13 15:41:48 -03:00
alexisbalbachan dabf7fd2f2 Assorted fixes for NTLM AV_PAIRS container protocol and ImpactPacket LinuxSLL/IP (#2092, #2093, #2094) (#2137)
* Added fixes and tests for #2092, #2093, and #2094

* do not use interal __iter__ interface for av_pairs tests

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-03-13 10:52:52 -03:00
Croumi a93ee769f8 Fix offline mode missing machine account and Kerberos keys in secretsdump.py (#2135)
When running secretsdump.py in offline mode (with -sam/-security/-system flags),
the $MACHINE.ACC secret was dumped as raw hex instead of showing the machine
account NTLM hash and Kerberos keys. This was because the machine name, domain,
and Kerberos salt were only retrieved via remoteOps (available in online mode).

Add __getMachineKerberosSaltOffline() to derive the Kerberos salt from the
SECURITY hive by reading Policy\PolDnDDN (domain FQDN) and Policy\PolAcDmN
(machine NetBIOS name), which are stored as LSA_UNICODE_STRING structures.
Use the same salt to resolve the machine name and domain for the NTLM hash
printout. This brings offline mode output to parity with online mode.

Co-authored-by: Croumi <Croumi>
2026-03-13 02:19:33 -03:00
Herbenderbler 256749185f BUG2095: Fixed fragment_by_list() crash when the child protocol is None (#2136)
* Fixed fragment_by_list() crash when child protocol is None

* removed the inline

* Added a regression test for IP.fragment_by_list() with Data payload

---------

Co-authored-by: herbenderbler <herbenderbler@users.noreply.github.com>
2026-03-12 11:30:26 -03:00
Gabriel Gonzalez 8c155a5b49 Add comprehensive unit tests for krb5.gssapi token parsing, factory selection, RC4/AES helpers, and wrap/MIC paths (#2138) 2026-03-06 16:53:46 -03:00
aconite33 b2b85c2c96 Fix BER short-form length parsing in MechIndepToken.get_length() (#2130)
get_length() handles two BER definite-length forms:
- Short form (< 128): length is a single byte
- Long form (>= 128): length spans multiple bytes

The long form correctly advances past the length bytes by returning
data[1+bytes_count:], but the short form returned data without
advancing past the length byte. This caused a misalignment in the
parsed mechanism token data, shifting all subsequent field offsets
and producing garbage when unwrapping GSS tokens with inner lengths
below 128 bytes.

Fix: return data[1:] in the short form path, matching the long form
behavior of advancing past the length encoding.
2026-03-06 15:59:01 -03:00
Roman Karwacik 819dcd5656 smbrelayserver.py: Dont advertise support for NEGOEX (#2111)
* smbrelayserver.py: Dont advertise support for NEGOEX

* ntlmrelayx: Remove more unsupported NEGOEX
2026-03-06 15:44:34 -03:00
masterDeus d362ca74e9 Modified reg-key creation to assume persistent key creation with impacket-reg (#2113)
* Added flag functionality to specify that a created registry key should be volatile, and changed the default behavior to instead create non-volatile keys

* Reverted to default behavior and clarified description

- Reverted default behavior back to volatile keys
- Changed --volatile flag to --persistent
- Moved flag verification to subkey creation section
- Added printed warning that key is volatile if --permanent is not set (only in subkey creation)
- Clarified flag description.
2026-03-05 11:07:03 -03:00
alexisbalbachan 9f2bf6b58c Ntfs read fixes (#2106)
* Fixed files not being listed when in INDEX_ROOT

* Added support for sparse files

* Fix double VNC shift, causing incorrect reads.
handle walk() returning None
null checks in do_cat
error handling in getINode
general refactor

* added tests for ntfs-read

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-03-05 10:42:52 -03:00
AndreySolod 9d3d86ea30 Fix WinRM NTLM Relay Issue (#2089)
* Fix WinRM NTLM Relay Issue

* Removed negotiate seal changes

---------

Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
2026-02-26 03:15:12 -03:00
Packet Phantom 8728bbcfee Implement PutClass and DeleteClass for WMI (#1803)
* add wmi ObjectFlags to improve human-readability

* Fix handling of empty buffer in CLASS_AND_METHODS_PART to prevent errors

* implement PutClass and DeleteClass functions in wmi

* bugfix: replace CIM_CLASS with CIM_INSTANCE

* unittest: add test cases for PutClass and DeleteClass

* improved wmi testcases

* Fix PutClass
  - Preserve existing class properties (ndTable, valueTable, name ref)
    when updating a class via PutClass
  - Use correct propIndex (existingCount + i) for DeclarationOrder
    and ndTable bit offsets on newly added properties

* uncommented failing case

---------

Co-authored-by: Kali <adrian.manrique@gmail.com>
2026-02-19 10:45:42 -03:00
Gaffner d029698149 smbclient ACL Support (#1240)
* Added smbcacls

* Changed example script

* improve ACL manage

* improve acl manage

* improved acl

* Closing all handles

* fixed directory and handle is open bug in acl.py

* Changed help a little bit

* Ignore from empty ACL

* fix indentation

* removee example to different PR

---------

Co-authored-by: john57 <your_email_address@example.com>
2026-02-18 00:42:34 -03:00
Adham Elmosalamy 8cb82c0fdf feat: added --base64 option to ticketConverter (#2104)
* feat: added --base64 option to ticketConverter

* Cleanup manually to avoid issues with Windows delete permissions
2026-02-09 18:01:51 -03:00