- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想知道是否有一种方法可以使用 suid 二进制文件(使用 Ubuntu 18.04)来删除特权。看:
# cp /bin/bash .
# chown www-data bash
# chmod 4700 bash
# ls -lh
-rws------ 1 www-data root 1,1M abr 4 2018 bash
# ./bash
# id
uid=0(root) gid=0(root) groups=0(root)
是否有关于为什么可以使用 suid 二进制文件获得特权但不能放弃特权的解释?
您可能想知道我要完成什么,但这只是为了学习。
谢谢!
最佳答案
这在一般情况下有效:
# cp /usr/bin/id .
# chown www-data id
# chmod 4700 id
# ./id
uid=0(root) gid=0(root) euid=33(www-data) groups=0(root)
bash
是一个特例。来自 bash
手册的“INVOCATION”部分,并强调了相关部分:
If the shell is started with the effective user (group) id not equal to the real user (group) id, and the
-p
option is not supplied, no startup files are read, shell functions are not inherited from the environment, theSHELLOPTS
,BASHOPTS
,CDPATH
, andGLOBIGNORE
variables, if they appear in the environment, are ignored, and the effective user id is set to the real user id. If the-p
option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset.
传递 -p
(特权)标志确实会抑制这种行为:
# cp /bin/bash .
# chown www-data bash
# chmod 4700 bash
# ./bash -p
bash-4.4$ id
uid=0(root) gid=0(root) euid=33(www-data) groups=0(root)
关于linux - 无法使用 suid 二进制文件删除特权?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53179739/
本文通过 Google 翻译 SUID | SGID Part-1 – Linux Privilege Escalation 这篇文章所产生,本人仅是对机器翻译中部分表达别扭的字词进行了校正及个
本文通过 Google 翻译 SUID | SGID Part-2 – Linux Privilege Escalation 这篇文章所产生,本人仅是对机器翻译中部分表达别扭的字词进行了校正及个
如果 /usr/bin/bash 设置了 suid 位为什么只有当我像这样使用 -p 选项时,我的 euid 才会更改为 root /usr/bin/bash -p这个 -p 选项代表什么?当您从 s
我正在编写一个内核模块,它需要检查给定文件描述符的suid属性。我检查了各种内核结构,但找不到有关该主题的任何线索。 我希望以某种方式找到一个包含按位 Unix-stile 权限的字段,但我找不到任何
假设我得到了具有不同类名的完全不同的类。我应该在类中使用不同的 serialVersionUID 吗? 如果是这样,为什么有必要? JRE到底是怎么反序列化的? 最佳答案 不,你不需要不同的 SUID
我有一个 SUID 位在重启后被忽略的问题。问题很可能出在我对 SUID Bit 的理解上。由于它们执行的功能,我需要提升目录中 python 文件的权限。这就是我所做的。 sudo find dir
我有一个二进制文件(名称为 bmu),在调用 statfs 函数时需要 root 权限。 操作系统是 SuSE Linux 2.6.16.60-0.21-smp 运行bmu的用户是test,是非roo
这个问题已经有答案了: java.io.invalidClassException during serializing/deserializing (3 个回答) 已关闭 7 年前。 我正在开发一款
我正在阅读序列化,并对对象序列化过程中计算的 SUID 如何传递到另一台机器感到困惑。下面的查询是在一台机器中序列化对象并将其传递到另一台机器的上下文中进行的。 a) 为什么 suid 是静态的?b)
我有一个python脚本(必须以root身份调用),它调用一个bash脚本(必须以非root身份调用),有时需要调用sudo。这不起作用 - “叶”sudo 调用给出消息“$user 不在 sudoe
我想知道是否有一种方法可以使用 suid 二进制文件(使用 Ubuntu 18.04)来删除特权。看: # cp /bin/bash . # chown www-data bash # chmod 4
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 7 年前。 Improve this ques
我目前正在学习 LPIC-1 Linux 认证。为此,我使用了由 McGraw Hil 发布并由 Robb Tracy 编辑的“一体化”考试指南。 (第一版,麦格劳希尔网站上没有勘误表)。 我在网上研
我是 C 新手,这是我编写的一个简单包装器,用于以不同用户身份运行执行脚本。我知道我可以在 etc/sudoers 中执行 visudo 但是,我已经这样做了,我不想浪费它,它也将帮助我提高 C 语言
我写了一个简单的 bash 脚本来备份主目录,e 把它放到/var/backups 中。由于该目录是 protected ,所以我以 root 身份编写脚本,然后设置 SUID。 armando@ub
这是我的问题:我一直在开发一个复杂的产品(100k 多行代码),它本质上将最多 8 个不同的类附加到 JTree 结构,并将整个实体序列化到磁盘。我在我自己的每个类中设置 SUID 以方便版本管理,这
我知道我们不能对 suid 二进制文件执行 ptrace。但是,我想知道为什么我们不能在二进制文件将其特权降为 uid 而不是 euid 后执行 ptrace。 例如,在二进制文件中,suid 二进制
我创建了一个包含以下内容的小 shell 脚本: cat /usr/bin/checksuid.sh !/bin/bash echo "Hello" > /etc/myfile.cnf ls -l /
我试图在 Alpine Docker 镜像中以不同的用户身份运行一些脚本。以 devuser 登录时我要跑 setup.sh如 root和 app.sh如 appuser .因为我读到你不能在脚本文件
这个问题在这里已经有了答案: How to generate unique DICOM UID? (1 个回答) 关闭 4 年前。 我是 DICOM 世界的新手,我想将修改后的 DICOM 文件(根
我是一名优秀的程序员,十分优秀!