Skip to content

Instantly share code, notes, and snippets.

@samuels410
Created December 17, 2021 05:52
Show Gist options
  • Save samuels410/13d05124b621ff301752a48ed323df07 to your computer and use it in GitHub Desktop.
Save samuels410/13d05124b621ff301752a48ed323df07 to your computer and use it in GitHub Desktop.
check log 4j vulnurability
echo "checking for log4j vulnerability..."
OUTPUT="$(locate log4j|grep -v log4js)"
if [ "$OUTPUT" ]; then
echo "[WARNING] maybe vulnerable, those files contain the name:"
echo "$OUTPUT"
fi
OUTPUT="$(dpkg -l|grep log4j|grep -v log4js)"
if [ "$OUTPUT" ]; then
echo "[WARNING] maybe vulnerable, dpkg installed packages:"
echo "$OUTPUT"
fi
if [ "$(command -v java)" ]; then
echo "java is installed, so note that Java applications often bundle their libraries inside jar/war/ear files, so there still could be log4j in such applications."
fi
echo "If you see no output above this line, you are safe. Otherwise check the listed files and packages."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment