Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
11b9a12
wip
seran Aug 11, 2025
df5ead9
Merge branch 'vulnerability-analyser' into ssrf-manual
seran Aug 11, 2025
1635e33
Merge branch 'vulnerability-analyser' into ssrf-manual
seran Aug 13, 2025
59469ad
refactor
seran Aug 13, 2025
a5d492f
wip
seran Aug 13, 2025
ccc6728
Merge branch 'master' into ssrf-manual
seran Aug 18, 2025
3912c94
clean-up
seran Aug 18, 2025
94e6e44
minor clean-up
seran Aug 18, 2025
951486b
Merge branch 'master' into ssrf-manual
seran Aug 19, 2025
eda1178
disabled e2e
seran Aug 19, 2025
4d25212
replacing GeneUtils new method
seran Aug 19, 2025
2548e6c
minor change
seran Aug 19, 2025
6ac1233
clean-up
seran Aug 19, 2025
e70c9bd
Merge branch 'master' into ssrf-manual
seran Aug 19, 2025
ad9ee31
Merge branch 'master' into ssrf-manual
seran Aug 20, 2025
2178a7b
Merge branch 'master' into ssrf-manual
seran Aug 26, 2025
0deab30
Merge branch 'ssrf-new-cases' into ssrf-manual
seran Aug 26, 2025
6e616e1
minor cleanup
seran Aug 26, 2025
e43daf9
comments
seran Aug 26, 2025
66ef6fb
Merge branch 'master' into ssrf-manual
seran Aug 26, 2025
c2ab99a
minor changes
seran Aug 26, 2025
feaed32
clean-ups
seran Aug 26, 2025
cf17bd3
trying to fix
seran Aug 26, 2025
15d9f59
regex fix
seran Aug 26, 2025
d21448d
updated regex
seran Aug 26, 2025
d4ae995
UrlHttpGene setValueBasedOn
seran Aug 26, 2025
4fa1214
InetGene
seran Aug 26, 2025
fa0fe30
disabled e2e
seran Aug 26, 2025
54c674e
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 26, 2025
529cde9
UrlHttpGene without path
seran Aug 26, 2025
f7bf294
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 26, 2025
59b20a4
minor change
seran Aug 26, 2025
9732002
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 27, 2025
bce1aae
minor change
seran Aug 27, 2025
217ad30
working setValueBasedOn for ArrayGene
seran Aug 27, 2025
31af1aa
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 27, 2025
728af1b
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 28, 2025
d001aaf
Merge branch 'ssrf-e2e-cleanup' into ssrf-manual
seran Aug 28, 2025
3fa798a
Merge branch 'ssrf-e2e-cleanup' into ssrf-manual
seran Aug 28, 2025
9f1a1f4
Merge branch 'master' into ssrf-manual
seran Aug 28, 2025
1d20a69
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 28, 2025
6032fa3
Merge branch 'urlgene-string' into ssrf-manual
seran Aug 28, 2025
25d268d
fixes
seran Aug 29, 2025
6179a3b
comments
seran Aug 29, 2025
e89f726
clean-up
seran Aug 29, 2025
17f4356
updated url pattern
seran Aug 29, 2025
fa97ac3
clean-up
seran Aug 29, 2025
9b5f263
disabled e2e
seran Aug 29, 2025
20093d5
clean-up
seran Aug 29, 2025
95f59a2
trying to fix
seran Aug 29, 2025
b719399
minor change
seran Aug 29, 2025
25aa903
clean-up
seran Aug 29, 2025
b90473a
disabled e2e
seran Aug 29, 2025
d321cc0
Merge branch 'master' into ssrf-manual
seran Aug 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/main/kotlin/org/evomaster/core/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Main {

resetExternalServiceHandler(injector)

resetHTTPCallbackVerifier(injector)
stopHTTPCallbackVerifier(injector)

val statistics = injector.getInstance(Statistics::class.java)
val data = statistics.getData(solution)
Expand Down Expand Up @@ -1019,9 +1019,9 @@ class Main {
externalServiceHandler.reset()
}

private fun resetHTTPCallbackVerifier(injector: Injector) {
private fun stopHTTPCallbackVerifier(injector: Injector) {
val httpCallbackVerifier = injector.getInstance(HttpCallbackVerifier::class.java)
httpCallbackVerifier.reset()
httpCallbackVerifier.stop()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,12 @@ abstract class AbstractRestFitness : HttpWsFitness<RestIndividual>() {
}

// FIXME: Code never reach this when we recompute the fitness under SSRFAnalyser
// So the faults never get marked.
// ResourceRestFitness get invoked during the recompute
// When the execution reach this during recomputing fitness, [HttpCallbackVerifier]
// WireMock seems to be [null].
// Due to that the method will never return true if any calls made.
if (config.security && config.ssrf) {
if (ssrfAnalyser.anyCallsMadeToHTTPVerifier(a)) {
// Code reach this point during the search, which is unnecessary during search
rcr.setVulnerableForSSRF(true)
}
}
Expand Down Expand Up @@ -1205,8 +1207,8 @@ abstract class AbstractRestFitness : HttpWsFitness<RestIndividual>() {
idMapper.getFaultDescriptiveId(DefinedFaultCategory.SSRF, it.getName())
)
fv.updateTarget(scenarioId, 1.0, it.positionAmongMainActions())
val paramName = ssrfAnalyser.getVulnerableParameterName(it)

val paramName = ssrfAnalyser.getVulnerableParameterName(it)
ar.addFault(DetectedFault(DefinedFaultCategory.SSRF, it.getName(), paramName))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,24 @@ class HttpCallbackVerifier {

@PreDestroy
fun destroy() {
resetHTTPVerifier()
stop()
}

fun initWireMockServer() {
fun prepare() {
if (isActive) {
return
}

try {
val config = WireMockConfiguration()
.extensions(ResponseTemplateTransformer(false))
.port(config.httpCallbackVerifierPort)

wireMockServer = WireMockServer(config)
wireMockServer!!.start()
wireMockServer!!.stubFor(getDefaultStub())
val wm = WireMockServer(config)
wm.start()
wm.stubFor(getDefaultStub())

wireMockServer = wm
} catch (e: Exception) {
throw RuntimeException(
e.message +
Expand All @@ -63,10 +69,9 @@ class HttpCallbackVerifier {
}

fun isCallbackURL(value: String): Boolean {
// Regex pattern looks for URL contains [HTTP_CALLBACK_VERIFIER] address and [HTTPCallbackVerifier]
// port, along with the path /sink/ and UUID as token generated to make the callback URL unique.
// Regex pattern looks for URL contains the pattern generated by the [HTTPCallbackVerifier].
val pattern =
"""^http:\/\/localhost:${config.httpCallbackVerifierPort}\/sink\/.{36}""".toRegex()
"""^http:\/\/localhost:${config.httpCallbackVerifierPort}\/EM_SSRF_\d+$""".toRegex()

return pattern.matches(value)
}
Expand All @@ -75,7 +80,9 @@ class HttpCallbackVerifier {
* Method generates a unique callback link to be used as payload for SSRF.
*/
fun generateCallbackLink(name: String): String {
val ssrfPath = "/sink/${counter++}"
// FIXME: sink/EM_0 <- slash get replaced with a comma at some point, which fails
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a problem too, for some reason slash after sink get replaced with a comma when recomputing the fitness.

// the verification based on the metadata
val ssrfPath = "/EM_SSRF_${counter++}"

wireMockServer!!.stubFor(
WireMock.any(WireMock.urlEqualTo(ssrfPath))
Expand All @@ -86,7 +93,6 @@ class HttpCallbackVerifier {
.withStatus(200)
.withBody("OK")
)

)

val link = "http://localhost:${wireMockServer!!.port()}$ssrfPath"
Expand All @@ -98,12 +104,12 @@ class HttpCallbackVerifier {

/**
* @param name represents the Action name
*
* During stub creation, stubs are tagged with Action name in the metadata.
*/
fun verify(name: String): Boolean {
if (isActive) {
wireMockServer!!.allServeEvents
wireMockServer!!
.allServeEvents
.filter { event -> event.wasMatched }
.forEach { e ->
val matched = e.stubMapping.metadata
Expand All @@ -116,14 +122,14 @@ class HttpCallbackVerifier {
return false
}

fun resetHTTPVerifier() {
fun reset() {
wireMockServer?.resetAll()
wireMockServer?.stubFor(getDefaultStub())
actionCallbackLinkMapping.clear()
counter = 0
}

fun reset() {
fun stop() {
counter = 0
wireMockServer?.stop()
wireMockServer = null
Expand Down
Loading
Loading