Linux内置安全机制

  • Address space separation/process isolation
  • unix permissions
  • DAC capabilities
  • SELinux
  • seccomp
  • namespaces

内核Top 漏洞分类(按数量排序包括Core kernel 与 Vendor drivers,数据日期January 2014 -> April 2016)

  1. missing/incorrect bounds check
  2. null pointer defeference
  3. information leak
  4. missing permission check
  5. use after free
  6. race condition
  7. memory corruption(other)
  8. other
  9. integer overflow
  10. uninitialized data

利用缓解,安全机制- missing/incorrect bounds check(Landing in upstream kernel!)

  • 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

漏洞利用缓解机制 - null pointer dereference

  • CONFIG_LSM_MMAP_MIN_ADDR

    • Make null pointer dereference unexploitable (just crash)
  • PAN emulation also make null pointer
    • dereference non-exploitable

一些安全建议

Android主线上的内核代码质量要优于厂商驱动代码:
- 厂商如何提升驱动代码安全质量? 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!)

驱动代码安全质量控制:

    1. 安全编码规范,动静态安全检查(KASAN,checkpatch.pl等),安全编译选项
    2. 打开所有漏洞利用缓解机制
    3. 通过SELinux策略与Linux权限控制,减小驱动接口攻击面

Android: protecting the kernel的更多相关文章

  1. Compile android source and kernel for emulator in Debian

    1.download the android source code Reference from http://source.android.com/source/downloading.html ...

  2. 编译android的linux kernel goldfish

    https://source.android.com/source/building-kernels.html $ export PATH=/home/hzh/oldhome/learn/androi ...

  3. [原]Ubuntu 14.04编译Android Kernel

    如何编译android kernel参考官方文档:https://source.android.com/source/building-kernels.html   在Ubuntu 14.04上编译a ...

  4. 在Ubuntu上下载、编译和安装Android最新内核源代码(Linux Kernel)

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6564592 在前一篇文章提到,从源代码树下载下 ...

  5. Mac OS X于Android Kernel下载方法

    于上一篇日志中,我总结了大家提供的下载Android源代码的方法.这里再简单总结一下内核的下载方法. 參考这里的介绍:http://source.android.com/source/building ...

  6. 【Android 系统开发】下载 编译 Android源代码 和 Android kernel源代码

    下载Android源码简要流程 : a. 获取repo文件: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo ...

  7. 下载 编译 Android源代码 和 Android kernel源代码

    下载Android源码简要流程 : a. 获取repo文件: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo ...

  8. How to download and compile Android kernel goldfish ?

    Prerequisites Assuming that we already downloaded the android-ndk-r12b and sdk. w4118@w4118:~/utils$ ...

  9. 华为手机内核代码的编译及刷入教程【通过魔改华为P9 Android Kernel 对抗反调试机制】

    0x00  写在前面 攻防对立.程序调试与反调试之间的对抗是一个永恒的主题.在安卓逆向工程实践中,通过修改和编译安卓内核源码来对抗反调试是一种常见的方法.但网上关于此类的资料比较少,且都是基于AOSP ...

随机推荐

  1. 一、集合框架(HashMap和Hashtable的区别)

    一.HashMap和Hashtable 都实现了Map接口,都是以key-value形式保存数据. 区别一: HashMap可以存放null Hashtable不能存放null 区别二: HashMa ...

  2. Django知识点梳理

    Django囊括.杂糅了 前端.数据库.Python知识看起来比较复杂! 其实就是由http请求周期为主体,延伸出来的知识 .  PythonWeb服务器网关接口(Python Web Server ...

  3. mac bash 下使用vi 快捷方式——因为没有alt键 所以没有办法 用vi模式也非常方便的

    set -o emacs ##切到emacs模式 set -o vi ##切到vi模式 set -o ## 查看当前选项的设置状态 所以你只需要在.bashrc下加入 set -o vi 然后,使用E ...

  4. 使用Postman在Chrome下进行rest请求测试

    1.首先下载postman,我已经下载好,放在云盘里了. http://pan.baidu.com/s/1c1YoGKS 密码 dgfw 2.打开Chrome,点击更多工具->扩展程序~打开. ...

  5. laravel查找某个类拥有的方法:

    1.在当前项目下,使用cmd窗口,输入: php artisan tinker 在输入: app('log') 显示出:Illuminate\Log\Writer 2.在phpstorm中按:shif ...

  6. laravel的日志服务

    日志服务使用: $app=app(); $log=$app->make('log'); $log->info('post_index',['data'=>'this is post ...

  7. 分布式锁与实现(一)基于Redis实现

    目前几乎很多大型网站及应用都是分布式部署的,分布式场景中的数据一致性问题一直是一个比较重要的话题.分布式的CAP理论告诉我们“任何一个分布式系统都无法同时满足一致性(Consistency).可用性( ...

  8. java 实现简单的顺序栈

    package com.my; import java.util.Arrays; /** * 顺序栈 * @author wanjn * */ public class ArrayStack { pr ...

  9. POJ 2663 Tri Tiling

                                                                                    Tri Tiling   Time Li ...

  10. ios 设置本地化显示的app名称

    内容的本地化这里不做介绍! 名称的本地化: 1.新建一个 Strings File文件,命名为InfoPlist,注意这里一定要命名为InfoPlist! 2.设置本地化信息:选择需要的语言! 3.填 ...