Liuw's Thinkpad

想要赢就先学会输,想要成功就先学会失败

Archive for the ‘Security’ tag

为什么我不看好基于SMM模式的安全措施

without comments

Intel处理器提供了几种模式,一般人们所熟知的是v8086、Real以及Protected三种,SMM估计是知道得比较少的了。SMM全称是System Management Mode,以前一般用于电源管理等工作。

搞安全的最基本手段,无非就是如何在得到更高的权限,把自己的程序放置于系统中更加关键的位置从而控制上层应用。在常见的三种模式早就被榨得差不多的情况下,新近流行的虚拟机监视器又为安全研究人员提供了一定的机会,大家不用那么快愁没饭吃。

但是现在,虚拟机下的东西也不好搞了,玩的人多了,最有一天也会榨干。于是大家又开始找新玩意。估计最初提出用SMM做安全的人,大概是把Intel的几本手册都翻了个透了吧,LOL。学界要求就是要“新”,于是SMM的文章好像也比较走俏,CCS 10′上有一篇,中国科学应该今年也会出一篇。

但是就我本人来说,我对于这个SMM不是特别感冒。我比较重视实际应用,学界很多事情都是为了paper而研究,我觉得没什么意思。当然,为了避免自己有乱泼脏水的嫌疑,我还是列一下自己的理由吧,为什么我不看好基于SMM模式的安全措施。

  • 这样的工作没有什么本质上的创新和突破,只是把剩下的硬件机能榨干而已。
  • 这样的工作移植性差。
    • SMM模式是高度ICH-dependent的,在06年的针对SMM的攻击出现之后,很多BIOS默认已经把SMM模式锁定了。CCS 10′上的paper解决这个问题的办法是:改写BIOS代码。
    • 即使SMM模式没有被锁定,也不能保证SMM模式能用——hardware/firmware dependent——这是我在数台机器实验后的结果。

我也和师兄提过这个问题了,但是他说学界就好这口,也没办法。好吧,大家混口饭吃而已,这么认真干什么呢,LOL。

Written by liuw

February 28th, 2011 at 3:17 pm

Security Cookie检测栈溢出

with one comment

过来中科院的,做的是从来都没有接触过的移动平台安全。师兄给了我两个方向,一个是漏洞挖掘,一个是漏洞利用,叫我先看看资料,看看自己喜欢哪个。

挖掘,主要使用的方法是fuzzing,其实从原理上说还不是特别的难,要写程序也挺容易,所以花在上面的时间不多。利用,师兄说其实和x86上的漏洞利用是差不多的,无非也是溢出。不过因为手机一般是使用ARM的处理器,所以汇编是不大一样的。于是上周基本在资料和小程序实验中试过,主要方面都花在钻手机漏洞利用方法了。

现在要讲的,倒也不是ARM汇编,而是在做实验中发现的一个有趣的东西,叫security cookie,可以检测是否有栈溢出发生。

code

在返回之前,调用了一个security_check_cookie的函数。

security_check_cookie

security cookie是编译器的一个feature(当然是可以关掉的)。原理是这样的,在每次进入函数的时候,在缓冲区边界处留出一个存储空间,复制一份security cookie的值,然后在函数返回之前,检查此地址的内容与security cookie是否一致。假如不一致,就说明栈发生了溢出。security cookie是一个magic number,基本上程序每次运行时都是不一样的,要猜中是很难的。即使猜中了,此cookie也会影响shellcode的编写。security cookie的一套代码,都是由编译器自动生成的,因而程序是不需要作什么修改的。

Written by liuw

July 20th, 2009 at 7:20 pm

Smashing the stack for fun and profit

without comments

                     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                     Smashing The Stack For Fun And Profit
                     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

                                 by Aleph One
                             aleph1@underground.org

`smash the stack` [C programming] n. On many C implementations
it is possible to corrupt the execution stack by writing past
the end of an array declared auto in a routine.  Code that does
this is said to smash the stack, and can cause return from the
routine to jump to a random address.  This can produce some of
the most insidious data-dependent bugs known to mankind.
Variants include trash the stack, scribble the stack, mangle
the stack; the term mung the stack is not used, as this is
never done intentionally. See spam; see also alias bug,
fandango on core, memory leak, precedence lossage, overrun screw.

Read the rest of this entry »

Written by liuw

April 24th, 2008 at 8:29 am