diff --git a/build.gradle.kts b/build.gradle.kts
index 71cd9a6..48347cf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,7 @@ plugins {
kotlin("jvm") version "1.4.10"
}
-val projectVersion = "0.1.0"
+val projectVersion = "0.2.0"
repositories {
mavenCentral()
diff --git a/src/main/kotlin/b4dpxl/EvalScanIssue.kt b/src/main/kotlin/b4dpxl/EvalScanIssue.kt
index d6a7397..ce0468c 100644
--- a/src/main/kotlin/b4dpxl/EvalScanIssue.kt
+++ b/src/main/kotlin/b4dpxl/EvalScanIssue.kt
@@ -2,11 +2,17 @@ package b4dpxl
import burp.IHttpRequestResponse
import burp.IHttpService
-import burp.IRequestInfo
import burp.IScanIssue
import java.net.URL
-class EvalScanIssue(requestResponse: IHttpRequestResponse, url: String, detail: String, severity: String = "Medium", confidence: String = "Firm") : IScanIssue {
+class EvalScanIssue(requestResponse: IHttpRequestResponse, url: String, detail: String, severity: String = "Medium",
+ confidence: Confidence = Confidence.FIRM) : IScanIssue {
+
+ enum class Confidence(val confidence: String) {
+ CERTAIN("Certain"),
+ FIRM("Firm"),
+ TENTATIVE("Tentative")
+ }
val _url: URL
val _detail = detail.trim()
@@ -29,7 +35,7 @@ class EvalScanIssue(requestResponse: IHttpRequestResponse, url: String, detail:
}
override fun getIssueName(): String {
- return "JavaScript eval() call"
+ return "JavaScript eval() or Function() call"
}
override fun getIssueType(): Int {
@@ -41,11 +47,16 @@ class EvalScanIssue(requestResponse: IHttpRequestResponse, url: String, detail:
}
override fun getConfidence(): String {
- return _confidence
+ return _confidence.confidence.toString()
}
override fun getIssueBackground(): String? {
- return """eval()
is a dangerous JavaScript function, which executes arbitrary code in the context of the caller. If an attacker can influence the code which is called, they can run custom scripts and exploit vulnerabilities such as Cross-Site Scripting (XSS). Alternative, safe methods can usually be found which do not rely on the eval() and related Function() methods."""
+ return """eval()
is a dangerous JavaScript function, which executes arbitrary code in the
+ |context of the caller. If an attacker can influence the code which is called, they can run custom
+ |scripts and exploit vulnerabilities such as Cross-Site Scripting (XSS). Although not as
+ |dangerous, calls to Function()
or new Function()
may also be
+ |exploited in the same manner. Alternative, safe methods can usually be found which do
+ |not rely on the eval() and related Function() methods.""".trimMargin()
}
override fun getRemediationBackground(): String? {
diff --git a/src/main/kotlin/b4dpxl/Evaluator.kt b/src/main/kotlin/b4dpxl/Evaluator.kt
index f75f072..fe53a7c 100644
--- a/src/main/kotlin/b4dpxl/Evaluator.kt
+++ b/src/main/kotlin/b4dpxl/Evaluator.kt
@@ -22,7 +22,7 @@ class Evaluator constructor(callbacks: IBurpExtenderCallbacks?) : IProxyListener
private val configCallback = "callback"
init {
- Utilities(callbacks, true)
+ Utilities(callbacks, false)
Utilities.callbacks.setExtensionName(extensionName)
Utilities.callbacks.registerProxyListener(this)
Utilities.callbacks.registerExtensionStateListener(this)
@@ -53,13 +53,13 @@ class Evaluator constructor(callbacks: IBurpExtenderCallbacks?) : IProxyListener
break
}
}
- Utilities.println("Loaded ${extensionName}!")
+ Utilities.println("Loaded ${extensionName}")
}
override fun processProxyMessage(messageIsRequest: Boolean, proxyMessage: IInterceptedProxyMessage) {
if (! enabledMenu.isSelected) {
- return;
+ return
}
val requestResponse = proxyMessage.messageInfo
@@ -86,7 +86,7 @@ class Evaluator constructor(callbacks: IBurpExtenderCallbacks?) : IProxyListener
val issue = EvalScanIssue(
requestResponse,
baseURL,
- """
The page called the JavaScript eval()
function from ${requestInfo.url}
The page called the JavaScript ${json.getValue("function")}()
function from ${requestInfo.url}
Executed call: ${json.getValue("call")}
Note: The eval()
call was renamed to ${evalNamePrefix}_eval()
by ${extensionName}.
Note: The ${json.getValue("function")}()
call was renamed to ${evalNamePrefix}_${json.getValue("function")}()
by ${extensionName}.