随机化方法作为保护程序免受攻击的一项技术,已经得到广泛的应用.但现有的随机化方法存在两个问题:其一,粒度较粗,不能阻止发生在函数、结构体、类内部的攻击;其二,绝大多数攻击是通过外部输入篡改关键对象,而现有随机化方法对这种攻击特点关注不够.基于此,一种增强的随机化安全结构被提出:通过对封装结构(函数、结构体以及类)内部的结构重新排列而达到随机化的细粒度;同时,分析抽取出与外部输入相关的数组,并在这些数组之间插入"哨兵",防止其产生溢出.这种随机化方法不仅将随机化技术应用到函数、结构体、类内部,而且抓住了攻击的特点,对关键的与输入相关的数组对象进行保护,使程序免受控制流和非控制流攻击,从而增强了现有的随机化技术.
Randomization method is widely applied into practice for protecting the program from attacks. There are two limitations in existing randomization techniques. One is that they are coarse-grained, as such they may fail to defend the attacks caused by maliciously fabricating the inner variable in function/struct/class. Another limitation is that existing randomization techniques ignore the fact that majority of the attacks leverage the input data to fabricate the sensitive data objects. In this paper, a fine-grained randomization method is proposed to protect programs based on an enhanced safety structure. These techniques will reorder the encapsulated structure (function, struct, class) layout. In addition, this method extracts input-related array and separates the array by inserting the guard between them. The randomization approach not only applies the randomization techniques into function/struct/class to foil a number of attacks, but also extracts the input-related array and inserts the guard to prevent them from being maliciously crafted. As an enhancement to existing randomization techniques, this method is able to protect the programs from both control-flow attacks and non-control-flow attacks. This technique has been implemented in the open source compiler GCC, and the experimental results show that the approach can effectively detect the real world attacks and has low performance overhead.