@@ -619,6 +619,7 @@ def genCmpPayload():
619619
620620 if injection :
621621 checkSuhosinPatch (injection )
622+ checkFilteredChars (injection )
622623
623624 return injection
624625
@@ -668,8 +669,6 @@ def _():
668669
669670 kb .injection = injection
670671
671- # Simple arithmetic operations which should show basic
672- # arithmetic ability of the backend if it's really injectable
673672 for i in xrange (conf .level ):
674673 randInt1 , randInt2 , randInt3 = (_ () for j in xrange (3 ))
675674
@@ -690,29 +689,22 @@ def _():
690689 if PAYLOAD .TECHNIQUE .BOOLEAN not in injection .data :
691690 checkBooleanExpression ("%d=%d" % (randInt1 , randInt2 ))
692691
693- if checkBooleanExpression ("%d> %d" % (randInt1 , randInt2 )):
692+ if checkBooleanExpression ("%d= %d" % (randInt1 , randInt3 )):
694693 retVal = None
695694 break
696695
697- elif checkBooleanExpression ("%d> %d" % (randInt2 , randInt3 )):
696+ elif checkBooleanExpression ("%d= %d" % (randInt3 , randInt2 )):
698697 retVal = None
699698 break
700699
701- elif not checkBooleanExpression ("%d> %d" % (randInt3 , randInt1 )):
700+ elif not checkBooleanExpression ("%d= %d" % (randInt2 , randInt2 )):
702701 retVal = None
703702 break
704703
705704 if retVal is None :
706- warnMsg = "false positive or unexploitable injection point detected"
705+ warnMsg = "false positive injection point detected"
707706 logger .warn (warnMsg )
708707
709- if PAYLOAD .TECHNIQUE .BOOLEAN in injection .data :
710- if all (_ .__name__ != "between" for _ in kb .tamperFunctions ):
711- warnMsg = "there is a possibility that the character '>' is "
712- warnMsg += "filtered by the back-end server. You can try "
713- warnMsg += "to rerun with '--tamper=between'"
714- logger .warn (warnMsg )
715-
716708 kb .injection = popValue ()
717709
718710 return retVal
@@ -736,6 +728,27 @@ def checkSuhosinPatch(injection):
736728
737729 kb .injection = popValue ()
738730
731+ def checkFilteredChars (injection ):
732+ pushValue (kb .injection )
733+
734+ kb .injection = injection
735+ randInt = randomInt ()
736+
737+ if not checkBooleanExpression ("(%d)=%d" % (randInt , randInt )):
738+ warnMsg = "it appears that some non-alphanumeric characters (i.e. ()) are "
739+ warnMsg += "filtered by the back-end server. There is a strong "
740+ warnMsg += "possibility that sqlmap won't be able to properly "
741+ warnMsg += "exploit this vulnerability"
742+ logger .critical (warnMsg )
743+
744+ if not checkBooleanExpression ("%d>%d" % (randInt + 1 , randInt )):
745+ warnMsg = "it appears that the character '>' is "
746+ warnMsg += "filtered by the back-end server. You are strongly "
747+ warnMsg += "advised to rerun with the '--tamper=between'"
748+ logger .warn (warnMsg )
749+
750+ kb .injection = popValue ()
751+
739752def heuristicCheckSqlInjection (place , parameter ):
740753 if kb .nullConnection :
741754 debugMsg = "heuristic check skipped "
0 commit comments