x11-unauth-access: x11 - Unauthenticated Access

2025-08-01 x11 PoC Public

Description

To check if you can connect to a remote X server, send an X11 initial connection request to TCP port 6000+n (where n is the display number). The response success byte (0x00 or 0x01) indicates if you are allowed; if successful, the script will display "X server access is granted," confirming that an attacker can connect to the X server

PoC

id: x11-unauth-access

info:
  name: x11 - Unauthenticated Access
  author: pussycat0x
  severity: high
  description: |
    To check if you can connect to a remote X server, send an X11 initial connection request to TCP port 6000+n (where n is the display number). The response success byte (0x00 or 0x01) indicates if you are allowed; if successful, the script will display "X server access is granted," confirming that an attacker can connect to the X server
  reference:
    - https://nmap.org/nsedoc/scripts/x11-access.html
    - https://book.hacktricks.xyz/network-services-pentesting/6000-pentesting-x11
    - https://www.hackingarticles.in/penetration-testing-on-x11-server/
  metadata:
    shodan-query: "Open X Server:"
    verified: true
    max-request: 1
  tags: x11,network,js,remote,unauth,vuln

javascript:
  - pre-condition: |
      isPortOpen(Host,Port);
    code: |
      let packet = bytes.NewBuffer();
      const c = require("nuclei/net");
      const cmd = "l\u0000\u000b\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
      packet.WriteString(cmd)
      let conn = c.Open('tcp', `${Host}:${Port}`);
      conn.SendHex(packet.Hex());
      const result = conn.RecvFull();

      let accessGranted;

      if (result.length >= 8 && result[0] === 1 ) {
      accessGranted = "x11 Unauth Access - Detected";
        } else {
          conn.Close();
        }

      accessGranted

    args:
      Host: "{{Host}}"
      Port: 6000

    extractors:
      - type: dsl
        dsl:
          - response
# digest: 4a0a004730450220225f1b40240d73e25a41e9f86a54617a0a71ba44b300c24e7a6afcbaee7cb75d022100d50c9300365239a89c43aed2124d274883e678d5e53a2b8260b189c240112163:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities