Exploit database

GH-9a497cc26994d431b276e9e3b7a8f75c

satheesh575555/linux-4.19.72_cve-2023-0386

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-0386

19 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

net/ipv4/bpfilter/sockopt.c

C · 1,110 bytes
// SPDX-License-Identifier: GPL-2.0
#include <linux/uaccess.h>
#include <linux/bpfilter.h>
#include <uapi/linux/bpf.h>
#include <linux/wait.h>
#include <linux/kmod.h>

int (*bpfilter_process_sockopt)(struct sock *sk, int optname,
				char __user *optval,
				unsigned int optlen, bool is_set);
EXPORT_SYMBOL_GPL(bpfilter_process_sockopt);

static int bpfilter_mbox_request(struct sock *sk, int optname,
				 char __user *optval,
				 unsigned int optlen, bool is_set)
{
	if (!bpfilter_process_sockopt) {
		int err = request_module("bpfilter");

		if (err)
			return err;
		if (!bpfilter_process_sockopt)
			return -ECHILD;
	}
	return bpfilter_process_sockopt(sk, optname, optval, optlen, is_set);
}

int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char __user *optval,
			    unsigned int optlen)
{
	return bpfilter_mbox_request(sk, optname, optval, optlen, true);
}

int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,
			    int __user *optlen)
{
	int len;

	if (get_user(len, optlen))
		return -EFAULT;

	return bpfilter_mbox_request(sk, optname, optval, len, false);
}