Skip to content

Commit

Permalink
Initial release.
Browse files Browse the repository at this point in the history
  • Loading branch information
SPuttkammer committed Aug 10, 2019
1 parent 83d8d9d commit 23eb279
Show file tree
Hide file tree
Showing 110 changed files with 5,562 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.classpath
.project
.settings/
51 changes: 45 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ https://www.gnu.org/licenses/gpl-3.0.html


# Cyber Security Transformation Chef
The Cyber Security Transformation Chef (CSTC) is a Burp Suite extension. It is build be security experts to
extend the Burp Suite for chaining simple operations for each incomming or outgoing message.
The Cyber Security Transformation Chef (CSTC) is a Burp Suite extension. It is build for security experts to
extend Burp Suite for chaining simple operations for each incomming or outgoing message.
It can also be used to quickly make a special custom formatting for the message.

## Introduction
The [Burp Suite](https://portswigger.net/) is a general known tool which provides
[Burp Suite](https://portswigger.net/) is a general known tool which provides
a wide area of tools and functionality for conducting a web application penetration
test. One problem often encountered when using the Burp Suite for certain type of
web applications is the lack of a quick extensibility or the capability
Expand All @@ -23,17 +23,56 @@ of conducting basic operations on the messages.
The Burp Suite provides some functionality which can be used to adapt to certain scenarios
(i.e. the macro feature), however it is a time consuming process and error-prone.

With the years we developed a software that provides a GUI which is adapted from the well known
With the years we developed a software which provides a GUI which is adapted from the well known
[CyberChef](https://gchq.github.io/CyberChef/) providing several small operations which can be chained
to conduct complicated input transformations. There is no need of further coding. The extension eliminates
the need of having several plugins for input and output transformations because it is build in a more generic way.

The CSTC is especially useful for using the quite good capabilities of Burp Suite Professional (Burp Scanner, Backslash Powered Scanner, ...)
on web applications using client side calculated MACs, sequence numbers, or similiar.

It is also a great help at analyzing obfuscated HTTP based protocols, because it can be used to de- and reobfuscate the traffic
It is also a great help at analyzing obfuscated HTTP based protocols because it can be used to de- and reobfuscate the traffic
passing through the proxy. In this way, the analyst can concentrate on task of finding vulnerabilities
instead of writing new extensions for removing the obfuscation.

The plugin has been succesfully tested and decreased the time for performing the right tasks and not
"fighting with tool" to get what is needed to test.
"fighting with tool" to get what is needed to test.

## Prerequities
The CSTC can be used with either Burp Suite Free and Burp Suite Profesionnal.

## Installation

The CSTC is currently not listed in the Burp Extension Storage, but will be added there as soon as PortSwigger acknolwedges the Extension.

We suggest to pull the source code and build it yourself, because you should never trust binaries
and should always review the code which is used in a productive setting.

However, you can also pull a release from GitHub and install it by adding it the Burp Suite.

### Build Process

The build process is fairly easy. It currently requires a installed JDK and Maven to build.

You can build the extension with the following commands

```
git clone https://github.com/usdAG/cstc.git
cd cstc
mvn package
```

Maven will automatically load the dependencies for building the extension and will build
a jar containing all dependencies. The created Jar file CSTC-X.X.X-jar-with-dependencies in the target directory can be
installed in Burp using the Extender->Add function.

## Usage
The tool uses a GUI which basic idea similar to the CyberChef. However, it introduces
a concept which we call "lane". The output of the transformation is always determined
from the the last lane which has an active operation. Take a look at a basic tutorial
[here](https://www.youtube.com/watch?v=BUXvWfb_YWU).

## Feedback
We gladly appreciate all feedback, bug requests and feature requests.
Please understand that this tool is under active development and therefore will
probably contain some bugs.
Binary file modified logos/CSTC_White_Smaller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.usd.CSTC</groupId>
<artifactId>CSTC</artifactId>
<version>0.1.1</version>
<name>CSTC</name>
<description>CSTC</description>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>res</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>net.portswigger.burp.extender</groupId>
<artifactId>burp-extender-api</artifactId>
<version>1.7.22</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
</dependencies>
</project>
Binary file added res/disable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/stop_active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package burp;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JMenuItem;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import javax.swing.text.JTextComponent;

import de.usd.cstchef.view.FormatTab;
import de.usd.cstchef.view.RecipePanel;
import de.usd.cstchef.view.View;

public class BurpExtender implements IBurpExtender, ITab, IMessageEditorTabFactory, IHttpListener, IContextMenuFactory {

private final String extensionName = "CSTC";
private IBurpExtenderCallbacks callbacks;
private View view;

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) {
this.callbacks = callbacks;
Logger.getInstance().init(callbacks.getStdout(), callbacks.getStderr());
BurpUtils.getInstance().init(callbacks);

callbacks.setExtensionName(this.extensionName);
callbacks.addSuiteTab(this);
callbacks.registerHttpListener(this);
callbacks.registerContextMenuFactory(this);
callbacks.registerMessageEditorTabFactory(this);
}


@Override
public String getTabCaption() {
return this.extensionName;
}

@Override
public Component getUiComponent() {
this.view = new View();
return this.view;
}

@Override
public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequestResponse messageInfo) {
if (messageIsRequest && view.getOutgoingRecipePanel().shouldProcess(toolFlag)) {
byte[] request = messageInfo.getRequest();
byte[] modifiedRequest = view.getOutgoingRecipePanel().bake(request);
Logger.getInstance().log("modified request: \n" + new String(modifiedRequest));
messageInfo.setRequest(modifiedRequest);
} else if (view.getIncomingRecipePanel().shouldProcess(toolFlag)) {
byte[] response = messageInfo.getResponse();
byte[] modifiedResponse = view.getIncomingRecipePanel().bake(response);
messageInfo.setResponse(modifiedResponse);
Logger.getInstance().log("modified response: \n" + new String(modifiedResponse));
}
}

@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation invoc) {

List<JMenuItem> menuItems = new ArrayList<>();
JMenuItem incomingMenu = new JMenuItem("Send to CSTC (Incoming)");
JMenuItem outgoingMenu = new JMenuItem("Send to CSTC (Outgoing)");
JMenuItem incomingFormatMenu = new JMenuItem("Send to CSTC (Formating)");

menuItems.add(incomingMenu);
menuItems.add(outgoingMenu);
menuItems.add(incomingFormatMenu);

incomingMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpRequestResponse[] msgs = invoc.getSelectedMessages();
if (msgs != null && msgs.length > 0) {
view.getIncomingRecipePanel().setInput(new String(msgs[0].getResponse()));
}
}
});

outgoingMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpRequestResponse[] msgs = invoc.getSelectedMessages();
if (msgs != null && msgs.length > 0) {
view.getOutgoingRecipePanel().setInput(new String(msgs[0].getRequest()));
}

}
});

incomingFormatMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHttpRequestResponse[] msgs = invoc.getSelectedMessages();
if (msgs != null && msgs.length > 0) {
view.getFormatRecipePanel().setInput(new String(msgs[0].getRequest()));
}
}
});

return menuItems;
}

@Override
public IMessageEditorTab createNewInstance(IMessageEditorController controller, boolean editable) {
RecipePanel requestFormatPanel = this.view.getOutgoingRecipePanel();
// TODO do we need the format panel or do we want to use the incoming recipe?
RecipePanel responseFormatPanel = this.view.getFormatRecipePanel();
return new FormatTab(requestFormatPanel, responseFormatPanel, editable);
}
}
38 changes: 38 additions & 0 deletions src/burp/BurpUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package burp;

public class BurpUtils {

private static BurpUtils instance;
private IBurpExtenderCallbacks callbacks;

public static BurpUtils getInstance() {
if (BurpUtils.instance == null) {
BurpUtils.instance = new BurpUtils();
}
return BurpUtils.instance;
}

private BurpUtils() {
}

public void init(IBurpExtenderCallbacks callbacks) {
this.callbacks = callbacks;
}

public IBurpExtenderCallbacks getCallbacks() throws IllegalAccessError {
if (this.callbacks == null) {
throw new IllegalAccessError("Only works within burpsuite");
}
return callbacks;
}

public static boolean inBurp() {
try {
BurpUtils.getInstance().getCallbacks();
return true;
} catch (IllegalAccessError e) {
return false;
}
}

}
44 changes: 44 additions & 0 deletions src/burp/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package burp;

import java.io.OutputStream;
import java.io.PrintWriter;

public class Logger {

private static Logger instance;

private PrintWriter stdout;
private PrintWriter stderr;

public static Logger getInstance() {
if (Logger.instance == null) {
Logger.instance = new Logger();
}
return Logger.instance;
}

private Logger() {

}

public void init(OutputStream stdOut, OutputStream stdErr) {
this.stdout = new PrintWriter(stdOut, true);
this.stderr = new PrintWriter(stdErr, true);
}

public void log(String msg) {
if (this.stdout == null) {
System.out.println(msg);
} else {
this.stdout.println(msg);
}
}

public void err(String msg) {
if (this.stderr == null) {
System.err.println(msg);
} else {
this.stderr.println(msg);
}
}
}
Loading

0 comments on commit 23eb279

Please sign in to comment.