本文是结合参考资料对CVE-2014-3153的分析,当然各位看官可以看最后的资料,他们写的比我好。

  在看CVE-2014-3153之前我们用参考资料4中例子来熟悉下这类漏洞是如何产生的:

/**
* An example of bug that can be exploited through stack manipulation
* Use -m32 to compile as 32 bit app, so that the int size is the same as pointer size
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h> struct node {
const char *value;
struct node *next;
struct node *prev;
}; struct list {
struct node *head;
struct node *tail;
}; void list_add(struct list *lst, struct node *newnode)
{
if (lst->head==NULL) {
lst->head = newnode;
lst->tail = newnode;
} else {
newnode->prev = lst->tail;
lst->tail->next = newnode;
lst->tail = newnode;
}
} struct node * list_remove_last(struct list *lst)
{
struct node *result;
result = lst->tail; if (lst->head==lst->tail) { /*zero or 1 element*/
lst->head = lst->tail = NULL;
} else {
lst->tail = lst->tail->prev;
lst->tail->next = NULL;
}
return result;
} void list_print(struct list *lst)
{
struct node *tmp;
tmp = lst->head;
while (tmp) {
printf("Value = %s\n", tmp->value);
tmp = tmp->next;
}
} void list_add_new(struct list *lst, const char *val)
{
struct node *newnode = (struct node *)malloc(sizeof(struct node));
newnode->next = NULL;
newnode->value = strdup(val);
list_add(lst, newnode);
} void print_with_end_of_list(struct list *lst)
{
struct node instack;
instack.next = 0;
instack.value = "--END OF LIST--"; printf("Not a buggy function\n"); list_add(lst, &instack);
list_print(lst);
/*we ignore the returned node*/
list_remove_last(lst);
} void buggy_print_with_end_of_list(struct list *lst)
{
int dummy_var1; /*see the article to see why i introduced this*/
int dummy_var2;
int dummy_var3; struct node instack; printf("a buggy function, here is the location of value on stack %p\n", &instack.value); instack.next = 0;
instack.value = "--END OF LIST--"; list_add(lst, &instack);
list_print(lst);
/*we 'forgot' to remove the list element*/ } void a_function_to_exploit(int element_number, void * value)
{
int i;
int buf[10];
if (element_number==-1) { /*print addressed of buf*/
for (i=0; i < 10; i++) {
printf("location of buf[%d] is %p\n", i, &buf[i]);
}
return;
} buf[element_number] = (int)value; } int main(int argc, char * argv[])
{
struct list mylist;
mylist.head = NULL;
mylist.tail = NULL;
int pos;
char *val; /*we have one parameter*/
pos = -1;
if (argc==3) {
pos = atoi(argv[1]);
val = argv[2];
} printf("we will use pos: %d\n", pos); list_add_new(&mylist, "Alpha");
list_add_new(&mylist, "Beta");
print_with_end_of_list(&mylist);
buggy_print_with_end_of_list(&mylist); a_function_to_exploit(pos, val); list_print(&mylist); /*this is just a demo, i am skipping the cleanup code*/
return 0;
}

  编译上面的代码(假设编译后的可执行文件名为mylist)并执行

$ ./mylist
we will use pos: -1
Not a buggy function
Value = Alpha
Value = Beta
Value = --END OF LIST--
a buggy function, here is the location of value on stack 0xffd724a4
Value = Alpha
Value = Beta
Value = --END OF LIST--
location of buf[0] is 0xffd72488
location of buf[1] is 0xffd7248c
location of buf[2] is 0xffd72490
location of buf[3] is 0xffd72494
location of buf[4] is 0xffd72498
location of buf[5] is 0xffd7249c
location of buf[6] is 0xffd724a0
location of buf[7] is 0xffd724a4
location of buf[8] is 0xffd724a8
location of buf[9] is 0xffd724ac
Value = Alpha
Value = Beta
Value = --END OF LIST--

  根据上面的执行结果我们知道buggy_print_with_end_of_list函数新增list的value值的栈地址刚好对应a_function_to_exploit函数中buf[7]的栈地址,故有继续执行

$./mylist 7 HACKED
we will use pos: 7
Not a buggy function
Value = Alpha
Value = Beta
Value = --END OF LIST--
a buggy function, here is the location of value on stack 0xffd3bd34
Value = Alpha
Value = Beta
Value = --END OF LIST--
Value = Alpha
Value = Beta
Value = HACKED

  执行结果上面符合,buf[7]存储着“HACKED”字符串的地址,刚好是list.value的地址,所以在最后输出"HACKER“。当然这个是bug,它引用了函数中的局部变量(函数返回后,局部变量的值会被后续的代码覆盖导致,导致重大bug)。这个例子告诉我们可以在类似的bug中我们可以操控list值,当然我们并不会满足于此。

  

 另:我们知道TowelRoot root工具就是利用这个CVE,为了防止他人拷贝和重打包,使用了O-LLVM来混淆ndk代码(当然这是另外的课题了,这里是记录下,你可以看译]使用O-LLVM和NDK对Android应用进行混淆 来熟悉概念)。

参考资料:

CVE-2014-3153 分析以及利用

2  cve2014-3153 漏洞之详细分析与利用

CVE-2014-3153笔记

Exploiting the Futex Bug and uncovering Towelroot

