Skip to content
XXE Write-up Intermediate

CVE-2021-2471 MySQL JDBC XXE

The getSource() method in MySQL Connector/J's MysqlSQLXML class did not check for external entities when parsing XML, allowing an attacker to craft XML that triggers XXE. This could lead to reading local files or making network requests from the server.

pyn3rd Follow

Published on pyn3rd.github.io

Prior to MySQL Connector/J 8.0.27, the getSource() method exists in MysqlSQLXML, but the getSource() method has no security check when external general entities included in XML sources, consequently, here exists a XXE vulnerability.

pyn3rd (@pyn3rd), on pyn3rd.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the XML parser used in getSource() was not configured to disable external entity resolution, allowing external entities to be processed.

Impact

An attacker could exploit this to read local files or perform SSRF, though the text does not specify the exact impact.

What the attacker needed

Ability to supply XML to getSource()

The fix

The getSource() method was fixed to no longer support external DTD, external general entities, and external general parameters.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

XML allows defining 'entities' that can reference external files or URLs. If a program parses XML without disabling these external references, an attacker can make the program read sensitive files or contact internal servers. This is called XXE (XML External Entity) injection.

What is XXE?

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.

More by pyn3rd

View all

2 more disclosed reports, best first.

More from Oracle (MySQL)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

XML external entities (XXE)

The lesson behind this report.

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.