From 304a28f22549754e4b519d522ef60fb906f7cb1d Mon Sep 17 00:00:00 2001 From: seran <7030273+seran@users.noreply.github.com> Date: Mon, 6 Oct 2025 12:40:53 +0200 Subject: [PATCH] additional status codes --- .../problem/security/service/SSRFAnalyser.kt | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/core/src/main/kotlin/org/evomaster/core/problem/security/service/SSRFAnalyser.kt b/core/src/main/kotlin/org/evomaster/core/problem/security/service/SSRFAnalyser.kt index 80b47bb703..faf97f880e 100644 --- a/core/src/main/kotlin/org/evomaster/core/problem/security/service/SSRFAnalyser.kt +++ b/core/src/main/kotlin/org/evomaster/core/problem/security/service/SSRFAnalyser.kt @@ -94,11 +94,16 @@ class SSRFAnalyser { fun apply(): Solution { LoggingUtil.getInfoLogger().info("Applying {}", SSRFAnalyser::class.simpleName) - individualsInSolution = getIndividualsWithStatus2XX() + val individualsWith2XX = getIndividualsWithStatus2XX() + + // Note: In some cases with black-box, we may not be able to get HTTP 200 + // while, there is a possibility for a SSRF. As a temporary fix, we are + // selecting individuals with HTTP 400 and 422 status codes. + val individualsWith4XX = getIndividualsWithStatus4XX() + + individualsInSolution = individualsWith2XX + individualsWith4XX if (individualsInSolution.isEmpty()) { - // FIXME: If the [individualsInSolution] is empty, we need to look for individuals - // with 400 and 422 return archive.extractSolution() } @@ -119,10 +124,6 @@ class SSRFAnalyser { // execute analyse() - // TODO: This is for development, remove it later - val individualsAfterExecution = getIndividualsWithStatus2XX() - log.debug("Total individuals after vulnerability analysis: {}", individualsAfterExecution.size) - return archive.extractSolution() } @@ -342,4 +343,10 @@ class SSRFAnalyser { statusGroup = StatusGroup.G_2xx ) } + private fun getIndividualsWithStatus4XX(): List> { + return RestIndividualSelectorUtils.findIndividuals( + this.archive.extractSolution().individuals, + statusCodes = listOf(400, 422) + ) + } }