Loading... GS选项为每个函数增加了一些额外的数据和操作,用以检测栈溢出。 1. 在函数发生调用时,向站内压入一个额外的随机DWORD,这个随机数被称为,Canary及SecurityCookie. 2. SecurityCookie位于EBP之前,系统还将在.data的内存中存放一个SecurityCookie的副本 3. 当栈中发生溢出的时候首先淹没这个Cookie,之后才是EBP和返回地址。 4. 函数返回之前,系统将执行一个额外的安全验证操作,及Secutity check 5. 在Security Check过程中,系统将栈中存储的cookie和.data中的副本比较。如果不相同,就说明栈被破坏,及发生了栈溢出。 ![image.png](http://www.irohane.top/usr/uploads/2021/01/3850424656.png) GS基址,能阻止大多数的栈溢出、 - 系统以.data第一个双字节作为Cookie的种子,被称为原始Cookie(所有Cookie都用这个DWORD生成) - 程序在每次运行的时候Cookie种子都不同,种子具有很强的随机性。 - 在栈帧初始化以后系统用ESP异或种子,作为当前的Cookie,以作为不同函数直接的区别。 - 在函数返回前,还原出Cookie种子。 绕过方法: 1. 利用为保护的内存突破GS 2. 覆盖虚函数突破GS 3. 攻击异常处理突破GS 1. http://www.irohane.top/index.php/archives/266/ 最后修改:2021 年 01 月 20 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