> 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/linux-easy/greenhorn-hackthebox-writeup.md).

# شرح Greenhorn HackTheBox

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

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

* اكتشاف كلمات المرور المضمنة في مستودعات Git
* كلمات مرور SHA-512 غير مُجزأة
* استغلال Pluck
* فك تشفير كلمات المرور المبكسلة (باستخدام DEPIX)
  {% endhint %}

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

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

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

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

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

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

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

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

قم بحصر المنافذ المفتوحة وتصدير النتائج إلى الملف "allPorts" في دليل Nmap:

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

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

**تحليل المنافذ المفتوحة باستخدام extractPorts:**

استخدم دالة extractPorts لعرض المنافذ المفتوحة بصيغة مختصرة ونسخها إلى الحافظة (22,80,3000)

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

**فحص إصدارات المنافذ باستخدام Nmap:**

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

```bash
nmap -sCV -p80,22,3000 10.10.11.25 -oN targeted
```

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

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

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

### **اكتشاف كلمة المرور:**

على المنفذ 3000 نجد خدمة مكشوفة شبيهة بـ Git، مشابهة لـ GitHub، لكنها مخصصة للاستخدام الداخلي في الشركة

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

ننتقل إلى إنشاء حساب

<figure><img src="/files/6719c0c4c278f5e739e1cd0bc51fc14b183ab753" alt=""><figcaption></figcaption></figure>

من بين ملفات المشروع نجد ملفًا يحتوي على كلمة مرور في "`pass.php`":

<figure><img src="/files/337bf206de876975b8a377c835f19039c0404450" alt=""><figcaption></figcaption></figure>

```
d5443aef1b64544f3685bf112f6c405218c573c7279a831b1fe9612e3a4d770486743c5580556c0d838b51749de15530f87fb793afdcc689b6b39024d7790163
```

<figure><img src="/files/65ad733ba3fcd81a9c895b97b0c3e3beb76d0aa1" alt=""><figcaption></figcaption></figure>

هذه القيمة المجزأة هي SHA512. بعد فك التشفير، نحصل على كلمة المرور **`iloveyou1`**.

{% embed url="<https://10015.io/tools/sha512-encrypt-decrypt>" %}

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

## ثغرة Pluck CMS

على المنفذ 80 نجد خدمة ويب Pluck.

<figure><img src="/files/5542eb2d698d4300b628918b32360485d39434a5" alt=""><figcaption></figcaption></figure>

الـ `login.php` يتطلب الملف كلمة مرور للوصول إلى واجهة المدير.

<figure><img src="/files/91a574ef985503495abdae6f8f43a9c3db5229a9" alt=""><figcaption></figcaption></figure>

يحتوي مدير المحتوى على إصدار `4.7.18`، قابل لتنفيذ التعليمات البرمجية عن بُعد (RCE).

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

{% embed url="<https://github.com/Rai2en/CVE-2023-50564_Pluck-v4.7.18_PoC>" %}

### مرحلة الاستغلال:

1. استنسخ المستودع الذي يحتوي على سكربت الاستغلال:

```bash
git clone https://github.com/Rai2en/CVE-2023-50564_Pluck-v4.7.18_PoC.git
cd CVE-2023-50564_Pluck-v4.7.18_PoC
```

2. نعدّل `poc.py` السكربت بعنوان IP الخاص بالخادم وكلمة المرور "*iloveyou1*".

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

2. بعد ذلك، أنشئ `payload.zip` ملفًا يحتوي على الحمولة الخبيثة، مع ضبط حقلي `<your_ip>` والمنفذ ليتوافقا مع المستمع لدينا.

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

<figure><img src="/files/d79d2982d9be56f31f00f5c8f3af2cf24943f3e1" alt="" width="512"><figcaption></figcaption></figure>

5. نشغّل سكربت الاستغلال:

```bash
python poc.py

/home/jordan/......./payload.zip
```

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

وفي الوقت نفسه، نفتح جلسة استماع على المنفذ `4444` باستخدام Netcat ونحصل على وصول إلى الخادم كمستخدم `www-data`.

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

من خلال فحص `/etc/passwd` الملف، نكتشف المستخدم "junior". ننجح في الاتصال باستخدام كلمة المرور **iloveyou1**:

<figure><img src="/files/69a170e8c407f8c8e219f460fdeee132cc8ba069" alt=""><figcaption></figcaption></figure>

### تم الحصول على علم user.txt:

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

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

1. نحدّد موقع ملف PDF: `باستخدام OpenVAS.pdf`.
2. انقل الملف باستخدام Python 3 عبر تشغيل:

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

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

3. نقوم بتنزيل ملف PDF باستخدام الأمر التالي:

<pre class="language-bash"><code class="lang-bash"><strong>wget http://10.10.11.25:1234/Using%20OpenVAS.pdf
</strong></code></pre>

<figure><img src="/files/486c782a36aff62d5a1437c1dbb34b35482b8bbd" alt=""><figcaption></figcaption></figure>

عند فتح هذا الملف، نكتشف كلمة المرور المشوّهة بالبكسل لحساب المدير

<figure><img src="/files/54a3d8f234116ea374ad3aa542f1e12c86f898f1" alt=""><figcaption></figcaption></figure>

### فك تشفير كلمة المرور:

لكسر كلمة المرور المخفية، نستخدم برنامج Depix:

{% embed url="<https://github.com/spipm/Depix>" %}

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

```bash
git clone https://github.com/spipm/Depix
cd Depix
```

بعد ذلك، ننفذ الأمر:

```bash
python3 depix.py /
    -p pixel.png /
    -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced.png /
    -o /home/jordan/Desktop/password.png
```

<figure><img src="/files/10a859933002bf9e33a71e6f39078675d6de33d5" alt=""><figcaption></figcaption></figure>

كلمة المرور المفكوكة هي:

<figure><img src="/files/476bcc327650e5b13fccafef20c584867faaefbf" alt=""><figcaption></figcaption></figure>

`sidefromsidetheothersidesidefromsidetheotherside`

نسجّل الدخول كمستخدم root باستخدام هذه كلمة المرور.

<figure><img src="/files/dc159fa786fc811081f2ae2c573360649333444d" alt="" width="554"><figcaption></figcaption></figure>

### فلاغ الجذر :)

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

<figure><img src="/files/360c0afc0d815ed1382997be74979f55005a9e4c" 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/linux-easy/greenhorn-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.
