lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTScg4SS5b=p=TsTU7p3MMqMXVxvetaJ9hVPJcen4rcS7Fw@mail.gmail.com>
Date:	Tue, 23 Jun 2015 16:23:57 -0400
From:	Willem de Bruijn <willemb@...gle.com>
To:	Julian Anastasov <ja@....bg>
Cc:	David Miller <davem@...emloft.net>,
	Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH net] ip: report the original address of ICMP messages

On Tue, Jun 23, 2015 at 4:06 PM, Julian Anastasov <ja@....bg> wrote:
>
>         Hello,
>
> On Tue, 23 Jun 2015, Willem de Bruijn wrote:
>
>> >         It is using IP_RECVERR and may be relying only on
>> > original address returned in msg_name from MSG_ERRQUEUE.
>>
>> It's not very important, in that even if ping does not use this
>> msg_name, another tool very well might. But from ping.c in that
>> srpm:
>>
>>         res = recvmsg(icmp_sock, &msg, MSG_ERRQUEUE|MSG_DONTWAIT);
>> ...
>>         e = NULL;
>>         for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
>>                 if (cmsg->cmsg_level == SOL_IP) {
>>                         if (cmsg->cmsg_type == IP_RECVERR)
>>                                 e = (struct sock_extended_err *)CMSG_DATA(cmsg);
>>                 }
>>         }
>> ...
>>         } else if (e->ee_origin == SO_EE_ORIGIN_ICMP) {
>>                 struct sockaddr_in *sin = (struct sockaddr_in*)(e+1);
>> ...
>
>         It is used, it compares the embedded original address
> from error message here (msg.msg_name = (void*)&target):
>
>         target.sin_addr.s_addr != whereto.sin_addr.s_addr
>
> and it does not match because kernel failed to fill the
> msg_name buffer. In fact, kernel returns msg_namelen=0 but
> it is not checked here, so may be ping.c compares random memory.

That makes sense.

>
>>                         printf("From %s icmp_seq=%u ",
>> pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
>
>         What you are referring here is the offender address (sin),
> the sender of the ICMP error, it is just printed...
>
>
> Regards
>
> --
> Julian Anastasov <ja@....bg>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