Last active
July 29, 2023 19:55
-
-
Save thedarkcolour/8d58cb778f795b7481ed053cb413b14b to your computer and use it in GitHub Desktop.
Julia script to check for any usages of ObjectInputStream in mod JARs in case of BleedingPipe exploit
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
# Script written by thedarkcolour | |
# To use, drop this script file into a mods folder and run it with the Julia REPL. | |
# Install ZipFile | |
using Pkg | |
Pkg.add("ZipFile") | |
using ZipFile | |
wd = @__DIR__ | |
println("Checking for ObjectInputStream usages in mod JAR files in $wd") | |
for (root, dirs, files) in walkdir(wd) | |
for file_name in files | |
file = joinpath(root, file_name) | |
if (endswith(file_name, ".jar")) | |
reader = ZipFile.Reader(file) | |
is_vulnerable = false | |
for innerFile in reader.files | |
if (occursin("ObjectInputStream", read(innerFile, String))) | |
is_vulnerable = true | |
break | |
end | |
if (is_vulnerable) | |
break | |
end | |
end | |
if (is_vulnerable) | |
println("Mod JAR $file_name uses ObjectInputStream and thus may be vulnerable to the BleedingPipe exploit! Ensure you are using a patched version.") | |
is_vulnerable = false | |
end | |
close(reader) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment