"possible hijacking of X11-forwarded connections" bug has not been fixed completely

Darren Tucker dtucker at zip.com.au
Thu May 15 22:08:15 EST 2008


On Thu, May 15, 2008 at 05:03:06PM +0800, ?????? wrote:
> 
> Hi OpenSSH team,
>  
> I am still able to reproduce this problem with openssh50 code both on hpux.
> Seems like OpenSSH didn't fix this problem completely.
>  
> how to reproduce:
[...]
> I found that this problem could only happen when the "X11UseLocalhost
> no" is set in the sshd_config.
>  
> I checked the code, found that there might be something wrong with the
> "channel_set_reuseaddr(sock);" function which is called in the function
> x11_create_display_inet in file channels.c

It looks like the semantics of SO_REUSEADDR are different between
platforms.  From what I can gather, SysV based systems don't prevent
processes with different uids from binding to the same port, whereas
BSD and Linux based systems do.

I'm also curious about why the loopback interface behaves differently.

If you comment out the call, what difference does it make?  It will
probably also prevent use of ports that are still in TIME_WAIT, so it
may reduce the number of ports available to sshd.

Index: channels.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/channels.c,v
retrieving revision 1.257
diff -u -p -r1.257 channels.c
--- channels.c	2 Apr 2008 21:43:57 -0000	1.257
+++ channels.c	15 May 2008 11:36:34 -0000
@@ -2901,7 +2901,7 @@ x11_create_display_inet(int x11_display_
 					error("setsockopt IPV6_V6ONLY: %.100s", strerror(errno));
 			}
 #endif
-			channel_set_reuseaddr(sock);
+			/* channel_set_reuseaddr(sock); */
 			if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
 				debug2("bind port %d: %.100s", port, strerror(errno));
 				close(sock);

-- 
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.


More information about the openssh-unix-dev mailing list