Skip to content

Add a post on the state of the log4j CVE in the Scala ecosystem. #1315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Dec 16, 2021

Also cc @romanowski , @tgodzik , @lrytz

Also if there are library maintainers who would like to share the status of their libraries, feel free to say so.

@sjrd sjrd requested review from SethTisue and eed3si9n December 16, 2021 13:14
@sjrd sjrd force-pushed the blog-log4j branch 2 times, most recently from 34647b8 to 6dc442f Compare December 16, 2021 13:20
Copy link
Contributor

@vincenzobaz vincenzobaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely clear and precise. I would add a conclusion to reassure and call to action

@sjrd
Copy link
Member Author

sjrd commented Dec 16, 2021

I would add a conclusion to reassure and call to action

Do you have an example/draft of what you have in mind?

@lrytz
Copy link
Member

lrytz commented Dec 16, 2021

I saw this floating around on twitter today: https://github.com/stripe/log4j-remediation-tools

But neither tried it nor looked at it in any depth.

@vincenzobaz
Copy link
Contributor

Do you have an example/draft of what you have in mind?

Something along the lines of:

Conclusion

The log4j vulnerabilities shook our community and reminded us how dependent we all are on open source software.
We are grateful to the maintainers and contributors of Scala open source libraries who reacted quickly to protect their users and to the people behind the tools that enabled such a quick response.

Please do not hesitate to update this post with libraries and tools vulnerable to the CVEs and to propose tools to help address them.

@sjrd
Copy link
Member Author

sjrd commented Dec 16, 2021

Thanks. I added your suggestions.

@romanowski
Copy link
Contributor

LGTM.

I only wonder if we can also include a small snippet with an sbt task (or piece of code to run in sbt console) to filter fullClasspath based on groupId, name and version attributed from Attributed matching affected log4j versions.

@sjrd
Copy link
Member Author

sjrd commented Dec 16, 2021

I only wonder if we can also include a small snippet with an sbt task (or piece of code to run in sbt console) to filter fullClasspath based on groupId, name and version attributed from Attributed matching affected log4j versions.

My intuition would be to use grep for that. Do you have something smarter in mind?


Two very widespread vulnerabilities in log4j v2 are wreaking havoc in the JVM ecosystem.
The vulnerabilities are registered as [CVE-2021-44228](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228) and [CVE-2021-45046](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45046).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The vulnerability allows unauthenticated remote code execution, and it is triggered when a specially crafted string provided by the attacker through a variety of different input vectors. For further technical guidance, see [Guidance for preventing, detecting, and hunting for CVE-2021-44228 Log4j 2 exploitation](https://www.microsoft.com/security/blog/2021/12/11/guidance-for-preventing-detecting-and-hunting-for-cve-2021-44228-log4j-2-exploitation/) for example.

Copy link
Member

@SethTisue SethTisue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


## Useful sbt tasks and settings

If your application is written in sbt, which is common in the Scala ecosystem, here are some information on how to identify the classpath of your application, and how to force an upgrade of the log4j dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/written in sbt/built with sbt/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/identify the classpath/determine the classpath/

[success] Total time: 0 s, completed Dec 16, 2021 11:07:28 AM
```

With older versions of sbt, the command looks like
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How old, exactly? ("version x.y or earlier")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
With older versions of sbt, the command looks like
Prior to sbt 1.1.0, the command looks like

Comment on lines 33 to 35
| Artifact or tool name | Fixed in version |
|-----------------------|------------------|
| sbt | 1.5.7 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Artifact or tool name | Fixed in version |
|-----------------------|------------------|
| sbt | 1.5.7 |
| Artifact or tool name | Affected versions | Fixed in version |
|----------------------|------------------|------------------|
| sbt | 1.x < 1.5.7 | 1.5.7 |
Log4j is not enabled by default since sbt 1.4.0, but all users are recommended to upgrade to the latest fixed version. Any organization using sbt as part of CI/CD (continuous integration and delivery), automated publishing, and projects that expose TCP/IP entry point during testing may be most vulnerable to an exploit.


### `fullClasspath`

The task `fullClasspath`, properly scoped to a project and a configuration, gives the final, full classpath with which your project is executed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we recommend externalClasspath instead? For a large project, this would cut down some noise coming from internal (other subprojects) classpath.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a sentence to suggest externalClasspath in some cases for large builds. Let me know if it looks accurate to you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up!

@sjrd
Copy link
Member Author

sjrd commented Dec 16, 2021

Updated with your suggestions.

@sjrd
Copy link
Member Author

sjrd commented Dec 16, 2021

Thanks for the reviews. I'll merge it now, but further comments and updates are of course very welcome.

@sjrd sjrd merged commit 3663e7d into scala:main Dec 16, 2021
@sjrd sjrd deleted the blog-log4j branch December 16, 2021 17:01

A project is affected by the log4j vulnerabilities if it contains a vulnerable version of a log4j artifact on its classpath.

You may find below a non-comprenhensive list of core Scala tools and libraries known to be affected by the vulnerability, and in which version (if any) it is addressed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-comprehensive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants