Add example kernel exploit skeleton
This commit is contained in:
		
							
								
								
									
										12
									
								
								examples/kernel-exploit/.out-of-tree.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								examples/kernel-exploit/.out-of-tree.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
# out-of-tree configuration file
 | 
			
		||||
# docs at https://out-of-tree.io
 | 
			
		||||
name = "out-of-tree exploit example"
 | 
			
		||||
type = "exploit"
 | 
			
		||||
 | 
			
		||||
[[supported_kernels]]
 | 
			
		||||
# Can be Ubuntu/CentOS/Debian/etc.
 | 
			
		||||
distro_type = "Ubuntu"
 | 
			
		||||
# regex for `uname -r`
 | 
			
		||||
# See also: regex-golang.appspot.com
 | 
			
		||||
# stupid way to generate: $ echo '4.4.0-('$(seq 44 | xargs echo | sed 's/ /|/g')')-.*'
 | 
			
		||||
release_mask = "4.4.0-(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)-.*"
 | 
			
		||||
							
								
								
									
										8
									
								
								examples/kernel-exploit/CVE-2016-5195.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								examples/kernel-exploit/CVE-2016-5195.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO http://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2016-5195 */
 | 
			
		||||
	return EXIT_FAILURE;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								examples/kernel-exploit/CVE-2016-5195_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								examples/kernel-exploit/CVE-2016-5195_test.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO run exploit and create file with it */
 | 
			
		||||
	return EXIT_FAILURE;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								examples/kernel-exploit/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								examples/kernel-exploit/Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
# out-of-tree called make with four arguments:
 | 
			
		||||
# - KERNEL: kernel headers path
 | 
			
		||||
# - TARGET_EXPLOIT: name of exploit binary that MUST be produced by makefile.
 | 
			
		||||
# - TARGET_TEST: name of test binary that MUST be produced by makefile
 | 
			
		||||
# and it's will be runned on a LPE stage. TARGET_TEST MUST accept two argument:
 | 
			
		||||
#   - Path to exploit binary
 | 
			
		||||
#   - File that MUST be created with exploit. It uses for test that exploit works
 | 
			
		||||
#     correctly.
 | 
			
		||||
# - VMLINUZ: path to vmlinuz
 | 
			
		||||
#
 | 
			
		||||
# e.g.:
 | 
			
		||||
#    make KERNEL=/lib/modules/4.8.0-58-generic/build \
 | 
			
		||||
#         TARGET_EXPLOIT=nyan-exploit \
 | 
			
		||||
#         TARGET_TEST=nyan-exploit-test
 | 
			
		||||
#         VMLINUZ=/boot/vmlinuz-4.8.0-58-generic
 | 
			
		||||
 | 
			
		||||
TARGET := CVE-2016-5195
 | 
			
		||||
TARGET_TEST := CVE-2016-5195_test
 | 
			
		||||
 | 
			
		||||
all:
 | 
			
		||||
	gcc CVE-2016-5195.c -o $(TARGET_EXPLOIT)
 | 
			
		||||
	gcc CVE-2016-5195_test.c -o $(TARGET_TEST)
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f $(TARGET_EXPLOIT)
 | 
			
		||||
	rm -f $(TARGET_TEST)
 | 
			
		||||
							
								
								
									
										5
									
								
								examples/kernel-exploit/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								examples/kernel-exploit/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
# out-of-tree kernel exploit example
 | 
			
		||||
 | 
			
		||||
Implements CVE-2016-5195 and tests for it.
 | 
			
		||||
 | 
			
		||||
See .out-of-tree.toml
 | 
			
		||||
		Reference in New Issue
	
	Block a user