KSalup 1.0.2 : bad address binding

From: _kiss_@guay.com
Date: 01/20/02


Date: Sun, 20 Jan 2002 01:51:01 +0100 (CET)
From: _kiss_@guay.com
To: vuln-dev@securityfocus.com



KSalup is an enhanced port of Winpopup for KDE. It also allows
the user to send and receive Winpopup messages over a local network (LAN).

it does address binding in a very dangerous way:

(from main.cpp)

i=gethostname(hostname, sizeof(hostname)-1);

[...]

host=gethostbyname(hostname);

[...]

myip=*(uint32_t*)(host->h_addr_list[0]);

[...]

i=setsockopt(sock[2], SOL_SOCKET, SO_REUSEADDR, &b, l);

[...]

sin.sin_family=AF_INET;
        sin.sin_port=htons(138);
        sin.sin_addr.s_addr=myip;

i=::bind(sock[2], (struct sockaddr*)&sin, sizeof(struct sockaddr_in));

if a socket is bound to the wildcard address (0.0.0.0) on KSalup's port, it will capture datagrams originally intended to reach KSalup's socket.

this programming error doesn't seem to be exploitable to me, since the socket we are talking about uses port 138, which is a privileged port and can only be bounded by root.

anyways, fix should be considered. it just takes to bind also the wildcard address during socket initialization.

      Rafael San Miguel Carrasco
      (_kiss_)
      rsanmcar@alum.uax.es



Relevant Pages

  • Re: Problem with socket
    ... Be aware that those port numbers are part of the IANA-assigned range. ... socket operations on sockets for which there are no handles... ... The result of using comma lists is ... you have used the completely meaningless word "crash" to describe your ...
    (microsoft.public.vc.mfc)
  • RE: call is blocked in recvfrom() and no further proceedings in Win CE
    ... In windows CE, I'm able to send a request but I'm unable to receive it. ... Create another socket & bind with server IP address. ... > My program has to send request to service through port 5070(in this port only ...
    (microsoft.public.windowsce.embedded)
  • Re: ISA Event
    ... applying ISA SP1 resolved the issue. ... So it's worth asking - is this SBS ... > Web Proxy service failed to bind its socket to 192.168.4.9 port 443. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: ntpd and network sockets
    ... I presume where it says wildcard port it really ... colons in their names are IIRC "logical" interfaces and not virtual ... small" and then blythly ignore the socket entirely. ...
    (comp.protocols.time.ntp)
  • Re: Freebsd IP Forwarding performance (question, and some info) [7-stable, current, em, smp]
    ... INADDR_ANY and a specific port. ... sendtoon a specific address and port on a socket that has been bound to ... bogus exit code) and adds a sleep after send failure. ... unless HZ is too small or the queue is too large. ...
    (freebsd-net)