
Log4j 漏洞本地检测脚本。 Scan all java processes on your host to check whether it's affected by log4j2 remote code execution vulnerability (CVE-2021-45046)
Log4j vulnerability local detection script, scans all java processes on the host, detects whether a vulnerable log4j-core jar package has been introduced, and whether it may be subject to remote code execution attacks (CVE-2021-45046). Uploads the scan report to the specified server.
Scan all java processes on your host to check whether it's affected by log4j2 remote code execution(CVE-2021-45046), then upload the report to your api server.
Works under python2.7 / 2.6 / 3.x, no extra lib required.
java processes on the hostjava processeslog4j-core-* jar packageslog4j-core-* jar packagesJndiLookup.classJndiLookup.class, based on its version number, jvm parameters, OS environment variables, whether it is a docker container process, k8s process, output whether the vulnerability exists, and output upgrade suggestionsjava process on the hostjar files open by the java processlog4j-core-*.jarlog4j-core-*.jarJndiLookup.class in log4j-core-*.jarJndiLookup.class found,output some tips based on its version 、jvm args、OS env args、is docker container、is k8sCan be integrated into an Agent, or the scan script can be delivered for one-time execution. You can also log in to the OPS machine and scan the entire network with one click.
You can use the script as a module by your agent, or deliver and run it only once.
Those who don't have an easy to use agent can run command below on your OPS server.
cat hosts.txt|xargs -P 5 -I{} sh -c 'ssh root@{} -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null "wget http://your_site/to_download/log4j2_vul_scanner.py -O /tmp/log4j2_vul_scanner.py -q && python /tmp/log4j2_vul_scanner.py && /usr/bin/rm /tmp/log4j2_vul_scanner.py" > ./logs.txt||exit 0'