openHAB and the log4j security vulnerability

Dear all,

You might have read yesterday in the IT press about the critical remote code injection vulnerability in the popular log4j library. This affects a huge amount of Java-based software and servers.

openHAB uses log4j as well (as part of Karaf) for logging, so what exactly does this mean for you?

First of all: For exploiting the vulnerability, an attacker must have access to your server or at least be able to interact in a way with it that would let openHAB log some of his input. So as long as you operate openHAB within your local network, do not expose it to the Internet directly and do not consume arbitrary input from untrusted remote servers, you should be fine. Note that myopenHAB is NOT affected, since it isn’t using Java/log4j.

Any openHAB instance that is publicly available (like or which consumes untrusted content from remote servers should be secured against this attack, though.
The current openHAB 3.2 snapshot build #2618 (and thus also the soon to be released 3.2 version) is already immune to the vulnerability. As there is an easy mitigation possible, we decided to not do any patch releases for older openHAB versions as we know that many of you are still running 2.5 and other versions, where we do not have the means to provide patch releases anymore anyhow.

Instead, we want to give you instructions on how to manually patch your existing instance. @Flole was so kind to spend last night on intensely testing the mitigation and summarizing it all in detail for you - huge kudos to him for this effort! Here is what he has prepared for all of you:

For those who want to mitigate the issue right now without updating I have written instructions down (including a simple test to see if it worked at the end of this post): Depending on which Operating System and installation method you are using there are 4 ways to use the workaround:

Linux (package manager installations)

These instructions apply if on your system the file /etc/default/openhab exists, or if you are using openHAB 2 and the file /etc/default/openhab2 exists. If it doesn’t please skip this until the Linux (“portable” method)-section.

In order to mitigate the issue you need to add


to EXTRA_JAVA_OPTS in /etc/default/openhab . If you are still on openHAB 2.x then that file would be /etc/default/openhab2 .

For example:


If you already have other options in there, you can separate it with a space and add it to the end like this

EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Berlin -Dlog4j2.formatMsgNoLookups=true" 

After that restart openHAB and you are done.

Linux (“portable” method) or macOS

In your or add this line

export JAVA_OPTS="-Dlog4j2.formatMsgNoLookups=true"

right above

exec "${RUNTIME}/bin/karaf" "${@}"

After that restart your openHAB instance.

Windows (not installed as service)

If you are using the start.bat file or start_debug.bat file then you need to add

set EXTRA_JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true

in the start.bat or start_debug.bat file right above the

"%RUNTIME%\bin\karaf.bat" %*


After that restart your openHAB instance.

Windows (installed as service)

If you are running openHAB using the service-wrapper then you need to add to your openHAB-wrapper.conf

where XX is the next available number in the sequence of lines. So if you have


the next available number would be 19 so you just add

After that restart your openHAB instance.

How to check if it worked

The easiest way to verify if that worked is to use the karaf command

system:property log4j2.formatMsgNoLookups

if it says anything other than “true”, it did not work. If it says “true” then it worked.

I hope this clarifies all questions that you might have on this topic. If not, feel free to join this thread to clarify anything that you might have on your mind.

Best regards,


Small update:
We have now also published an official security advisory.

As you can see in it, we have also published the new patch releases 3.0.4 and 3.1.1 for all openHAB users that are on versions 3.0 or 3.1 and that don’t want to apply the manual fix mentioned above.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.