question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Higly suggest reading this — https://www.rapid7.com/blog/post/2021/12/10/widespread-exploitation-of-critical-remote-code-execution-in-apache-log4j/ — and then updating the java cmdline start examples and make a note to ensure folks use a safe Log4j JAR when building/using this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
LEDfancommented, Dec 11, 2021

Hi

Thanks for opening this issue, it’s good to have this discussion in public. We became aware of this issue yesterday morning and verified whether this affected ShinyProxy. We are convinced ShinyProxy is not affected.
You do not need to take any action.

However, the ShinyProxy Operator does uses log4j and was vulnerable. We released a new version of the operator yesterday that fixes the bug. Note that the attack surface of the operator is low, since it does not consume user-input (i.e. it only consumes YAML files created by a SysAdmin).

The next sections describe why ShinyProxy is not vulnerable, do not modify the pom.xml as below, this would make ShinyProxy vulnerable. This is just to show how to verify ShinyProxy is not vulnerable

First of all, ShinyProxy uses Spring Boot as framework. By default Spring Boot is not vulnerable, see this official Spring blog post https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot . In other words, Spring by default uses logback as logging backend instead of log4j. ShinyProxy does not override this logging backend. We confirmed this by running the following commands:

git clone https://github.com/openanalytics/shinyproxy
mvn -B dependency:list > deps.txt
grep -i log4j deps.txt 

This gives the following output:

[INFO]    org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile -- module org.apache.logging.slf4j [auto]
[INFO]    org.apache.logging.log4j:log4j-api:jar:2.13.3:compile -- module org.apache.logging.log4j

As you can see this does not include the vulnerable log4j-core dependency. According to the spring boot blog post, the other dependencies are not vulnerable. (they are not used for the logging itself, but only as API interface.)

Besides this, we also did a manual check whether ShinyProxy is vulnerable. You can try this with the following steps:

  1. download ShinyProxy: wget https://shinyproxy.io/downloads/shinyproxy-2.6.0.jar
  2. run ShinyProxy java -jar shinyproxy-2.6.0.jar
  3. open localhost:8080 in your browser
  4. try to login with username ${jndi:ldap://127.0.0.1:1389/a} and any password
  5. check the logs of ShinyProxy. You will see:
    e.o.containerproxy.service.UserService   : Authentication failure [user: ${jndi:ldap://127.0.0.1:1389/a}] [error: Bad credentials]
    

When ShinyProxy would be vulnerable this would throw an exception, indicating that Java cannot make a connection. You can also verify that ShinyProxy does not try to make a connection by using tcpdump (e.g. using sudo tcpdump -i lo port 1389)

Note that you can verify that this would be the case by changing the logging backend of ShinyProxy. You will need to modify the pom.xml of ShinyProxy, so that it contains:

```xml <dependency> <groupId>eu.openanalytics</groupId> <artifactId>containerproxy</artifactId> <version>${containerproxy.version}</version> <exclusions> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-clasic</artifactId> </exclusion> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr353</artifactId> <version>2.11.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> <exclusions> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </exclusion> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> </exclusion> <exclusion> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-to-slf4j</artifactId> </exclusion> </exclusions> </dependency> ```

instead of

```xml <dependency> <groupId>eu.openanalytics</groupId> <artifactId>containerproxy</artifactId> <version>${containerproxy.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr353</artifactId> <version>2.11.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> ```

(See https://github.com/openanalytics/shinyproxy/blob/master/pom.xml#L66-L80) If you now re-try the above steps, you will see that ShinyProxy tries to connect to the LDAP server.

To conclude, we are convinced that ShinyProxy is not vulnerable. We will closely monitor the situation, and step in when new vulnerabilities are found.

5reactions
LEDfancommented, Dec 15, 2021

Hi

A new update of the log4j library was released, because the previous fix was incomplete. Therefore a new version of the ShinyProxy Operator was released.

ShinyProxy itself remains unaffected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

APACHE LOG4J RCE - Variants and Updates | Checkmarx.com
This vulnerability was fixed in version 2.17.1 by limiting JNDI data source names to the java protocol and it was assigned the CVSS...
Read more >
Exploiting, Mitigating, and Detecting CVE-2021-44228: Log4j ...
The vulnerability CVE-2021-44228, also known as Log4Shell, permits a Remote Code Execution (RCE), allowing the attackers to execute arbitrary ...
Read more >
Apache Log4j Security Vulnerabilities
2 and 2.12.4) are vulnerable to a remote code execution (RCE) attack where an attacker with permission to modify the logging configuration file ......
Read more >
Log4Shell: RCE 0-day exploit found in log4j, a popular Java ...
On Thursday, December 9th a 0-day exploit in the popular Java logging library log4j (version 2), called Log4Shell, was discovered that results ...
Read more >
Log4j vulnerability explained: Prevent Log4Shell RCE ... - Snyk
When using a vulnerable version of Log4j, any incoming data that gets logged can lead to an RCE (remote code execution). When using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found