Skip to content

Security: XXE in initDocumentParser #467

Closed

Description

@krabbenpuler

The method initDocumentParser() in the XMLSchedulingDataProcessor.java does not forbid DTDs, which allows a context-dependend attacker to perfom an XXE. The vulnerability is confirmed working in version 2.2.3.

I reported this issue to the MITRE cooperation already which assigned the identifier CVE-2019-13990 to this vulnerability. Please confirm the existence of this vulnerability so that the CVE-entry can be completed and published.

The OWASP Foundation provides an XXE Prevention CheatSheet that explains in detail the steps to prevent this security issue.

Credits to Andreas Schoedl for working out the relevant code section affected by this issue.

Activity

  1. jgallimore commented on Aug 5, 2019

    @jgallimore
    Contributor

    @krabbenpuler I've been taking a look at this, and I think I have a patch I can send as a PR for master. Do you have a specific test case I can verify it with?

  2. krabbenpuler commented on Aug 5, 2019

    @krabbenpuler
    Author

    @jgallimore Sure, the following attack vector worked in my case:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE foo [<!ELEMENT foo ANY >
    <!ENTITY xxe SYSTEM "/" >]>
    <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd" version="2.0">
    <schedule>
    <job>
    <name>xxe</name>
    <group>native</group>
    <description>&xxe;</description>
    <job-class>org.quartz.jobs.NativeJob</job-class>
    <durability>true</durability>
    <recover>false</recover>
    </job>
    </schedule>
    </job-scheduling-data>
  3. jgallimore commented on Aug 6, 2019

    @jgallimore
    Contributor

    That's great - thanks for that.

  4. added a commit that references this issue on Aug 6, 2019
  5. jgallimore commented on Aug 6, 2019

    @jgallimore
    Contributor

    PR for master: #472

  6. jgallimore commented on Aug 6, 2019

    @jgallimore
    Contributor

    I'll send an email, but I'm happy to file a CLA if needed.

  7. added a commit that references this issue on Aug 6, 2019
  8. jgallimore commented on Aug 6, 2019

    @jgallimore
    Contributor

    Same patch for the quartz-2.2.x branch. #473

  9. ddillard commented on Aug 7, 2019

    @ddillard

    @krabbenpuler You said you got the CVE, why are the versions in the CVE up to and including 2.3.0 instead of 2.3.1?

  10. krabbenpuler commented on Aug 7, 2019

    @krabbenpuler
    Author

    @ddillard Good point, I'm actually not sure why only the 2.3.0 made it into the CVE. I'll inform MITRE about that as soon as possible.

  11. julyhurt commented on Aug 12, 2019

    @julyhurt

    @jgallimore How can we avoid this issue in current 2.3.0 version without your patch? Any workaround or setting in the qutarz configuration file can avoid this issue?

  12. jgallimore commented on Aug 14, 2019

    @jgallimore
    Contributor

    @julyhurt I think it depends on how you're using and driving Quartz. For context, I'm coming from Apache TomEE, where we have an old version of TomEE that uses Quartz for EJB timers, so we're using it as a library, rather than standalone. Its possible that our use of Quartz isn't actually vulnerable, but this issue flagged up on a scan, so I'm more than happy to help fix it.

    In terms of mitigating this without a patch - if you're passing XML to Quartz, and that XML is untrusted, I would do something to check it before handing it over to Quartz - so that might mean parsing it with a well configured parser first, and then passing it to Quartz.

    There's no 2.3.x branch, but I'm happy to patch 2.3.0 and create a branch for that. I'm not a committer on Quartz though, so I can't actually get anything into the repository, or get a release made. I have tried posting to the user and dev forums, both of which seem to have disappeared (for me at least) and I've tried emailing SoftwareAG to see if they need a signed CLA, per the guidelines here: https://github.com/quartz-scheduler/quartz/blob/master/docs/contribute.adoc. I've heard nothing back, so I'm starting to be a little concerned that potentially no-one is working on the project any more.

  13. onlysyz commented on Aug 15, 2019

    @onlysyz

    what a sad story~~~

  14. added 2 commits that reference this issue on Aug 16, 2019
  15. 18 remaining items

  16. vineetpandey commented on Sep 27, 2019

    @vineetpandey

    @jgallimore Thanks for the resolution. Much appreciated.
    Any chance if this quartz fix can get Terracotta published ?

  17. jgallimore commented on Sep 27, 2019

    @jgallimore
    Contributor

    You're very welcome, and I appreciate the reviews, feedback and comments from everyone here.
    I also would like to see a Terracotta version published, but I haven't seen any activity on this project from its committers for something like 7 months, so I'm not sure what will happen.

    I did publish my binaries (under a org.tomitribe.quartz groupId) on Maven central in case anyone wishes to use them: https://mvnrepository.com/search?q=org.tomitribe.quartz. Corresponding source code is here: https://github.com/tomitribe/quartz/tree/quartz-2.2.4 and here: https://github.com/tomitribe/quartz/tree/quartz-2.3.2.

  18. vineetpandey commented on Sep 27, 2019

    @vineetpandey

    @zemian - you are one of the significant contributor of quartz.
    Can you get this Terracotta published or redirect to correct person?

  19. melloware commented on Sep 27, 2019

    @melloware
    Contributor

    @vineetpandey I have been trying to contact @zemian and @chrisdennis they are both active TerraCotta commiters for Quartz and Ehcache and it has not gotten any response.

    When you lose interest in a program, your last duty to it is to hand it off to a competent successor.
    -The Cathedral and the Bazaar

  20. chrisdennis commented on Sep 27, 2019

    @chrisdennis
    Contributor

    @melloware I'm working on trying to get a future plan for Quartz figured out, but this is something that will have to happen on its own timeframe - it's likely going to involve a lot of moving parts, many of which I have little to no influence over. Once I have the beginning of a plan figured out I'll likely file an issue for it here. In the meantime I'll look in to whether I can independently get this specific issue released on a shorter timeframe.

  21. melloware commented on Sep 27, 2019

    @melloware
    Contributor

    Much appreciated @chrisdennis

  22. added 2 commits that reference this issue on Oct 4, 2019
    9e3306c
    a1395ba
  23. mtarnawa commented on Oct 11, 2019

    @mtarnawa

    @chrisdennis - any chance of this fix getting an incremental release in Maven?

  24. melloware commented on Oct 11, 2019

    @melloware
    Contributor

    @mtarnawa He is working on it. They are planning on getting a 2.3.2 in Maven with these security fixes.

  25. chrisdennis commented on Oct 11, 2019

    @chrisdennis
    Contributor

    Just want to get #475 merged in and then I'll move forward with releasing. Looking like that will happen next week now.

  26. vineetpandey commented on Oct 11, 2019

    @vineetpandey

    Thanks @chrisdennis, @melloware, @jgallimore!
    Much appreciated your efforts.

    Looking forward to the official release.

  27. flowergoo commented on Oct 24, 2019

    @flowergoo

    @chrisdennis thanks for the contribution, this security vulnerability has been there for a while. May I know when you plan for the release? :)

  28. melloware commented on Oct 24, 2019

    @melloware
    Contributor

    @flowergoo It was released yesterday as 2.3.2 and is available on Maven Central.

    https://github.com/quartz-scheduler/quartz/releases/tag/v2.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions