Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

Re: question about x11 forwarding in ssh

Subject: Re: question about x11 forwarding in ssh
Date: Thu, 22 Sep 2005 18:28:41 +1000
Andre Charbonneau wrote:
But my question is: How does the SSH client (openSSH for example)
forwards x11 when port 6000 is not open???  Does it use another, special
port that it can connect to?

The listening is done on the SSH server, at the request of the client.

In OpenSSH, the server normally starts at a port greater than 6000
(6010, but it's controlled by the X11DisplayOffset keyword in
sshd_config(5)) and tries to bind to the port, incrementing the port by
one until the bind succeeds.  Once it knows the port, it sets the
$DISPLAY variable to the value corresponding to the port it bound to (eg
for port 6010, $DISPLAY is localhost:10 [1] and so on) and adds the
xauth "cookie" to the .Xauthority file corresponding to that $DISPLAY.

The X11 client looks up $DISPLAY in its environment and the xauth cookie
to that $DISPLAY in the .Xauthority file, then connects to localhost
and, hopefully, the connection is forwarded to your X server.

Is there a document online that I can read that explains in details how
ssh does the x11 forwarding?

Not that I know of.  If it helps, you can think of it as a special case
of remote TCP port forwarding with the addition of the xauth authentication.

[1] Actually, sometimes it doesn't use localhost but it doesn't matter
for the purposes of this discussion.  See X11UseLocalhost in sshd_config(5).

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

<Prev in Thread] Current Thread [Next in Thread>