前言
利用sudo利用Linux的网络命名空间(network namespace)功能来提供更好的网络隔离和管理,在命名空间运行命令中或创建网络接口,当用户在sudoers文件中被授予了执行ip
和/bin/sh
命令的权限,可利用这种方式方式提升权限。
信息搜集
探测存活主机,扫描端口

端口开放22 80,查看应用

http://192.168.236.234/index.htm

查看源码

提示secret.php
提交方式为GET,且字段name
=HackMyVM
,构造payload

获取shell
POST请求方式为正常请求,继续测试,发现该位置存在命令执行

查看源码

发现了疑似隐藏的用户名以及密码,因为前期信息搜集存在22端口,尝试登录

获取到flag1
权限提升
sudo -l

发现/bin/ip的权限为root权限

sudo ip netns add foo
sudo ip netns exec foo /bin/sh

成功提权获取flag2