SQLTruncScanner_13.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. def fuzzParams(self, host, port, protoChoice, headers, body, method, urlpath, content_type, baseline):
  2. stdout = PrintWriter(self.callbacks.getStdout(), True)
  3. stdout.println("[!] FUZZING "+ str(len(body)) + " PARAMETERS")
  4. issueList.clear()
  5. payloadSet = {"5": ' 00', "10": ' 00', "15": ' 00', "20": ' 00', "30": ' 00', "40": ' 00'}
  6. #Let's loop through each parameter
  7. for param in body:
  8. stdout.println(" [-] FUZZING: " + str(param))
  9. fuzzParameter = str(param)
  10. for payLSD in payloadSet:
  11. stdout.println(" [-] PAYLOAD: " + payLSD)
  12. payload = payloadSet[payLSD]
  13. bodd = body
  14. bodd[fuzzParameter] = bodd[fuzzParameter] + payload
  15. if "json" not in content_type.lower():
  16. new_body = ""
  17. new_body += '&'.join("%s=%s" % (key, str(val))
  18. for (key, val) in bodd.iteritems())
  19. #print(" " + new_body)
  20. if method == "GET":
  21. url1 = urlpath.split("?")[0]
  22. url2 = "?" + str(new_body)
  23. headers[0] = "GET " + str(url1) + str(url2) + " HTTP/1.1"
  24. self.getRequest(headers, [host, port, protoChoice])
  25. else:
  26. self.postRequest(headers, new_body, [host, port, protoChoice])
  27. #Here we take the lengh and status code of the body returned as a baseline
  28. reqFuzzResponse = self.helpers.analyzeResponse(self.resp)
  29. reqFuzzReq = self.helpers.analyzeRequest(self.resp)
  30. reqFuzzRespTxt = self.resp.tostring()
  31. respFuzzStatusCode = reqFuzzResponse.getStatusCode()
  32. resFuzzbodyOffset = reqFuzzResponse.getBodyOffset()
  33. respFuzzbodyLen = len(reqFuzzRespTxt[resFuzzbodyOffset:])
  34. fuzzResponseData = str(respFuzzStatusCode) + str(respFuzzbodyLen)
  35. print(" " + fuzzResponseData)
  36. if fuzzResponseData != baseline:
  37. stdout.println(" [+] POSSIBLE INJECTION DETECTED")
  38. issue = ScanIssue(
  39. self.reqres[0], reqFuzzReq, "SQL Truncation Scanner", fuzzParameter + " | " + payLSD, "High")
  40. self.callbacks.addScanIssue(issue)
  41. return