Skip to content

Commit

Permalink
fix error on missing response
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbinna committed Jan 24, 2023
1 parent 0a467a8 commit cb9b885
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
}

version=1.2
version='1.2.1'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
var menu = new ManualAttackMenu(callbacks, attacker);
callbacks.registerContextMenuFactory(menu);

stdout.println("Host Header Inchecktion v1.2 loaded.");
stdout.println("Host Header Inchecktion v1.2.1 loaded.");
}

}
22 changes: 18 additions & 4 deletions src/main/java/burp/HostHeaderInjectionAttacker.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,34 @@ private static boolean isInteracted(
}

private boolean isStatusCode200(IHttpRequestResponse baseRequestResponse) {
return this.helpers.analyzeResponse(baseRequestResponse.getResponse()).getStatusCode() / 100 == 2;
var response = baseRequestResponse.getResponse();
if(response == null) {
return false;
}
return this.helpers.analyzeResponse(response).getStatusCode() / 100 == 2;
}

private boolean areResponsesSimilar(ExecutedAttack executedAttack) {
var originalResponse = executedAttack.originalRequestResponse().getResponse();
var attackResponse = executedAttack.attackRequestResponse().getResponse();
if(originalResponse == null || attackResponse == null) {
return false;
}

double distance = this.jaroWinklerDistance.apply(
new StringBuffer(Arrays.toString(executedAttack.originalRequestResponse().getResponse())),
new StringBuffer(Arrays.toString(executedAttack.attackRequestResponse().getResponse())));
return 0.1 < distance && distance < 0.2;
}

private boolean isPayloadReflected(ExecutedAttack executedAttack) {
var response = this.helpers.analyzeResponse(executedAttack.attackRequestResponse().getResponse());
var matches = getMatches(executedAttack.attackRequestResponse().getResponse(),
executedAttack.payload().getBytes(StandardCharsets.UTF_8),
var rawResponse = executedAttack.attackRequestResponse().getResponse();
if(rawResponse == null) {
return false;
}

var response = this.helpers.analyzeResponse(rawResponse);
var matches = getMatches(rawResponse, executedAttack.payload().getBytes(StandardCharsets.UTF_8),
this.helpers);
return matches.size() > 0 && response.getStatusCode() / 100 == 2;
}
Expand Down

0 comments on commit cb9b885

Please sign in to comment.