MCPcopy Create free account
hub / github.com/Hackmanit/Web-Cache-Vulnerability-Scanner / firstRequestPoisoningIndicator

Function firstRequestPoisoningIndicator

pkg/requests.go:435–468  ·  view source on GitHub ↗
(identifier string, body []byte, poison string, header map[string][]string, identifierIsCB bool, cb string, statusCode int)

Source from the content-addressed store, hash-verified

433}
434
435func firstRequestPoisoningIndicator(identifier string, body []byte, poison string, header map[string][]string, identifierIsCB bool, cb string, statusCode int) bool {
436 var reason string
437 if poison != "" && poison != "http" && poison != "https" && poison != "nothttps" && poison != "1" { // dont check for reflection of http/https/nothttps (used by forwarded headers), 1 (used by DOS) or empty poison
438 if strings.Contains(string(body), poison) || (identifierIsCB && strings.Contains(string(body), cb)) { //
439 reason = "Response Body contained " + poison
440 }
441 var reflections []string
442 for x := range header {
443 for _, v := range header[x] {
444 if strings.Contains(v, poison) || (identifierIsCB && strings.Contains(v, cb)) {
445 reflections = append(reflections, x)
446 }
447 }
448 }
449 if len(reflections) > 0 {
450 reason = "Response Header(s) " + strings.Join(reflections, ", ") + " contained " + poison
451 }
452 }
453 if Config.Website.StatusCode != statusCode && reason == "" {
454 reason = fmt.Sprintf("Status Code %d differed from %d", statusCode, Config.Website.StatusCode)
455 }
456 if Config.CLDiff != 0 && reason == "" && len(body) > 0 && compareLengths(len(body), len(Config.Website.Body), Config.CLDiff) {
457 reason = fmt.Sprintf("Length %d differed more than %d bytes from normal length %d", len(body), Config.CLDiff, len(Config.Website.Body))
458 }
459
460 if reason != "" {
461 msg := identifier + ": " + reason + "\n"
462 Print(msg, Cyan)
463 return true
464 } else {
465 return false
466 }
467
468}

Callers 1

issueRequestsFunction · 0.85

Calls 2

compareLengthsFunction · 0.85
PrintFunction · 0.85

Tested by

no test coverage detected