Skip to content

Commit 574b3a7

Browse files
committed
Adding support for detection of CloudFlare responses
1 parent 034de96 commit 574b3a7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/controller/checks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from lib.core.exception import SqlmapNoneDataException
6363
from lib.core.exception import SqlmapSilentQuitException
6464
from lib.core.exception import SqlmapUserQuitException
65+
from lib.core.settings import CLOUDFLARE_SERVER_HEADER
6566
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
6667
from lib.core.settings import DUMMY_NON_SQLI_CHECK_APPENDIX
6768
from lib.core.settings import FORMAT_EXCEPTION_STRINGS
@@ -1363,7 +1364,7 @@ def checkConnection(suppressOutput=False):
13631364

13641365
try:
13651366
kb.originalPageTime = time.time()
1366-
page, _ = Request.queryPage(content=True, noteResponseTime=False)
1367+
page, headers = Request.queryPage(content=True, noteResponseTime=False)
13671368
kb.originalPage = kb.pageTemplate = page
13681369

13691370
kb.errorIsNone = False
@@ -1382,6 +1383,10 @@ def checkConnection(suppressOutput=False):
13821383
else:
13831384
kb.errorIsNone = True
13841385

1386+
if headers and headers.get("Server", "") == CLOUDFLARE_SERVER_HEADER:
1387+
warnMsg = "CloudFlare response detected"
1388+
logger.warn(warnMsg)
1389+
13851390
except SqlmapConnectionException, ex:
13861391
if conf.ipv6:
13871392
warnMsg = "check connection to a provided "

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@
309309
# Regex used for parsing XML Burp saved history items
310310
BURP_XML_HISTORY_REGEX = r'<port>(\d+)</port>.+?<request base64="true"><!\[CDATA\[([^]]+)'
311311

312+
# Server header in CloudFlare responses
313+
CLOUDFLARE_SERVER_HEADER = "cloudflare-nginx"
314+
312315
# Encoding used for Unicode data
313316
UNICODE_ENCODING = "utf8"
314317

0 commit comments

Comments
 (0)