Day 13 漏洞分析 - Vulnerability Analysis (unix-privesc-check)

工具介绍

今天要介绍的是unix-privesc-check,它是一个在 Unix 系统上运行的脚本,会检查程序、资料夹、各种设定,尝试找到错误的配置,来将一般使用者的权限提升,而提升权限意味使用者不再受限,甚至可以掌控整个主机。而且不像之前介绍的那些工具,是在Kali上远端对目标机器执行一些工作,而是直接在本机上执行。本机端执行这点可能会让人疑惑:「本机上要如何去安装程序?」,因为本身是个shell脚本,所以其实不需要经过安装的步骤,只要能够上传或是复制、编辑档案等方式,将脚本放到受测机器上就可以来运行了,因此必要条件其实是要拥有受测机器上的一般使用者登入权限。

使用方式

unix-privesc-check位於Kali的Vulnerability Analysis分类,直接执行的话可以看到介绍跟使用方式

unix-privesc-check v1.4 ( http://pentestmonkey.net/tools/unix-privesc-check )

Usage: unix-privesc-check { standard | detailed }

"standard" mode: Speed-optimised check of lots of security settings.

"detailed" mode: Same as standard mode, but also checks perms of open file
                 handles and called files (e.g. parsed from shell scripts,
                 linked .so files).  This mode is slow and prone to false 
                 positives but might help you find more subtle flaws in 3rd
                 party programs.

This script checks file permissions and other settings that could allow
local users to escalate privileges.

Use of this script is only permitted on systems which you have been granted
legal permission to perform a security assessment of.  Apart from this 
condition the GPL v2 applies.

Search the output for the word 'WARNING'.  If you don't see it then this
script didn't find any problems.

看来使用方式只有分standarddetailed,另外也有提到如果找到问题会有关键字WARNING,所以执行的时候可以直接过滤出关键字

/usr/bin/unix-privesc-check standard | grep WARNING

但我自己在执行过程中看到许多脚本语法问题造成无法正常执行的状况

/usr/bin/unix-privesc-check: 1076: [: standard: unexpected operator

本来以为是脚本太久,但後来打开脚本实际去看,第一行是#!/bin/sh,代表直接执行是会用sh去执行,然後ls -al /bin/sh去检查是否有软连结,会发现Kali是使用dash来执行,所以接下来改用bash来执行脚本

bash /usr/bin/unix-privesc-check standard | grep WARNING

在Kali上的扫瞄结果

Search the output below for the word 'WARNING'.  If you don't see it then
WARNING: There are SSH agents running on this system:
WARNING: There are GPG agents running on this system:

接下来可以把脚本复制到靶机上去试试看,可以利用scp将脚本传到靶机上

scp /usr/bin/unix-privesc-check [email protected]: 

然後到靶机的家目录上执行上面的指令

bash unix-privesc-check standard | grep WARNING

侦测结果跟Kali上就有些不同,真不愧是靶机...

Search the output below for the word 'WARNING'.  If you don't see it then
WARNING: Unencrypted Private SSH Key Found in /home/msfadmin/.ssh/id_rsa
WARNING: Public SSH Key Found in /root/.ssh/authorized_keys
WARNING: Public SSH Key Found in /home/msfadmin/.ssh/authorized_keys

结语

今天介绍了unix-privesc-check这个古老的脚本,但其实还不是很了解它是如何判断设定是有问题,什麽是可利用的,但好在它是脚本,行数也大概一千多行左右,所以之後还是需要投资一些时间来了解它实际上是如何运作的。


<<:  【没钱买ps,PyQt自己写】Day 13 - 使用 QVBoxLayout, QscrollArea 制作出卷轴,以高解析度检视图片 (基於 QImage 使用 OpenCV)

>>:  #13 No-code 之旅 — 简单快速开发漂亮的 React 元件 ft. Chakra UI

为了转生而点技能-JavaScript,day23(Promise介绍

Promise:适用於非同步的运算上。 本身就是建构函式 console.log(Promise);...

iOS APP 开发 OC 第七天, nil 跟 NULL 一样吗?

tags: OC 30 day NULL 可以作为指针变量的值。如果一个指针变量的值是NULL值,代...

Day_10 有线网路应用(三)

在有线网路应用(二)的应用中,使用树莓派当成主路由,乙太网路线为WAN,WIFI为LAN的布局。不过...

InterSection

InterSection(集合) 以下会来实作怎麽找寻两个array的集合 先使用两个回圈来实作Bi...

Day15-Go介面interface

前言 Go 语言的介面(interface)是一组以方法签名(method signatures)的...