Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21657 closed defect (fixed)

[PATCH] Update log4j to 2.15.0 (CVE-2021-44228)

Reported by: taylor.smock Owned by: team
Priority: normal Milestone:
Component: Plugin Version:
Keywords: log4j cve Cc:

Description (last modified by taylor.smock)

This fixes CVE-2021-44228 by default.

In addition there are some other enhancements, but it does claim to be binary compatible with previous releases.

log4j is used directly or indirectly by the following plugins:

  • areaselector
  • routing
  • ImportImagePlugin
  • kendzi3d

AFAIK, none of those have remote control capabilities, so the CVE shouldn't affect JOSM.

Attachments (3)

21657.patch (971 bytes ) - added by taylor.smock 3 years ago.
Bump log4j version
21657.proguard.patch (760 bytes ) - added by taylor.smock 3 years ago.
Update proguard-ant for log4j
21657.2.17.1.patch (3.1 KB ) - added by taylor.smock 3 years ago.
Update Log4J to 2.17.1. This fixes CVE-2021-44832.

Download all attachments as: .zip

Change History (39)

by taylor.smock, 3 years ago

Attachment: 21657.patch added

Bump log4j version

comment:1 by taylor.smock, 3 years ago

Description: modified (diff)

comment:2 by anonymous, 3 years ago

Resolution: duplicate
Status: newclosed

comment:3 by anonymous, 3 years ago

Resolution: duplicate
Status: closedreopened

comment:4 by Klumbumbus, 3 years ago

Milestone: 21.11

I guess this should be fixed with the next release.

comment:5 by SimonPoole, 3 years ago

IMHO the pointer to "remote control capabilities, so the CVE shouldn't affect JOSM." is misleading as the the "feature" could just as easily be used via a logged OSM tag or similar input.

comment:6 by skyper, 3 years ago

On Linux, I have the system libraries liblog4j1.2-java and liblog4j2-java installed. Do I still need the plugin?

comment:7 by Don-vip, 3 years ago

The plugin doesn't try to use native libraries, it uses only the shipped version.

comment:8 by Don-vip, 3 years ago

Resolution: fixed
Status: reopenedclosed

In 35874/osm:

fix #21657 - update to log4j 2.15.0 (CVE-2021-44228)

comment:9 by skyper, 3 years ago

Milestone: 21.11

comment:10 by Don-vip, 3 years ago

In 35875/osm:

see #21657 - dist

in reply to:  5 comment:11 by taylor.smock, 3 years ago

Replying to SimonPoole:

IMHO the pointer to "remote control capabilities, so the CVE shouldn't affect JOSM." is misleading as the the "feature" could just as easily be used via a logged OSM tag or similar input.

Most of the affected plugins don't do anything with tags, or are broken for most users. routing is _probably_ the only one that (a) isn't broken and (b) does stuff with tags. It does actually log tags (weight/speed). TBH, we probably ought to replace the logging code in it with calls to the JOSM Logging class (source:/trunk/src/org/openstreetmap/josm/tools/Logging.java ) anyway. The plugin probably used log4j since JOSM didn't have the Logging class at the time the plugin was originally written.

Replying to skyper:

On Linux, I have the system libraries liblog4j1.2-java and liblog4j2-java installed. Do I still need the plugin?

Probably. TBH, we should probably check our dependencies for log4j. I'll update #21596 (update dependencies in ivy.xml and tools/ivy.xml) so we do get any fixes our dependencies needed to do. I'll also take a look at apache-commons/apache-http.

comment:12 by stoecker, 3 years ago

In 35876/osm:

see #21657 - update to 2.16.0

comment:13 by stoecker, 3 years ago

In 35877/osm:

update spotbugs to 4.5.2, see #21657

in reply to:  12 ; comment:14 by skyper, 3 years ago

Replying to stoecker:

In 35876/osm:

see #21657 - update to 2.16.0

Todays plugin version is still o35874 within JOSM latest and on the wiki page. I expected o35876 or am I wrong, again.

in reply to:  14 comment:15 by taylor.smock, 3 years ago

Replying to skyper:

Todays plugin version is still o35874 within JOSM latest and on the wiki page. I expected o35876 or am I wrong, again.

