Skip to content

Instantly share code, notes, and snippets.

@kamilhism
Forked from markpundsack/heroku-CVE-2013-0156.rb
Created January 11, 2013 08:52
Show Gist options
  • Select an option

  • Save kamilhism/4509057 to your computer and use it in GitHub Desktop.

Select an option

Save kamilhism/4509057 to your computer and use it in GitHub Desktop.
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Brought to you by @elliottkember.
## Run this in an empty directory for best results.
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
# Some are appended by owner emails
app = app.split(" ")[0].to_s.strip
# Blank lines can be ommitted.
next if app == ""
puts ""
puts "Cloning #{app}..."
`git clone -q --depth=1 git@heroku.com:#{app}.git`
end
Dir.glob("*").each do |app_name|
version = `cat #{app_name}/Gemfile.lock |grep " rails (="`.strip
version = version.split(" (= ")[1].to_s.gsub(")", "").gsub("\n", "")
unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(version) or version == ""
puts "Uh oh! #{app_name} has #{version}."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment