Set-UID实验

本文详述了一个信息安全实验,探讨Set-UID程序的作用和安全性。实验涉及passwd、chsh、su和sudo等命令的Set-UID属性,通过复制程序并观察其行为,展示了失去Set-UID权限的影响。实验还分析了如何利用Set-UID shell程序获取或避免root权限,以及system()和execve()的区别,讨论了LD_PRELOAD环境变量的安全性问题。最后,文章提到了Set-UID程序如何通过setuid()系统调用来永久放弃root权限。
摘要由CSDN通过智能技术生成

//csdn博客目前暂时不再更新了,有兴趣请访问我的技术博客-晓的博客:zhangxiaolong.org 


写这个blog主要是对自己学习的内容进行一个总结和记录,希望对学习这些知识的同道之人有所帮助,第一次写博文,经验有所不足,我会慢慢练习。

实验操作我是参照了一位比较厉害的师兄,他的set_uid blog:http://blog.sina.com.cn/s/blog_70dd16910100pz8k.html。希望对大家有所帮助。

这个实验是信息安全实验的第一个实验,共有7个task,每一个task都有截图作为步骤。

1.  Figure out why "passwd", "chsh", "su", and "sudo" commands need to be Set-UIDprograms. What will happen if they are not? If you are not familiar with these programs, you should first learn what they can do by reading their manuals. Please copy these commands to your owndirectory; the copies will not be Set-UID programs. Run the copied programs, and observe whathappens.

实验截图如下:

                                                   图 1

                                                       图 2

   由图1,图2所示:拷贝到/home/seed下的passwd程序,没有了root权限,这样就没有了修改密码的权限。同样chsh su等等同样的道理。

2.  Run Set-UID shell programs in Linux, and describe and explain your observations.

(a) Login as root, copy /bin/zsh to /tmp, and make it a set-root-uid program with permission4755. Then login as a normal user, and run /tmp/zsh. Will you get root privilege? Please describe your observation. If you cannot find /bin/zsh in your operating system, please use the following command to install it:_ Note: in our pre-built Ubuntu VM image, zsh is already installed.

su

Password: (enter root password)

 yum install zsh

 For Ubuntu

$ su

Password: (enter root password)

apt-get install zsh

                                          图 3

由图3示,可以获得root权限

(b) Instead of copying /bin/zsh, this time, copy /bin/bash to /tmp, make it a set-root-uidprogram. Run /tmp/bash as a normal user. will you get root privilege? Please describe andexplain your observation.

                                             图 4

由图4示获得不了root权限,,从实验中可以看出/bin/bash有某种内在的保护机制可以阻止Set-UID机制的滥用。

3. (Setup for the rest of the tasks) As you can find out from the previous task,

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值