if you’ve read the news recently, you must hear about the Log4Shell zero-day in log4j, this vulnerability affects at least millions of computer, system, and java applications. I won’t elaborate details here, for more information about this, you can check out from here.
In this article, I will be talking about how to add kong plugins to mitigate log4shell attacks, an engineer at Kong has developed a plugin to mitigate attacks. Kong said their kong products are not affected by log4shell.
Prepare
Download the below files to local. Kong Dockerfile will be used to build a new image, Kong Log4shell is a Kong plugin, and Luarocks is used to install plugin to Kong.
The image will be based on centos 8, plugin tar file, lurocks, lurocks-admin and kong configuration file are needed to place docker-kong/centos/ directory.

Enable Kong Plugin
To make kong aware that it has to look for our plugin, we need to add it to the plugins property in the configuration file, which is separated by a comma.

Update Dockerfile
I’ve updated official Dockerfile by copying luarocks, kong configuration, installing the kong plugin, and setting up permission.
Verify plugins
To make sure plugin is being loaded by Kong, we can start Kong with a debug
log level:

Conclusion
To wrap this up, let’s recap what we’ve learned in this post.
- Log4Shell is a remote code execution vulnerability in Log4J, a popular Java logging library
- No Kong products are affected by log4shell
- Kong-plugin-log4shell plugin can mitigate log4shell attack.
Reference
Log4J, Log4Shell and Kong – KongHQ
Plugin Development – (un)Installing your plugin – v2.7.x | Kong Docs (konghq.com)