Skip to content

Commit

Permalink
This commit should improve testing
Browse files Browse the repository at this point in the history
Although not very happy with this solution, it gives the ability to
write tests against concrete implementations.

Writing "plain" unit tests against the Montoya API is currently not
possible because the concrete implementation to those interfaces is
missing and only available during runtime. See also:
PortSwigger/burp-extensions-montoya-api#97

This commit provides a new Tab in DEBUG mode where tests can be run
against concrete implementations during runtime. -> Semi-automated
testing.
  • Loading branch information
Tobias Hort-Giess committed Jun 17, 2024
1 parent 30c4aef commit 5ca7ed2
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {
compileOnly libs.net.portswigger.burp.extensions.montoya.api
compileOnly libs.org.bouncycastle.bcpkix.jdk15on

implementation libs.com.google.guava
implementation libs.com.sun.xml.security.xml.security.impl
implementation libs.org.apache.santuario.xmlsec
implementation libs.xerces.xercesimpl
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[versions]
com-google-guava = "33.2.1-jre"
com-sun-xml-security-xml-security-impl = "1.0"
net-portswigger-burp-extensions-montoya-api = "2023.12.1"
org-apache-santuario-xmlsec = "2.1.7"
Expand All @@ -7,6 +8,7 @@ org-junit-jupiter = "5.10.2"
xerces-xercesimpl = "2.12.2"

[libraries]
com-google-guava = { module = "com.google.guava:guava", version.ref = "com-google-guava"}
com-sun-xml-security-xml-security-impl = { module = "com.sun.xml.security:xml-security-impl", version.ref = "com-sun-xml-security-xml-security-impl" }
net-portswigger-burp-extensions-montoya-api = { module = "net.portswigger.burp.extensions:montoya-api", version.ref = "net-portswigger-burp-extensions-montoya-api" }
org-apache-santuario-xmlsec = { module = "org.apache.santuario:xmlsec", version.ref = "org-apache-santuario-xmlsec" }
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import burp.api.montoya.ui.editor.extension.ExtensionProvidedHttpRequestEditor;
import burp.api.montoya.ui.editor.extension.HttpRequestEditorProvider;
import gui.CertificateTab;
import helpers.Flags;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import livetesting.LiveTestingTab;

import static java.util.Objects.requireNonNull;

Expand All @@ -34,6 +36,11 @@ public void initialize(MontoyaApi api) {
certificateTab.setCertificateTabController(certificateTabController);
api.userInterface().registerSuiteTab(certificateTabController.getTabCaption(), certificateTabController.getUiComponent());

if (Flags.DEBUG) {
var liveTestingTab = new LiveTestingTab();
api.userInterface().registerSuiteTab(liveTestingTab.caption(), liveTestingTab);
}

this.samlHighlighter = new SAMLHighlighter(this.certificateTab::getSamlRequestParameterName, this.certificateTab::getSamlResponseParameterName);
api.http().registerHttpHandler(samlHighlighter);

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/helpers/Flags.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package helpers;

public class Flags {

// Write SAMLRaiderDebug.log and load example certificates
public static final boolean DEBUG = false;

public static final boolean DEBUG = true;
}
113 changes: 113 additions & 0 deletions src/main/java/livetesting/LiveTestingTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package livetesting;

import burp.BurpExtender;
import com.google.common.reflect.ClassPath;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.stream.Collectors;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.border.EmptyBorder;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

public class LiveTestingTab extends JPanel {

public LiveTestingTab() {
setBorder(new EmptyBorder(10, 10, 10, 10));
var textPane = new JTextPane();
textPane.setEditable(false);
textPane.setBackground(Color.BLACK);
textPane.setForeground(Color.WHITE);
textPane.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));

var button = new JButton("Run tests");

setLayout(new BorderLayout(10, 10));
add(new JScrollPane(textPane), BorderLayout.CENTER);
add(button, BorderLayout.SOUTH);

button.addActionListener(listener -> {
textPane.setText("");

var document = textPane.getStyledDocument();

var inRed = new SimpleAttributeSet();
inRed.addAttribute(StyleConstants.Foreground, Color.RED);

var inGreen = new SimpleAttributeSet();
inGreen.addAttribute(StyleConstants.Foreground, Color.GREEN);

try {
var classLoader = this.getClass().getClassLoader();

var testClasses =
ClassPath.from(classLoader)
.getTopLevelClassesRecursive("livetesting")
.stream()
.filter(classInfo -> classInfo.getName().endsWith("Test"))
.map(ClassPath.ClassInfo::load)
.collect(Collectors.toSet());

for (var testClass : testClasses) {
document.insertString(document.getLength(), "%s\n".formatted(testClass.getSimpleName()), null);
var testInstance = testClass.getDeclaredConstructor().newInstance();

var testMethods = Arrays.stream(testClass.getDeclaredMethods())
.filter(method -> method.canAccess(testInstance))
.filter(method -> method.getReturnType().equals(TestResult.class))
.collect(Collectors.toSet());

for (var testMethod : testMethods) {
document.insertString(document.getLength(), " %s... ".formatted(testMethod.getName()), null);
var result = (TestResult) testMethod.invoke(testInstance);
document.insertString(
document.getLength(),
result.success() ? "success" : "failed",
result.success() ? inGreen : inRed);
if (result.message() != null) {
document.insertString(
document.getLength(),
"\n%s".formatted(result.message()),
inRed);
}
if (result.throwable() != null) {
var byteArrayOutputStream = new ByteArrayOutputStream();
var printStream = new PrintStream(byteArrayOutputStream);
result.throwable().printStackTrace(printStream);
document.insertString(
document.getLength(),
"\n%s".formatted(byteArrayOutputStream.toString()),
inRed);
}
document.insertString(document.getLength(), "\n", null);
}
}
} catch (Exception exc) {
BurpExtender.api.logging().logToError(exc);
var byteArrayOutputStream = new ByteArrayOutputStream();
var printStream = new PrintStream(byteArrayOutputStream);
exc.printStackTrace(printStream);
try {
document.insertString(
document.getLength(),
"\n%s".formatted(byteArrayOutputStream.toString()),
inRed);
} catch (BadLocationException exc1) {
BurpExtender.api.logging().logToError(exc1);
}
}
});
}

public String caption() {
return "SAML Raider Live Testing";
}
}
40 changes: 40 additions & 0 deletions src/main/java/livetesting/SamlMessageAnalyzerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package livetesting;

