2019-2020-1 20199322《Linux内核原理与分析》第十一周作业

shellshock攻击实验

实验环境
实验楼

实验准备

安装bash-4.1


检测漏洞是否存在,说明shellshock漏洞存在

开始实验

攻击SET-UID程序

hack



发现攻击失败,说明如果 real uid 和 effective uid 相同的话,shellshock漏洞就能够被利用了。如果两个uid不同的话,就无法发动攻击了。

variables.c代码
void initialize_shell_variables(){
// 循环遍历所有环境变量
for (string_index = 0; string = env[string_index++]; ) {
/* 如果有export过的函数, 在这里定义 */
/* 无法导入在特权模式下(root下)定义的函数 */
if (privmode == 0 && read_but_dont_execute == 0 &&
STREQN (“() {“, string, 4)) {
// 这里是shellshock发生的地方
// 传递函数定义 + 运行额外的指令
parse_and_execute (temp_string, name,
SEVAL_NONINT|SEVAL_NOHIST);

总结

这一次实验,让我对漏洞,还有一些概念有了一些比较充分的了解,收获颇丰。

原文地址:https://www.cnblogs.com/vizen/p/12021014.html