靶机: medium_socnet( 二 )

nmap IP地址

  • 参数 -p 扫描端口,如果是全部端口使用 - 指代,比如:nmap -p- 192.168.56.101
  • 参数 -sV 对端口上的服务程序版本进行扫描
在扫描中发现 192.168.56.101 开发端口 22,5000
┌──(kali?kali)-[~]└─$ nmap -p- 192.168.56.101Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-18 11:24 CSTNmap scan report for 192.168.56.101Host is up (0.0011s latency).Not shown: 65533 closed tcp ports (conn-refused)PORTSTATE SERVICE22/tcpopenssh5000/tcp openupnpNmap done: 1 IP address (1 host up) scanned in 10.82 seconds192.168.56.101 开发端口 22,5000 进一步扫描发现两个端口的服务程序版本
  • 22: ssh OpenSSH 6.6p1 Ubuntu 2ubuntu1 (Ubuntu Linux; protocol 2.0)
  • 5000: http Werkzeug httpd 0.14.1 (Python 2.7.15)
┌──(kali?kali)-[~]└─$ nmap -p22,5000 -sV 192.168.56.101Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-18 11:31 CSTNmap scan report for 192.168.56.101Host is up (0.00078s latency).PORTSTATE SERVICE VERSION22/tcpopensshOpenSSH 6.6p1 Ubuntu 2ubuntu1 (Ubuntu Linux; protocol 2.0)5000/tcp openhttpWerkzeug httpd 0.14.1 (Python 2.7.15)Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelService detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 6.81 seconds其中 5000 有 http 服务可以尝试在浏览器中访问一下 http://192.168.56.101:5000
  • 在网页中并没有什么特别的,唯一有的一个数据输入点上也不能注入
  • 可以使用爬虫类程序,探查 Web 应用是否存在 隐藏路径
第三步:攻击方式判断使用工具 dirsearch 进行探查
  • dirsearch 的基本参数 --url=,比如:dirsearch --url=http://192.168.56.101:5000/
使用 dirsearch 进行简单探查发现隐藏目录 /admin 其中 admin 英文含义就可以知道这个隐藏页面与管理员可能有关系,可以对其访问 http://192.168.56.101:5000/admin
┌──(kali?kali)-[~]└─$ dirsearch --url=http://192.168.56.101:5000/130 ?_|. _ ____ _|_v0.4.2 (_||| _) (/_(_|| (_| )Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 30 | Wordlist size: 10927Output File: /home/kali/.dirsearch/reports/192.168.56.101-5000/-_22-10-18_11-40-29.txtError Log: /home/kali/.dirsearch/logs/errors-22-10-18_11-40-29.logTarget: http://192.168.56.101:5000/[11:40:29] Starting:[11:40:58] 200 -401B- /adminTask Completed访问后发现,里面的提示 Nothing was ran. Input some code to exec() 此内容与 python 相关,在前面端口探测中也知道此网站是 Werkzeug httpd 0.14.1 (Python 2.7.15)
而 Python 2.7.15 的 exec() 常用于存储在字符串中的代码语句执行,那么我们可以尝试查找关于 Python 2.7.15 反弹 shell 的代码,通过 exec() 进入 192.168.56.101 这台机器了