Java: Add XXE sink model for Woodstox WstxInputFactory#21718
Open
chmodxxx wants to merge 1 commit intogithub:mainfrom
Open
Java: Add XXE sink model for Woodstox WstxInputFactory#21718chmodxxx wants to merge 1 commit intogithub:mainfrom
chmodxxx wants to merge 1 commit intogithub:mainfrom
Conversation
`com.ctc.wstx.stax.WstxInputFactory` overrides `createXMLStreamReader`, `createXMLEventReader` and `setProperty` from `XMLInputFactory`, so the existing `XmlInputFactory` model in `XmlParsers.qll` does not match calls where the static receiver type is `WstxInputFactory` (or its supertype `org.codehaus.stax2.XMLInputFactory2`). Woodstox is vulnerable to XXE in its default configuration, so these missed sinks were false negatives in `java/xxe`. This adds a scoped framework model under `semmle/code/java/frameworks/woodstox/WoodstoxXml.qll` (registered in the `Frameworks` module of `XmlParsers.qll`) that recognises these calls as XXE sinks and treats the factory as safe when both `javax.xml.stream.supportDTD` and `javax.xml.stream.isSupportingExternalEntities` are disabled — mirroring the existing `XMLInputFactory` safe-configuration logic.
Contributor
|
Thanks for this contribution. I've started CI. Just to be clear, the logic is exactly the same as |
Contributor
Author
|
Hey, thanks for looking. Yes indeed, I didn't want to mess with the core QLL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
com.ctc.wstx.stax.WstxInputFactoryoverridescreateXMLStreamReader,createXMLEventReaderandsetPropertyfromXMLInputFactory, so the existingXmlInputFactorymodel inXmlParsers.qlldoes not match calls where the static receiver type isWstxInputFactory(or its supertypeorg.codehaus.stax2.XMLInputFactory2). Woodstox is vulnerable to XXE in its default configuration, so these missed sinks were false negatives injava/xxe.This adds a scoped framework model under
semmle/code/java/frameworks/woodstox/WoodstoxXml.qll(registered in theFrameworksmodule ofXmlParsers.qll) that recognises these calls as XXE sinks and treats the factory as safe when bothjavax.xml.stream.supportDTDandjavax.xml.stream.isSupportingExternalEntitiesare disabled — mirroring the existingXMLInputFactorysafe-configuration logic.