-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from CompassSecurity/thort/issue80
Thort/issue80
- Loading branch information
Showing
7 changed files
with
92 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
.gradle | ||
.idea | ||
build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ plugins { | |
id "java-library" | ||
} | ||
|
||
version = "2.0.3" | ||
version = "2.0.4" | ||
|
||
repositories { | ||
mavenCentral() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package livetesting; | ||
|
||
import application.SamlMessageAnalyzer; | ||
import application.SamlMessageDecoder; | ||
import burp.api.montoya.http.message.params.HttpParameterType; | ||
import burp.api.montoya.http.message.requests.HttpRequest; | ||
|
||
public class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aXM6bmFtZXM6dGM6U0FNTDoyLjA6YWM6Y2xhc3NlczpQYXNzd29yZFByb3RlY3RlZFRyYW5zcG9ydDwvc2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj48L3NhbWxwOlJlcXVlc3RlZEF1dGhuQ29udGV4dD48L3NhbWxwOkF1dGhuUmVxdWVzdD4%3D HTTP/2 | ||
Host: e6bfa713-509c-4b20-b88f-956c1d0b1703.i.vuln.land | ||
Connection: keep-alive"""; | ||
|
||
@TestOrder.Order(1) | ||
public TestResult isSAMLMessage() { | ||
try { | ||
var request = HttpRequest.httpRequest(rawRequest); | ||
var analysis = SamlMessageAnalyzer.analyze(request, "SAMLRequest", "SAMLResponse"); | ||
var success = analysis.isSAMLMessage(); | ||
return new TestResult(success, null, null); | ||
} catch (Exception exc) { | ||
return new TestResult(false, null, exc); | ||
} | ||
} | ||
|
||
@TestOrder.Order(2) | ||
public TestResult isSAMLRequest() { | ||
try { | ||
var request = HttpRequest.httpRequest(rawRequest); | ||
var analysis = SamlMessageAnalyzer.analyze(request, "SAMLRequest", "SAMLResponse"); | ||
var success = analysis.isSAMLMessage() && analysis.isSAMLRequest(); | ||
return new TestResult(success, null, null); | ||
} catch (Exception exc) { | ||
return new TestResult(false, null, exc); | ||
} | ||
} | ||
|
||
@TestOrder.Order(3) | ||
public TestResult canDecodeSAMLMessage() throws Exception { | ||
try { | ||
var request = HttpRequest.httpRequest(rawRequest); | ||
var analysis = SamlMessageAnalyzer.analyze(request, "SAMLRequest", "SAMLResponse"); | ||
var body = request.parameterValue("SAMLRequest", HttpParameterType.URL); | ||
var decodedSamlMessage = SamlMessageDecoder.getDecodedSAMLMessage(body, analysis.isWSSMessage(), analysis.isWSSUrlEncoded()); | ||
return new TestResult(true, decodedSamlMessage.message(), null); | ||
} catch (Exception exc) { | ||
return new TestResult(false, null, exc); | ||
} | ||
} | ||
} |