快速下载:
wget https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh -O les.sh
关于 LES 使用和内部机制的详细信息:
https://blog.z-labs.eu/2019/05/10/les-paper.html
LES 的附加资源:
https://github.com/mzet-/les-res
LES 工具旨在帮助检测给定 Linux 内核/Linux 机器的安全缺陷。它提供以下功能:
该工具使用启发式方法(详见此处)评估给定 Linux 系统对公开已知的 Linux 权限提升漏洞的暴露程度。工具输出示例:
$ ./linux-exploit-suggester.sh
...
[+] [CVE-2017-16995] eBPF_verifier
Details: https://ricklarabee.blogspot.com/2018/07/ebpf-and-analysis-of-get-rekt-linux.html
Exposure: highly probable
Tags: debian=9.0{kernel:4.9.0-3-amd64},fedora=25|26|27,[ ubuntu=14.04 ]{kernel:4.4.0-89-generic},ubuntu=(16.04|17.04){kernel:4.(8|10).0-(19|28|45)-generic}
Download URL: https://www.exploit-db.com/download/45010
Comments: CONFIG_BPF_SYSCALL needs to be set && kernel.unprivileged_bpf_disabled != 1
[+] [CVE-2017-1000112] NETIF_F_UFO
Details: http://www.openwall.com/lists/oss-security/2017/08/13/1
Exposure: probable
Tags: [ ubuntu=14.04{kernel:4.4.0-*} ],ubuntu=16.04{kernel:4.8.0-*}
Download URL: https://raw.githubusercontent.com/xairy/kernel-exploits/master/CVE-2017-1000112/poc.c
ext-url: https://raw.githubusercontent.com/bcoles/kernel-exploits/cve-2017-1000112/CVE-2017-1000112/poc.c
Comments: CAP_NET_ADMIN cap or CONFIG_USER_NS=y needed. SMEP/KASLR bypass included. Modified version at 'ext-url' adds support for additional distros/kernels
[+] [CVE-2016-8655] chocobo_root
Details: http://www.openwall.com/lists/oss-security/2016/12/06/1
Exposure: probable
Tags: [ ubuntu=(14.04|16.04){kernel:4.4.0-(21|22|24|28|31|34|36|38|42|43|45|47|51)-generic} ]
Download URL: https://www.exploit-db.com/download/40871
Comments: CAP_NET_RAW capability is needed OR CONFIG_USER_NS=y needs to be enabled
...
对于每个漏洞,都会计算其暴露程度。可能的'Exposure'状态有:
Highly probable(高度可能) - 评估的内核很可能受影响,且 PoC 漏洞利用几乎无需任何重大修改即可直接生效。
Probable(可能) - 漏洞利用可能有效,但很可能需要对 PoC 漏洞利用进行定制以适配你的目标。
Less probable(不太可能) - 需要额外的手动分析来验证内核是否受影响。
Unprobable(不可能) - 内核几乎不可能受影响(该漏洞不会在工具输出中显示)
LES 可以检查大多数由你的 Linux 内核提供的安全设置。它不仅验证内核的编译时配置(CONFIG),还验证运行时设置(sysctl),从而更全面地展示运行中的内核的安全状况。此功能旨在成为 Tobias Klein 开发的 checksec.sh 工具中 --kernel 选项的现代延续。工具输出示例:
$ ./linux-exploit-suggester.sh --checksec
Mainline kernel protection mechanisms:
[ Disabled ] GCC stack protector support (CONFIG_HAVE_STACKPROTECTOR)
https://github.com/mzet-/les-res/blob/master/features/stackprotector-regular.md
[ Disabled ] GCC stack protector STRONG support (CONFIG_STACKPROTECTOR_STRONG)
https://github.com/mzet-/les-res/blob/master/features/stackprotector-strong.md
[ Enabled ] Low address space to protect from user allocation (CONFIG_DEFAULT_MMAP_MIN_ADDR)
https://github.com/mzet-/les-res/blob/master/features/mmap_min_addr.md
[ Disabled ] Restrict unprivileged access to kernel syslog (CONFIG_SECURITY_DMESG_RESTRICT)
https://github.com/mzet-/les-res/blob/master/features/dmesg_restrict.md
[ Enabled ] Randomize the address of the kernel image (KASLR) (CONFIG_RANDOMIZE_BASE)
https://github.com/mzet-/les-res/blob/master/features/kaslr.md
[ Disabled ] Hardened user copy support (CONFIG_HARDENED_USERCOPY)
https://github.com/mzet-/les-res/blob/master/features/hardened_usercopy.md
...
评估 Linux 系统在公开已知漏洞中的暴露程度:
$ ./linux-exploit-suggester.sh
显示 Linux 系统上安全功能的状态:
$ ./linux-exploit-suggester.sh --checksec
基于提供的 'uname' 字符串(即 uname -a 命令的输出)评估 Linux 内核在公开已知漏洞中的暴露程度:
$ ./linux-exploit-suggester.sh --uname <uname-string>
更多使用示例,请参见此处。
你现在应该已经了解了 LES 是什么以及它能为你做些什么。现在看看你能为 LES 做些什么:
Tags 的形式记录你的发现,例如一个标签:ubuntu=12.04{kernel:3.(2|5).0-(23|29)-generic},表示:该标签标识的漏洞已验证可在 Ubuntu 12.04 上正常运行,内核版本为:3.2.0-23-generic、3.2.0-29-generic、3.5.0-23-generic 和 3.5.0-29-generic;。添加此标签后,LES 在运行于 Ubuntu 12.04 且内核版本符合列表中的某个时,会自动高亮并提升该漏洞的动态 Rank。这将在渗透测试期间帮助你(以及他人)快速识别严重易受攻击的 Linux 机器。ext-url 条目添加到 LES,并修改 Tags 以反映新增的目标。请参见这篇文章,该文章是适配特定 PoC 漏洞到不同内核版本的绝佳示例。FEATURES 数组中(如果尚未添加),并在以下位置发布你的分析:https://github.com/mzet-/les-res/blob/master/features/<feature-name>.md。感谢 bcoles 对 LES 做出的卓越且频繁的贡献。