Looks like someone needs to run dist and commit it. I'll do it in a few minutes.

comment:16 by stoecker, 3 years ago

If someone can find out why JOSM-Plugins Jenkins tasks still fetches log4j 2.14.1 for areaselector I'd appreciate it.

in reply to:  16 comment:17 by taylor.smock, 3 years ago

Replying to stoecker:

If someone can find out why JOSM-Plugins Jenkins tasks still fetches log4j 2.14.1 for areaselector I'd appreciate it.

I'll take a look at it. Hopefully areaselector just has a hidden dependency on log4j somewhere. If that is the case, then it should be as easy as excluding it in ivy.

comment:18 by taylor.smock, 3 years ago

In 35879/osm:

log4j: dist

Update log4j to 2.16.0 (see #21657)

in reply to:  16 comment:19 by taylor.smock, 3 years ago

Replying to stoecker:

If someone can find out why JOSM-Plugins Jenkins tasks still fetches log4j 2.14.1 for areaselector I'd appreciate it.

I'm not seeing log4j in the project dependencies. It is, however, part of the tool dependencies (resolve-tools), and I'm seeing it there.

    <target name="resolve-tools" depends="init-ivy" description="Resolves tools using Apache Ivy">
        <ivy:resolve file="${core.tools.ivy}"/>
        <ivy:cachepath file="${core.tools.ivy}" pathid="errorprone.classpath" conf="errorprone"/>
        <ivy:cachepath file="${core.tools.ivy}" pathid="errorprone_javac.classpath" conf="errorprone_javac"/>
        <ivy:cachepath file="${core.tools.ivy}" pathid="checkstyle.classpath" conf="checkstyle"/>
        <ivy:cachepath file="${core.tools.ivy}" pathid="spotbugs.classpath" conf="spotbugs"/>
    </target>

I'll update #21596 again.

in reply to:  16 comment:20 by taylor.smock, 3 years ago

Replying to stoecker:

If someone can find out why JOSM-Plugins Jenkins tasks still fetches log4j 2.14.1 for areaselector I'd appreciate it.

It looks like it is due to spotbugs in source:trunk/tools/ivy.xml. Version 4.5.2 updates log4j.

in reply to:  18 ; comment:21 by GerdP, 3 years ago

Replying to taylor.smock:

In 35879/osm:

log4j: dist

Update log4j to 2.16.0 (see #21657)

Something went wrong with this dist, the MANIFEST says
Plugin-Version: UNKNOWN

comment:22 by stoecker, 3 years ago

Also there is still someone pulling 2.14.1:

Seems dist-optimized: jenkins/job/JOSM/jdk=JDK11/7647/consoleFull

I hate this remote dependency stuff. That's awful.

in reply to:  21 ; comment:23 by taylor.smock, 3 years ago

Replying to GerdP:

Something went wrong with this dist, the MANIFEST says
Plugin-Version: UNKNOWN

I know what happened -- my dev environment is a Frankenstein of docker containers + localhost. I've got to use docker for subversion (if you've got homebrew set to a different home than the default, then subversion refuses to build/install), so getting the svn revision didn't work.

Replying to stoecker:

Also there is still someone pulling 2.14.1:
Seems dist-optimized: jenkins/job/JOSM/jdk=JDK11/7647/consoleFull
I hate this remote dependency stuff. That's awful.

There are pros/cons to everything. The one thing I like is that I know what the dependency actually is (as in, which org/module it is). And the ability to do a generic check for dependency updates (ant ivy-checkdepsupdate) -- #21596 made some modifications so that tools/ivy.xml was included in the update check. But you do have to do a scrollback.

We could set ivy up to exclude log4j, and provide our own. I've done exclusions in ivy with a few patches I've been working on.

Anyway, it looks like the problematic dependency is proguard-ant in tools/ivy.xml. We just have to update it to 7.2.0-beta4.

by taylor.smock, 3 years ago

Attachment: 21657.proguard.patch added

Update proguard-ant for log4j

comment:24 by taylor.smock, 3 years ago

Ticket #21675 has been marked as a duplicate of this ticket.

comment:25 by taylor.smock, 3 years ago

In 35880/osm:

dist log4j: add svn revision information

see #21657

comment:26 by stoecker, 3 years ago

In 18331/josm:

get finally rid of log4j 2.14.1 on josm server?, see #21657

in reply to:  23 comment:27 by stoecker, 3 years ago

I hate this remote dependency stuff. That's awful.

There are pros/cons to everything.

Yes, I know these. I'm doing software development for more that 30 years now, more than 20 years as professional. I'm intimate with all the pros and cons available. :-)

