OSCP 靶场
靶场介绍
hundred |
easy |
ftp使用、opensll-id_rsa解密、图片隐写、stegseek使用、linpeas.sh 使用、shadow写入提权 |
信息收集
主机发现
端口扫描
└─# nmap -sV -A -p- -T4 192.168.1.146
Starting Nmap 7.94 ( https://nmap.org ) at 2024-01-11 22:01 EST
Nmap scan report for 192.168.1.146
Host is up (0.00070s latency).
Not shown: 65532 closed tcp ports (reset)
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rwxrwxrwx 1 0 0 435 Aug 02 2021 id_rsa [NSE: writeable]
| -rwxrwxrwx 1 1000 1000 1679 Aug 02 2021 id_rsa.pem [NSE: writeable]
| -rwxrwxrwx 1 1000 1000 451 Aug 02 2021 id_rsa.pub [NSE: writeable]
|_-rwxrwxrwx 1 0 0 187 Aug 02 2021 users.txt [NSE: writeable]
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:192.168.1.158
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 2
| vsFTPd 3.0.3 - secure, fast, stable
|_End of status
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 ef:28:1f:2a:1a:56:49:9d:77:88:4f:c4:74:56:0f:5c (RSA)
| 256 1d:8d:a0:2e:e9:a3:2d:a1:4d:ec:07:41:75:ce:47:0e (ECDSA)
|_ 256 06:80:3b:fc:c5:f7:7d:c5:58:26:83:c4:f7:7e:a3:d9 (ED25519)
80/tcp open http nginx 1.14.2
|_http-server-header: nginx/1.14.2
|_http-title: Site doesn't have a title (text/html).
MAC Address: 08:00:27:6F:4C:3C (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: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.70 ms 192.168.1.146
目录扫描
┌──(root㉿kali)-[~]
└─# gobuster dir -w /opt/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u http://192.168.1.146 -x php,txt,bak,html -e
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.1.146
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /opt/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.6
[+] Extensions: php,txt,bak,html
[+] Expanded: true
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
http://192.168.1.146/index.html (Status: 200) [Size: 242]
Progress: 1102800 / 1102805 (100.00%)
===============================================================
Finished
===============================================================
这个暂时不知道是什么key
权限获取
ftp 匿名访问获取文件user.txt 和私钥、其他两个好像也没啥毛用
但是需要密码并不是想象中的那么简单。
使用id_rsa.pem私钥文件来解密h4ckb1tu5.enc文件,获取到另外一个目录
openssl rsautl -decrypt -inkey id_rsa.pem -in h4ckb1tu5.enc
这个命令是使用 OpenSSL 的rsautl工具来解密一个使用 RSA 私钥加密的文件。命令的各个部分的含义如下:
-
openssl: 这是调用 OpenSSL 程序的命令。
-
rsautl: 这是 OpenSSL 中用于直接处理 RSA 加密的工具。
-
-decrypt: 这个选项指定rsautl工具用于解密数据。
-
-inkey id_rsa.pem: 这个选项后面跟着的是私钥文件的路径,id_rsa.pem是用于解密的 RSA 私钥文件。
-
-in h4ckb1tu5.enc: 这个选项后面跟着的是要解密的文件的路径,h4ckb1tu5.enc是已加密的文件。
还是需要密码才能登录
从logo.jpg ,发现存在隐写内容,使用users.txt 作为密码进行破解,成功获取密码
stegseek logo.jpg users.txt -xf output
stegseek 是一个用于图片隐写术的工具,它可以用来从图片中提取隐藏的数据。如下命令中:
-
logo.jpg是包含隐写数据的图片文件。
-
users.txt 是一个包含密码的文本文件,stegseek 会使用这个文件作为字典来尝试解密图片中的数据。
-
-xf output是一个选项,其中-x表示提取模式,-f表示强制覆盖输出文件,output是提取出的数据将要保存的文件名。
总的来说,这个命令的作用是尝试使用users.txt中的内容来解密logo.jpg图片中隐藏的数据,并将解密后的数据保存到名为output的文件中。
权限提升
下载linpeas.sh 进行扫描,发现shadow 文件可写
End
“点赞、在看与分享都是莫大的支持”
原文始发于微信公众号(贝雷帽SEC):【OSCP】hundred
- 左青龙
- 微信扫一扫
- 右白虎
- 微信扫一扫
评论