【Android: protecting the kernel】恢弘志士之气,不宜妄自菲薄。这篇文章主要讲述Android: protecting the kernel相关的知识,希望能为你提供帮助。
Linux内置安全机制
- Address space separation/process isolation
- unix permissions
- DAC capabilities
- SELinux
- seccomp
- namespaces
- …
- missing/incorrect bounds check
- null pointer defeference
- information leak
- missing permission check
- use after free
- race condition
- memory corruption(other)
- other
- integer overflow
- uninitialized data
- Hardened usercopy
- Protect against incorrect bounds checking in copy_*_user()
- PAN emulation
- Protect against kernel access to userspace bypassing hardened usercopy changes.
- Stack protector strong
- protects against stack buffer overflows
- KASLR (arm64 android-4.4 kernel)
- Makes code reuse attacks probabilistic
- PXN - make userspace non-executable for the kernel
- Protects against ret2user attacks
- RODATA - mark kernel memory as read-only/no-execute
- Makes code non-writeable, and data non-executable
- CONFIG_LSM_MMAP_MIN_ADDR
- Make null pointer dereference unexploitable (just crash)
- PAN emulation also make null pointer
- dereference non-exploitable
- 厂商如何提升驱动代码安全质量? Step2
- Compiler changes e.g. integer overflow checking(clang 3.5+与gcc 5.0+都有integer overflow 检测)
- Scripts e.g. checkpatch.pl (checkpatch.pl可执行质量和简单漏洞检测)
- Runtime changes - e.g. PAN enforce proper use of copy_*_user() (Privileged Access Never)
- KASAN (内存错误检测)
- Constification (const声明)
利用缓解 - 减少攻击面(Linux权限模型,与SEAndroid策略配置)Setp1
- Restrict access to perf(限制perf访问)
- Access to perf_event_open() is disabled by default.
- Developers may re-enable access via debug shell
- Remove access to debugfs (限制debugfs访问,Android N完全禁止APP访问)
- All app access to debugfs removed in N
- Remove default access to /sys (白名单限制/sys访问)
- App access to files in /sys must be whitelisted
- Seccomp required for all devices (minijail shoutout!)
- 安全编码规范,动静态安全检查(KASAN,checkpatch.pl等),安全编译选项
- 打开所有漏洞利用缓解机制
- 通过SELinux策略与Linux权限控制,减小驱动接口攻击面
推荐阅读
- Android内核栈溢出与ROP(CVE-2013-2597)
- android_rooting_tools 项目介绍(CVE-2012-4220)
- Android Native Hook技术
- Android全局可调试(ro.debuggable = 1)的一种另类改法
- UI“三重天”之appium
- springboot使用遇到问题(Class “model.Address” is listed in the persistence.xml file but not mapped)
- Appium移动端自动化测试之测试应用实战
- poj3321-Apple Tree(DFS序+树状数组)
- 497. Random Point in Non-overlapping Rectangles