The one thing I like is that I know what the dependency actually is (as in, which org/module it is). And the ability to do a generic check for dependency updates (ant ivy-checkdepsupdate) -- #21596 made some modifications so that tools/ivy.xml was included in the update check. But you do have to do a scrollback.

The problem with these ivy, maven,... tools is, that you totally lose the control over the source and contrary to the belief it does not increase security compared to simply copying the code into your project. Rather the opposite as the last years have shown.

We could set ivy up to exclude log4j, and provide our own. I've done exclusions in ivy with a few patches I've been working on.

No. That makes no sense. I allowed the way to go with dynamic dependencies and now we have to live with this decision. A mix of dynamic and local static or specific exceptions is even worse.

Anyway, it looks like the problematic dependency is proguard-ant in tools/ivy.xml. We just have to update it to 7.2.0-beta4.

Hope that's the last place. Will see if the ant/ivy/nexus caches keep clean.

P.S. As openSUSE package manager you learn to hate these projects which don't even have a way to build offline, but rather expect that a network connection is always available, which for package build servers it is not - a package must always be build with only the supplied files.

comment:28 by stoecker, 3 years ago

Well, there will remain one old log4j in Plugins build 2033, as this is kept until the Mapillary tests are fixed...

in reply to:  28 ; comment:29 by taylor.smock, 3 years ago

Replying to stoecker:

Well, there will remain one old log4j in Plugins build 2033, as this is kept until the Mapillary tests are fixed...

Sorry about the Mapillary tests -- I have yet to figure out why they pass in some environments, and fail in others. I thought I had something reproducible at one point, but I haven't been able to repro recently.

I've got a docker container that should be fairly similar to the Jenkins environment, but the tests were passing. I just added svn/git to the image, and maybe I'll be able to repro with that.

in reply to:  29 comment:30 by stoecker, 3 years ago

Replying to taylor.smock:

Replying to stoecker:

Well, there will remain one old log4j in Plugins build 2033, as this is kept until the Mapillary tests are fixed...

Sorry about the Mapillary tests -- I have yet to figure out why they pass in some environments, and fail in others. I thought I had something reproducible at one point, but I haven't been able to repro recently.

I've got a docker container that should be fairly similar to the Jenkins environment, but the tests were passing. I just added svn/git to the image, and maybe I'll be able to repro with that.

Is there anything that could help you?

comment:31 by taylor.smock, 3 years ago

About the only thing I can think of would be a list of software that was installed. (apt list --installed should do it).
Hopefully I don't need the exact same configuration settings. If I do need the same configuration settings, I'll just have to add extra print statements to see what happens, and debug day-by-day.

comment:32 by stoecker, 3 years ago

Would it help when we setup a JOB which only builds and checks mapillary? That way you could use our instance for testing (and fast feedback). Probably much easier than trying to recreate our setup (which I'm not entirely sure I could do myself without the backups).

comment:33 by Don-vip, 3 years ago

In 35881/osm:

see #21657 - upgrade to Log4j 2.17.0

comment:34 by Don-vip, 3 years ago

In 35882/osm:

see #21657 - upgrade to Log4j 2.17.0 (dist)

comment:35 by Don-vip, 3 years ago

In 18358/josm:

see #21657 - upgrade to proguard 7.2.0-beta5, which itselfs update to log4j 2.17.0

https://github.com/Guardsquare/proguard/releases/tag/v7.2.0-beta5

comment:36 by skyper, 3 years ago

Ticket #21732 has been marked as a duplicate of this ticket.

by taylor.smock, 3 years ago

Attachment: 21657.2.17.1.patch added

Update Log4J to 2.17.1. This fixes CVE-2021-44832.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.