CVE-2014-3153分析和利用的更多相关文章

  1. FakeID签名漏洞分析及利用(二)

    本文转自:http://blog.csdn.net/l173864930/article/details/38409521 继上一次Masterkey漏洞之后,Bluebox在2014年7月30日又公 ...

  2. NSA Fuzzbunch分析与利用案例

    Shadow Brokers泄露出一份震惊世界的机密文档,其中包含了多个 Windows 远程漏洞利用工具.本文主要介绍了其中一款工具Fuzzbunch的分析与利用案例 1 整体目录介绍 解压EQGR ...

  3. word漏洞分析与利用

    众所周知,溢出漏洞从应用形式上可分为远程服务溢出漏洞和客户端(本地)溢出漏洞两类.远程服务溢出漏洞大家很熟悉了,红色代码.冲击波.振荡波等蠕虫都利用了此类漏洞,漏洞的调试和利用有相应的一套方法,前面的 ...

  4. 【转】cve2014-3153 漏洞之详细分析与利用

    背景学习: Linux Futex的设计与实现 使用者角度看bionic pthread_mutex和linux futex实现 By kernux TopSec α-lab 一 漏洞概述 这个漏洞是 ...

  5. Vivotek 摄像头远程栈溢出漏洞分析及利用

    Vivotek 摄像头远程栈溢出漏洞分析及利用 近日,Vivotek 旗下多款摄像头被曝出远程未授权栈溢出漏洞,攻击者发送特定数据可导致摄像头进程崩溃. 漏洞作者@bashis 放出了可造成摄像头 C ...

  6. 【逆向实战】ES文件浏览器未授权访问漏洞(CVE-2019-6447)具体分析及利用

    /作者:Kali_MG1937 CSDN博客号:ALDYS4 QQ:3496925334 未经许可,禁止转载/ 漏洞简介 CVE-2019-6447是Android端上的一个知名软件:ES文件浏览器的 ...

  7. Java练习小题_求一个3*3矩阵对角线元素之和,矩阵的数据用行的形式输入到计算机中 程序分析:利用双重for循环控制输入二维数组,再将a[i][i]累加后输出。

    要求说明: 题目:求一个3*3矩阵对角线元素之和,矩阵的数据用行的形式输入到计算机中 程序分析:利用双重for循环控制输入二维数组,再将 a[i][i] 累加后输出. 实现思路: [二维数组]相关知识 ...

  8. CVE-2016-10190 FFmpeg Http协议 heap buffer overflow漏洞分析及利用

    作者:栈长@蚂蚁金服巴斯光年安全实验室 -------- 1. 背景 FFmpeg是一个著名的处理音视频的开源项目,非常多的播放器.转码器以及视频网站都用到了FFmpeg作为内核或者是处理流媒体的工具 ...

  9. CVE-2010-3654分析及利用

    三年前分析的一个漏洞,最近又温习一遍,这个flash中混淆漏洞的鼻祖,10年最经典的漏洞. 漏洞触发原因 该漏洞主要因为avm对返回的类没有进行校验,通过修改swf文件,实现Ref类和Origin类的 ...

随机推荐

  1. POJ-1458(LCS:最长公共子序列模板题)

    Common Subsequence POJ-1458 //最长公共子序列问题 #include<iostream> #include<algorithm> #include& ...

  2. 1.2 Python3基础-规范

    >>返回主目录 总的来说,如果安装的不是安装的Anaconda,pip命令还是经常会用到的(cmd模式使用),当然也可以在PyCharm中直接安装 PEP8规范,我另有一篇博客已经写好,可 ...

  3. Java 获取小程序openid(基于SpringBoot)

    Java 获取小程序openid(基于SpringBoot) 官方文档 wx.login 1.引入Request封装依赖 <!--Request依赖--> <dependency&g ...

  4. Java 树结构实际应用 一(堆排序2秒排完800w数据)

    堆排序 1 堆排序基本介绍 1) 堆排序是利用堆这种数据结构而设计的一种排序算法,堆排序是一种选择排序,它的最坏,最好,平均时间复 杂度均为 O(nlogn),它也是不稳定排序. 2) 堆是具有以下性 ...

  5. 10、MyBatis教程之一对多处理

    11.一对多处理 一对多的理解: 一个老师拥有多个学生 如果对于老师这边,就是一个一对多的现象,即从一个老师下面拥有一群学生(集合)! 1.实体类编写 @Data public class Stude ...

  6. 通过 ASM 库生成和修改 class 文件

    在 JVM中 Class 文件分析 主要详细讲解了Class文件的格式,并且在上一篇文章中做了总结. 众所周知,JVM 在运行时, 加载并执行class文件, 这个class文件基本上都是由我们所写的 ...

  7. Java开发工程师面试-基础

    JDK.JRE.JVM有什么区别? JDK:Java Development Kit 针对Java程序员的产品 JRE:Java Runtime Environment是运行Java的环境集合 JVM ...

  8. Java 并发编程 生产者消费者模式

    本文部分摘自<Java 并发编程的艺术> 模式概述 在线程的世界里,生产者就是生产数据的线程,消费者就是消费数据的数据.生产者和消费者彼此之间不直接通信,而是通过阻塞队列进行通信,所以生产 ...

  9. 【2020.02.01NOIP普及模拟4】怪兽

    [2020.02.01NOIP普及模拟4]怪兽 文章目录 [2020.02.01NOIP普及模拟4]怪兽 题目描述 输入 输出 输入输出样例 数据范围限制 提示 解析 code 题目描述 PYWBKT ...

  10. java面试-生产环境出现CPU占用过高,谈谈你的分析思路和定位

    思路:结合Linux和JDK命令一起分析 1.用top命令找出CPU占比最高的进程 2.ps -ef|grep java|grep -v grep 或者jps -l进一步定位,得知是怎样一个后台程序惹 ...