import application.SamlMessageAnalyzer;
import burp.api.montoya.http.message.requests.HttpRequest;

public class SamlMessageAnalyzerTest {

public TestResult isSAMLMessage() {
var raw = """
POST /api/oauth/saml HTTP/1.1
Host: sso.eu.boxyhq.com
Content-Length: 9984
Cache-Control: max-age=0
Sec-Ch-Ua: "Chromium";v="125", "Not.A/Brand";v="24"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Linux"
Upgrade-Insecure-Requests: 1
Origin: https://mocksaml.com
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.112 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://mocksaml.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Priority: u=0, i
Connection: keep-alive
RelayState=undefined&SAMLResponse=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbHA6UmVzcG9uc2UgRGVzdGluYXRpb249Imh0dHBzOi8vc3NvLmV1LmJveHlocS5jb20vYXBpL29hdXRoL3NhbWwiIElEPSJfNjhiYmM3NDlmM2Q5Nzc4Yzg4MDAiIElzc3VlSW5zdGFudD0iMjAyNC0wNi0xN1QwODo0OTo1NS40NzhaIiBWZXJzaW9uPSIyLjAiIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2w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mlidXRlVmFsdWU%2BPC9zYW1sOkF0dHJpYnV0ZT48L3NhbWw6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDpBc3NlcnRpb24%2BPC9zYW1scDpSZXNwb25zZT4%3D""";

var request = HttpRequest.httpRequest(raw);
var analysis = SamlMessageAnalyzer.analyze(request, "SAMLRequest", "SAMLResponse");
var success = analysis.isSAMLMessage();
return new TestResult(success, null, null);
}

}
4 changes: 4 additions & 0 deletions src/main/java/livetesting/TestResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package livetesting;

public record TestResult(boolean success, String message, Throwable throwable) {
}

0 comments on commit 5ca7ed2

Please sign in to comment.