From 2232877d03d03fd1b015c56d9e87f7b67ab98345 Mon Sep 17 00:00:00 2001 From: Christophe De La Fuente Date: Tue, 26 Sep 2023 13:26:02 +0200 Subject: [PATCH 1/3] Properly clone the path strings before storing them --- lib/msf/core/exploit/file_dropper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msf/core/exploit/file_dropper.rb b/lib/msf/core/exploit/file_dropper.rb index 85b0904029e3..cb947b6a6e82 100644 --- a/lib/msf/core/exploit/file_dropper.rb +++ b/lib/msf/core/exploit/file_dropper.rb @@ -40,7 +40,7 @@ def initialize(info = {}) # exploiting). # @return [void] def register_files_for_cleanup(*files) - @dropped_files += files + @dropped_files += files.map(&:clone) end def allow_no_cleanup @@ -56,7 +56,7 @@ def allow_no_cleanup # exploiting). # @return [void] def register_dirs_for_cleanup(*dirs) - @dropped_dirs += dirs + @dropped_dirs += dirs.map(&:clone) end # Singular versions From 5f438f729d12db0c334169909e929fd59a509be9 Mon Sep 17 00:00:00 2001 From: Christophe De La Fuente Date: Tue, 17 Oct 2023 12:19:03 +0200 Subject: [PATCH 2/3] Use #dup instead of #clone --- lib/msf/core/exploit/file_dropper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msf/core/exploit/file_dropper.rb b/lib/msf/core/exploit/file_dropper.rb index cb947b6a6e82..642e12f204d2 100644 --- a/lib/msf/core/exploit/file_dropper.rb +++ b/lib/msf/core/exploit/file_dropper.rb @@ -40,7 +40,7 @@ def initialize(info = {}) # exploiting). # @return [void] def register_files_for_cleanup(*files) - @dropped_files += files.map(&:clone) + @dropped_files += files.map(&:dup) end def allow_no_cleanup From 0b7a1bfcf7f37fcba3ad8e29f8bc240cf940f966 Mon Sep 17 00:00:00 2001 From: Christophe De La Fuente Date: Tue, 17 Oct 2023 12:39:23 +0200 Subject: [PATCH 3/3] Use #dup instead of #clone #2 --- lib/msf/core/exploit/file_dropper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msf/core/exploit/file_dropper.rb b/lib/msf/core/exploit/file_dropper.rb index 642e12f204d2..b104a125861e 100644 --- a/lib/msf/core/exploit/file_dropper.rb +++ b/lib/msf/core/exploit/file_dropper.rb @@ -56,7 +56,7 @@ def allow_no_cleanup # exploiting). # @return [void] def register_dirs_for_cleanup(*dirs) - @dropped_dirs += dirs.map(&:clone) + @dropped_dirs += dirs.map(&:dup) end # Singular versions