Skip to content

Commit 1c3c429

Browse files
committed
IMDS stored attacks: only report as stored
1 parent 30ac4ab commit 1c3c429

1 file changed

Lines changed: 3 additions & 31 deletions

File tree

agent_api/src/main/java/dev/aikido/agent_api/vulnerabilities/ssrf/SSRFDetector.java

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,8 @@ public Attack run(String hostname, int port, List<String> ipAddresses, String op
2525

2626
String imdsIp = resolvesToImdsIp(new HashSet<>(ipAddresses), hostname);
2727
if (imdsIp != null) {
28-
// Check if hostname is in user input (context available)
29-
ContextObject context = Context.get();
30-
if (context != null) {
31-
FindHostnameInContext.Res attackFindings = findHostnameInContext(hostname, context, port);
32-
if (attackFindings != null) {
33-
// Regular SSRF - hostname found in user input
34-
return new Attack(
35-
operation,
36-
new Vulnerabilities.SSRFVulnerability(),
37-
attackFindings.source(),
38-
attackFindings.pathToPayload(),
39-
Map.of(
40-
"hostname", hostname,
41-
"privateIP", imdsIp
42-
),
43-
attackFindings.payload(),
44-
getCurrentStackTrace(),
45-
context.getUser()
46-
);
47-
}
48-
}
49-
50-
// Stored SSRF - no context or hostname not in user input
51-
Attack storedSsrfAttack = new Attack(
28+
// Stored SSRF - no context or hostname required in user input
29+
return new Attack(
5230
operation,
5331
new Vulnerabilities.StoredSSRFVulnerability(),
5432
null, // source is null for stored attacks
@@ -61,12 +39,6 @@ public Attack run(String hostname, int port, List<String> ipAddresses, String op
6139
getCurrentStackTrace(),
6240
null // user is null for stored attacks
6341
);
64-
65-
if(shouldBlock()) {
66-
throw SSRFException.get();
67-
}
68-
69-
return storedSsrfAttack;
7042
}
7143
if (!containsPrivateIP(ipAddresses)) {
7244
// No real danger, returning.
@@ -96,7 +68,7 @@ public Attack run(String hostname, int port, List<String> ipAddresses, String op
9668
context.getUser()
9769
);
9870
}
99-
71+
10072
return null;
10173
}
10274
}

0 commit comments

Comments
 (0)