Repository navigation
Description
Hi,
We are using SoapCore - great library! After a security review on one of our web applications, Claude A.I. reported that DTD processing was enabled in SoapCore - DTD was prohibited previously but has been re-enabled in later versions. Do you know it this is true?
Excerpt from the Claude A.I. report:
I searched SoapCore’s GitHub issues and pull requests for “DTD”, “DtdProcessing”, “XXE”, “DOCTYPE”, “XmlResolver” and “billion”, and nobody has reported that DTD processing is back on in the 1.2.1.x line. The topic did come up earlier, though, and the maintainers fixed it at the time.
The earlier fix (2021). In PR #772, “Set dtdprocessing prohibit”, collaborator andersjonsson noted that DtdProcessing.Prohibit is only the default when you don’t construct your own XmlReaderSettings. SoapCore was creating its own (new XmlReaderSettings() { IgnoreWhitespace = true }), which meant DTDs were being parsed. The PR added DtdProcessing = DtdProcessing.Prohibit in SoapMessageEncoder and SoapEndpointMiddleware. It was merged into develop on December 3, 2021. Later versions also added XmlResolver = null, and that hardened setup is still in place in v1.1.0.51, v1.2.0.0 and v1.2.0.1.
How it was lost. In v1.2.1.0, the request-reading path was rewritten to use ParsedMessage.FromStreamAsync with XDocument.LoadAsync(TextReader). That rewrite dropped the explicit reader settings, so XDocument’s own defaults apply again, and those set DtdProcessing.Parse. Every tag I checked, from v1.2.1.0 through v1.2.1.12, plus the current develop branch, uses this path. So the hardening has been gone since 1.2.1.0, not 1.2.1.12 as I implied earlier based on issue #1196. That issue reports a different bug in the same rewrite.
Best Regrads,
Henrik
Activity