Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion lib/aikido/zen/scanners/stored_ssrf_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def initialize(hostname, addresses, config: Aikido::Zen.config)
def attack?
return unless @config.stored_ssrf? # Feature flag

return if @config.imds_allowed_hosts.include?(@hostname)
return if @config.imds_allowed_hosts.include?(@hostname.chomp("."))

@addresses.find do |address|
DANGEROUS_ADDRESSES.any? do |dangerous_address|
Expand Down
2 changes: 2 additions & 0 deletions test/aikido/zen/scanners/stored_ssrf_scanner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def refute_attack(hostname, addresses, reason = "`#{hostname}` was blocked")
test "allows known hosts that resolve to dangerous addresses" do
refute_attack "metadata.google.internal", ["169.254.169.254"]
refute_attack "metadata.goog", ["169.254.169.254"]
refute_attack "metadata.google.internal.", ["169.254.169.254"]
refute_attack "metadata.goog.", ["169.254.169.254"]
end

test "allows hostnames that are trying to access the IMDS service when the stored SSRF scanning is disabled" do
Expand Down
Loading