Created
September 24, 2014 22:02
-
-
Save AndrewVos/b99e866048ca319147fa to your computer and use it in GitHub Desktop.
bash-vulnerability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ip addresses | |
servers = [ | |
"1.1.1.1" | |
] | |
user = "ubuntu" | |
servers.each do |server| | |
puts server | |
system "scp -q -p test-for-vulnerability #{user}@#{server}:~" | |
vulnerable = `ssh #{user}@#{server} /home/#{user}/test-for-vulnerability`.include?("vulnerable") | |
if vulnerable | |
puts "VULNERABLE!" | |
system "ssh ubuntu@#{server} 'bash --version |head -n 1'" | |
system "ssh ubuntu@#{server} 'sudo apt-get update -y && sudo apt-get -y install bash'" | |
else | |
puts "NOT VULNERABLE!" | |
end | |
puts | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
env x='() { :;}; echo vulnerable' bash -c "echo this is a test" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes: