summaryrefslogtreecommitdiff
path: root/lib/custodian/protocol-tests/ping.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-19 14:07:01 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-19 14:07:01 +0000
commit04297853c0804cada299bf233f760d9debc01a25 (patch)
tree8428c574d2d43c932cc3cb258136f21e73376785 /lib/custodian/protocol-tests/ping.rb
parent495c59efb1522699f978cabe28b42adf9014f492 (diff)
Ensure that hostnames used for ping-tests are valid - to avoid the security hole.
Diffstat (limited to 'lib/custodian/protocol-tests/ping.rb')
-rwxr-xr-xlib/custodian/protocol-tests/ping.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/custodian/protocol-tests/ping.rb b/lib/custodian/protocol-tests/ping.rb
index fed72d4..3243b6b 100755
--- a/lib/custodian/protocol-tests/ping.rb
+++ b/lib/custodian/protocol-tests/ping.rb
@@ -72,6 +72,21 @@ class PINGTest
# Get the hostname to test against.
#
host = @test_data['target_host']
+
+
+ #
+ # Sanity check the hostname for ping-tests, to
+ # avoid this security hole:
+ #
+ # $(/tmp/exploit.sh) must run ping ..
+ #
+ raise ArgumentError, "Invalid hostname for ping-test: #{host}" unless( host =~ /^([a-zA-Z0-9:\-\.]+)$/ )
+
+
+
+ #
+ # Show the hostname.
+ #
puts "ping testing host #{host}" if ( @test_data['verbose'] )