1

谁能告诉我在哪里可以找到 Linux 上的有效 suid/guid 程序列表,最好是 Ubuntu?

注意我可以使用 find 来获取我机器上的 suid/sgid 程序列表,但我想知道它们是否是真正有效的程序;有没有我可以比较的清单?

4

2 回答 2

0

一个答案(来自 askubuntu上的 Rmano)复制如下:

一个想法——但需要在脚本方面做一些工作——做我的客人;-)

Find a suid/sgid file; let's call it scommand

Check from which package has been installed:

dpkg -S /full/path/to/scommand 

Compare its permission with the original deb package, by firstly downloading the package:

apt-get download package

Check if the command should have the suid set in the package with

dpkg -c package*deb | grep /full/path/to/scommand

cleanup, rinse, repeat.

例子:

[romano:~/tmp] % ls -l /bin/passwd ls: 无法访问 /bin/passwd: 没有这样的文件或目录 [romano:~/tmp] 2 % ls -l /usr/bin/passwd -rwsr- xr-x 1 root root 47032 2014 年 2 月 17 日 /usr/bin/passwd [romano:~/tmp] % dpkg -S /usr/bin/passwd passwd: /usr/bin/passwd [romano:~/tmp] % apt -get download passwd Get:1 http://archive.ubuntu.com/ubuntu/trusty/main passwd amd64 1:4.1.5.1-1ubuntu9 [755 kB] 1s 内获取 755 kB (487 kB/s) [romano:~ /tmp] % dpkg -c passwd*.deb| grep /usr/bin/passwd -rwsr-xr-x root/root 47032 2014-02-17 03:42 ./usr/bin/passwd

于 2014-11-10T15:43:15.083 回答
0

试试我写的这个小脚本,它搜索 Ubuntu 的整个在线存档(或 Debian 或其他任何使用 apt 和 dpkg 的东西,真的):

PKG=$(apt-cache search . | cut -f 1 -d ' ');
echo $PKG | xargs apt-get download;
F=(`find *.deb`); for i in ${F[@]};
do dpkg -c $i | cut -c 4- | grep ^s | cut -c 4- | cut -f 2 -d '.';
done | tee suid_root;

请注意,这会占用大量磁盘空间和带宽,并且不是很优化。

于 2017-09-29T06:17:51.153 回答