Last active
December 10, 2015 22:38
-
-
Save omgitsads/4503139 to your computer and use it in GitHub Desktop.
Look for affected versions of rails, and if they have been patched or not
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
for i in `find /data -maxdepth 1 -type d ! -name "monit.d" ! -name "nginx" ! -name "lost+found" ! -name "homedirs" ! -name "data"`; | |
do | |
appname=`echo ${i} | awk -F/ '{print $3}'` | |
version='' | |
if [ -f $i/current/Gemfile.lock ]; | |
then | |
version=`egrep "^ *rails \([0-9\.]+\)" $i/current/Gemfile.lock | egrep -o "[0-9\.]+"` | |
else | |
version=`gem list | egrep -o "^rails \([^,\)]+" | egrep -o "[0-9\.]+"` | |
fi | |
if [[ $version != 3.2.11 && $version != 3.1.10 && $version != 3.0.19 && $version != 2.3.15 ]]; | |
then | |
if [[ -d "$i/current/config/initializers" ]]; | |
then | |
grep -q "ActiveSupport::XmlMini::PARSING.delete" $i/current/config/initializers/* | |
patched=$? | |
if [ $patched != 0 ]; | |
then | |
echo -e "\033[31mApp: ${appname} - Rails Version: ${version} - Vulnerability Possible" | |
else | |
echo -e "\033[33mApp: ${appname} - Rails Version: ${version} - CVE-2013-0156 Looks to be patched" | |
fi | |
else | |
echo -e "\033[33mApp: ${appname} - Rails Version: ${version} - No Initializers dir, may not be a rails app" | |
fi | |
else | |
echo -e "\033[32mApp: ${appname} - Rails Version: ${version} - CVE-2013-0156 Patched" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Patched and we dumped the affected variable