首页
论坛
课程
招聘
[求助]复现Android漏洞过程中的一些问题
2021-5-17 11:21 1680

[求助]复现Android漏洞过程中的一些问题

2021-5-17 11:21
1680

以下是我在复现一些Android漏洞过程中遇到的问题,希望有大佬能帮我解答一下疑惑(抱拳)。
1.请问如何在Android Emulator(AS上的)上安装打漏洞补丁之前的Android系统?都需要自己编译吗?有没有现成的?

我在复现Janus漏洞和CVE-2020-0108的时候发现这两漏洞都被patch了,没法在现有的Android Emulator上复现成功。

 

2.不知道有没有大佬复现 Android内核漏洞 CVE-2019-2215 的时候用过这个POC:https://github.com/cloudfuzz/android-kernel-exploitation。

 

我按照上面的过程,用 KASan 去 build Android内核的时候,报如下错误,我大概看懂它啥意思,就是使用的配置文件(添加了KASan选项)和内核源码自带的配置文件不一样?但是我不知道怎么解决(捂脸)。

P.S. 使用的操作系统为 Kali 2019.4

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
root@kali:~/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev# BUILD_CONFIG=../build-configs/goldfish.x86_64.kasan build/build.sh -v
= Set default KERNEL_DIR: /root/android-kernel-exploit/android-kernel-exploitation/build-configs
= The final value for KERNEL_DIR: goldfish
========================================================
= build config: /root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/../build-configs/goldfish.x86_64.kasan
ARCH=x86_64
BRANCH=kasan
 
CC=clang
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r377782b/bin
BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
CLANG_TRIPLE=x86_64-linux-gnu-
CROSS_COMPILE=x86_64-linux-androidkernel-
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
 
KERNEL_DIR=goldfish
EXTRA_CMDS=''
STOP_SHIP_TRACEPRINTK=1
 
FILES="
arch/x86/boot/bzImage
vmlinux
System.map
"
 
DEFCONFIG=x86_64_ranchu_defconfig
POST_DEFCONFIG_CMDS="check_defconfig && update_kasan_config"
 
function update_kasan_config() {
    ${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \
         -e CONFIG_KASAN \
         -e CONFIG_KASAN_INLINE \
         -e CONFIG_TEST_KASAN \
         -e CONFIG_KCOV \
         -e CONFIG_SLUB \
         -e CONFIG_SLUB_DEBUG \
         -e CONFIG_SLUB_DEBUG_ON \
         -d CONFIG_SLUB_DEBUG_PANIC_ON \
         -d CONFIG_KASAN_OUTLINE \
         -d CONFIG_KERNEL_LZ4 \
         -d CONFIG_RANDOMIZE_BASE
    (cd ${OUT_DIR} && \
     make O=${OUT_DIR} $archsubarch CROSS_COMPILE=${CROSS_COMPILE} olddefconfig)
}
 
PATH=/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/build/build-tools/path/linux-x86:/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/prebuilts-master/clang/host/linux-x86/clang-r377782b/bin:/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
========================================================
 Setting up for build
+ cd goldfish
+ make CC=clang HOSTCC=clang O=/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish -v mrproper
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
+ set +x
+ cd goldfish
+ make CC=clang HOSTCC=clang O=/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish -v x86_64_ranchu_defconfig
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
+ set +x
========================================================
 Running pre-make command(s):
+ eval check_defconfig '&&' update_kasan_config
++ check_defconfig
++ cd /root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish
++ make CC=clang HOSTCC=clang O=/root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish savedefconfig
  GEN     ./Makefile
scripts/kconfig/conf  --savedefconfig=defconfig Kconfig
++ '[' x86_64 = x86_64 -o x86_64 = i386 ']'
++ local ARCH=x86
++ echo Verifying that savedefconfig matches goldfish/arch/x86/configs/x86_64_ranchu_defconfig
Verifying that savedefconfig matches goldfish/arch/x86/configs/x86_64_ranchu_defconfig
++ RES=0
++ diff -u goldfish/arch/x86/configs/x86_64_ranchu_defconfig /root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish/defconfig
--- goldfish/arch/x86/configs/x86_64_ranchu_defconfig   2021-05-09 07:09:16.014245412 +0000
+++ /root/android-kernel-exploit/android-kernel-exploitation/android-4.14-dev/out/kasan/goldfish/defconfig      2021-05-09 08:19:18.426351652 +0000
@@ -60,6 +60,7 @@
 # CONFIG_MTRR is not set
 CONFIG_HZ_100=y
 CONFIG_PHYSICAL_START=0x100000
+# CONFIG_RANDOMIZE_BASE is not set
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="nopti"
 CONFIG_PM_WAKELOCKS=y
@@ -451,7 +452,12 @@
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_SLUB_DEBUG_ON=y
 CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_KASAN=y
+CONFIG_KASAN_INLINE=y
+CONFIG_TEST_KASAN=m
+CONFIG_KCOV=y
 CONFIG_HARDLOCKUP_DETECTOR=y
 CONFIG_PANIC_TIMEOUT=5
 CONFIG_SCHEDSTATS=y
++ RES=1
++ '[' 1 -ne 0 ']'
++ echo ERROR: savedefconfig does not match goldfish/arch/x86/configs/x86_64_ranchu_defconfig
ERROR: savedefconfig does not match goldfish/arch/x86/configs/x86_64_ranchu_defconfig
++ return 1

3.如何修改Android Emulator(AS上的)的网络配置,使得其和PC主机在同一个局域网?

复现ES文件浏览器开放端口漏洞的时候遇到的,查了网上一些资料,还是不知道咋解决。
P.S. 有要求要在Linux上复现,所以只能用AS上的Android Emulator了,AnBox能用吗?正准备去试试。很奇怪为啥好多模拟器都没Linux版呢?


第五届安全开发者峰会(SDC 2021)10月23日上海召开!限时2.5折门票(含自助午餐1份)

最后于 2021-5-17 14:46 被直木编辑 ,原因:
收藏
点赞0
打赏
分享
最新回复 (1)
雪    币: 9209
活跃值: 活跃值 (4303)
能力值: ( LV9,RANK:270 )
在线值:
发帖
回帖
粉丝
直木 活跃值 4 2021-5-24 22:42
2
0

问题2解决:在仓库里建了一个issue,作者让我尝试更改build的配置文件,将POST_DEFCONFIG_CMDS="check_defconfig && update_kasan_config" 改为 POST_DEFCONFIG_CMDS="update_kasan_config",我尝试这样做了,但是又有新的错误……
然后,我放弃了。又突然想到作者使用ubuntu编译的,又想到google也是推荐Ubuntu去编译aosp。所以……我换用Ubuntu 18.04 虚拟机去编译内核就成功了,啥问题都没有!

最后于 2021-5-24 22:42 被直木编辑 ,原因:
游客
登录 | 注册 方可回帖
返回