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. [洛谷 P1972] HH的项链(SDOI2009)

    P1972 [SDOI2009]HH的项链 题目描述 HH 有一串由各种漂亮的贝壳组成的项链.HH 相信不同的贝壳会带来好运,所以每次散步完后,他都会随意取出一段贝壳,思考它们所表达的含义.HH 不断 ...

  2. Auto Encoder用于异常检测

    对基于深度神经网络的Auto Encoder用于异常检测的一些思考 from:https://my.oschina.net/u/1778239/blog/1861724 一.前言 现实中,大部分数据都 ...

  3. dvwa安装、配置、使用教程(Linux)

    一.搭建LAMP环境 首先搭建好LAMP环境,如没配好参见“Linux+Apache+MySQL+PHP配置教程” 或者使用官方推荐的XAMPP:https://www.apachefriends.o ...

  4. Python线程二

    转自:https://www.cnblogs.com/chengd/articles/7770898.html 1. threading.Lock() import threading balance ...

  5. C++解析二

    C++ 类访问修饰符 数据封装是面向对象编程的一个重要特点,它防止函数直接访问类类型的内部成员.类成员的访问限制是通过在类主体内部对各个区域标记 public.private.protected 来指 ...

  6. 适应c++ 新特性 - 与我 - 多年传统方式开发(新特性参考微软标准:https://msdn.microsoft.com/zh-cn/library/hh279654.aspx)

    公司同事都在积极使用c++的新特性,并对其赞不绝口,而自己一直做着传统的c++开发方式,到底这些新特性如何,又是怎么提高开发效率的,我依然在疑问当中,从同事的说法和实际代码操练里,确实在减少代码量,集 ...

  7. HTML(三)选择器--复杂选择器

    1.父子选择器/派生选择器 <div calss="wrapper"> <span calss="box">123</span&g ...

  8. Saiku的下载与安装(一)

    Saiku- 数据可视化的工具,连接数据源展示数据,并且可方便导出xls/csv/pdf等文件的工具 一.Saiku下载 社区网址:https://community.meteorite.bi/ 二. ...

  9. C/C++知识补充 (1)

    ● C++的圆括号运算符() 下列关于圆括号运算符的功能说法不正确的是(C) . A. 可用于强制类型转换 B 可用于类型构造 C 可用于类型声明 D 可用于函数调用 对大部分可重载的运算符来说,它既 ...

  10. House Robber III

    The thief has found himself a new place for his thievery again. There is only one entrance to this a ...