forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 3
XXE: Changes for review #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jorgectf
merged 44 commits into
jorgectf:jorgectf/python/deserialization
from
RasmusWL:WIP
Mar 4, 2022
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
500e0ac
Python: Rewrite sax XML tests
RasmusWL ee23c05
Python: XML: Expose vuln kind on sink
RasmusWL aaf55b2
Python: Add XMLVulnerabilityKind
RasmusWL 16e482b
Python: Improve QLDoc for XML parsing/parsers
RasmusWL 6dd776b
Python: Only produce one alert per vulnerable XML sink
RasmusWL 7f7758b
Python: rewrite xml sax modeling
RasmusWL 515b824
Python: Add lxml positive test
RasmusWL 661d8bf
Python: Better handling of `resolve_entities` arg in lxml
RasmusWL 52891cb
Python: Add PoC for XML vulns
RasmusWL 3c321dd
Python: Model `lxml.etree.get_default_parser` in own class
RasmusWL 124c03c
Python: Expand lxml tests
RasmusWL e295399
Python: Properly handle `huge_tree` in lxml
RasmusWL 703e3e8
Python: Handle DTD retrieval vuln in lxml
RasmusWL 6129193
Python: Properly model `xml.etree`
RasmusWL 3affa6c
Python: Annotate xmltodict tests
RasmusWL c4d08db
Python: Expand XML PoC with minidom/pulldom/expat
RasmusWL 5a65248
Python: Annotate xml.dom tests
RasmusWL 9406a97
Python: Fix vuln detection for xml.minidom with parser arg
RasmusWL 7cda901
Python: Add separate query for SimpleXMLRPCServer
RasmusWL 4b03f5c
Python: Rename xml.sax test for consistency
RasmusWL faebaee
Python: Use concept tests for XML Parsing
RasmusWL a7134ca
Python: Port xml.dom tests
RasmusWL 5fb4c4d
Python: Port xml.etree tests
RasmusWL 0b12d91
Python: Port xml.sax tests
RasmusWL c739ae4
Python: Port `xmltodict` tests
RasmusWL 2451123
Python: Move XML PoC to new test dir
RasmusWL 3278793
Python: Handle more functions and kw-args
RasmusWL f72f673
Python: Update `XmlEntityInjection.expected`
RasmusWL 33ebcdf
Python: Support feed method of lxml/xml.etree Parsers
RasmusWL 46238d5
Python: Add test for XMLPullParser
RasmusWL de0e67f
Python: Restructure overall XML modeling
RasmusWL a033b71
Python: Align QLdocs of XML modeling
RasmusWL c0a2c25
Python: Restructure modeling of `xml.etree` parsers
RasmusWL c0a6f9f
Python: Restructure lxml modeling
RasmusWL df8e0fc
Python: Minor fixup of qldoc
RasmusWL 837daaa
Python: Remove XMLParser concept
RasmusWL 0d69dc8
Python: Minor qldoc improvement
RasmusWL 3f6c55e
Python: Rename `vulnerable` predicate => `vulnerableTo`
RasmusWL 683c2fa
Apply suggestions from code review
jorgectf 3cd165d
Python: Apply suggestions from code review
RasmusWL d6cbfec
Python: huge_tree tests were wrong
RasmusWL f0131af
Python: Fix `huge_tree` modeling
RasmusWL 1a9620a
Python: Add conditional assignment check for sax parser
RasmusWL ef045a6
Python: Fix typo in set_default_parser
RasmusWL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
python/ql/src/experimental/Security/CWE-611/SimpleXmlRpcServer.ql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @name SimpleXMLRPCServer DoS vulnerability | ||
* @description SimpleXMLRPCServer is vulnerable to DoS attacks from untrusted user input | ||
* @kind problem | ||
* @problem.severity warning | ||
* @precision high | ||
* @id py/simple-xml-rpc-server-dos | ||
* @tags security | ||
* external/cwe/cwe-776 | ||
*/ | ||
|
||
private import python | ||
private import experimental.semmle.python.Concepts | ||
private import semmle.python.ApiGraphs | ||
|
||
from DataFlow::CallCfgNode call, string kinds | ||
where | ||
call = API::moduleImport("xmlrpc").getMember("server").getMember("SimpleXMLRPCServer").getACall() and | ||
kinds = | ||
strictconcat(XML::XMLVulnerabilityKind kind | | ||
kind.isBillionLaughs() or kind.isQuadraticBlowup() | ||
| | ||
kind, ", " | ||
) | ||
select call, "SimpleXMLRPCServer is vulnerable to: " + kinds + "." |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.