1.探子相关函数基本使用

User() current_user() session_user() 返回当前连接的用户名(包含主机名) version() 数据库版本号 database() 当前连接的数据库名 length() 计算字符串长度 left() 取最左边的字符 substring() 取字符串中任意长度字长 position() 返回字符所在字符串中的位置 locate()返回字符所在字符串中的位置#### 2.什么是探子回报 User(),version() 探子:测试程序是否同时对函数,子查询,括号等是否过滤。

1.两个都是SQL99标准中通用的函数,不同的数据库返回值都各有特征,进而推断是什么数据库类型。 如user()函数返回情况: mysql返回root@localhost oracle返回sys sqlserver返回sa 2.执行成功,即探子回报。说明程序对函数,括号()和子查询并未做过滤,可能可以执行函数、子查询等复杂逻辑。 探子没有回报,基本上说明注入攻击困难或者注入可能性很小。#### 3.盲注中如何猜测用户名密码 1.先猜测用户名有多少个字符 select * from users where uid=10003 and length(user())>4;

2.对@位置的猜测与确认 select from users where uid=10003 and position(‘@’ in user())>1; select from users where uid=10003 and position(‘@’ in user())=4;

3.用户名的5个字符中,逐个猜测 select from users where uid=10003 and left(user(),1)=’h’; select from users where uid=10003 and substring(user(),2,1)=’x’;

这种方法同样用于盲注中猜测数据库名,表名,字段和密码等。 由于穷举法太累,可以借助SQL注入工具来替代人工的办法。#### 常用函数有哪些?

Version() User() Database() substring() position() locate() Left current_user() Session_user()