小编tei*_*ura的帖子

即使在seteuid之后,也无法在python中删除root priv.一个bug?

即使在seteuid之后,也无法在python中删除root priv.一个bug?

编辑摘要:我忘了放弃gid.但是,接受的答案可能对你有所帮助.

你好.我不能在我的linux上删除python 3.2中的root权限.实际上,即使在seteuid(1000)之后,它也可以读取root拥有的400模式文件.euid肯定会设置为1000!

我发现在空的os.fork()调用之后,正确拒绝了特权访问.(但它只在父母身上.孩子仍然可以非法阅读.)这是python中的错误,还是linux?

请尝试下面的代码.注释掉底部的三行中的一行,并以root身份运行.

先谢谢.

#!/usr/bin/python3

# Python seteuid pitfall example.
# Run this __as__ the root.

# Here, access to root-owned files /etc/sudoers and /etc/group- are tried.
# Simple access to them *succeeds* even after seteuid(1000) which should fail.

# Three functions, stillRoot(), forkCase() and workAround() are defined.
# The first two seem wrong. In the last one, access fails, as desired.


# ***Comment out*** one of three lines at the bottom before execution.

# …
Run Code Online (Sandbox Code Playgroud)

python privilege

4
推荐指数
1
解决办法
2102
查看次数

标签 统计

privilege ×1

python ×1