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>] [day] [month] [year] [list]
Message-ID: <MWHPR2201MB1072D842B011C3880193765AD0409@MWHPR2201MB1072.namprd22.prod.outlook.com>
Date:   Wed, 28 Apr 2021 09:53:00 +0000
From:   "Liu, Congyu" <liu3101@...due.edu>
To:     "avem@...emloft.net" <avem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: PROBLEM: potential information leakage in /proc/net/ptype

Title: PROBLEM: potential information leakage in /proc/net/ptype

Hi,

When a process in network namespace A creates a packet socket without binding to any interface, a process in network namespace B can observe the a `packet_rcv` entry being registered by reading /proc/net/ptype, thus it can infer information about the processes in namespace A.

By looking at the code, it looks like hook function `packet_rcv` is namespace aware and only works in one net namespace: it only intercepts packets from the devices inside the network namespace where the packet socket is created. However, the `packet_recv` ptype entry can be seen in all namespaces via /proc/net/ptype. Though minor, this looks like an information leakage.

/proc/net/ptype seems to be the root cause: it does not filter those ptype entries that do not bind to any interface. But I have also noticed that there were efforts to prevent /proc/net/ptype from leaking net namespace information, e.g. commit 2feb27d. So I am wondering if this problem is an information leakage bug or deliberate by design? If the latter, what is the reasoning for this?

Thanks for your time and patience!


Thanks,
Congyu Liu


Code:
#define _GNU_SOURCE
#include <sched.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \
                            } while (0)
int main() {
    char x;
    int pipe_fd[2];
    if (pipe(pipe_fd) < 0) {
        errExit("pipe");
    }
    int pid = fork();
    if (pid < 0) {
        errExit("fork");
    }
    if (pid == 0) {
        close(pipe_fd[1]);
        unshare(CLONE_NEWNET);
        if (read(pipe_fd[0], &x, 1) < 0) {
            errExit("read d");
        }
        system("cat /proc/net/ptype");
        return 0;
    }
    close(pipe_fd[0]);
    unshare(CLONE_NEWNET);
    socket(AF_PACKET, SOCK_RAW, 768);
    if (write(pipe_fd[1], &x, 1) < 0) {
        errExit("write");
    }
    wait(NULL);
    return 0;
}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