File tree Expand file tree Collapse file tree 2 files changed +19
-43
lines changed
python/ql/test/experimental
library-tests/frameworks/XML
query-tests/Security/CWE-611 Expand file tree Collapse file tree 2 files changed +19
-43
lines changed Original file line number Diff line number Diff line change 1+ from io import StringIO
2+ import xml .dom .minidom
3+ import xml .dom .pulldom
4+ import xml .sax
5+
6+ x = "some xml"
7+
8+ # minidom
9+ xml .dom .minidom .parse (StringIO (x )) # $ input=StringIO(..) vuln='Billion Laughs' vuln='Quadratic Blowup'
10+ xml .dom .minidom .parseString (x ) # $ input=x vuln='Billion Laughs' vuln='Quadratic Blowup'
11+
12+ # pulldom
13+ xml .dom .pulldom .parse (StringIO (x ))['START_DOCUMENT' ][1 ] # $ input=StringIO(..) vuln='Billion Laughs' vuln='Quadratic Blowup'
14+ xml .dom .pulldom .parseString (x )['START_DOCUMENT' ][1 ] # $ input=x vuln='Billion Laughs' vuln='Quadratic Blowup'
15+
16+ # These are based on SAX parses, and you can specify your own, so you can expose yourself to XXE (yay/)
17+ parser = xml .sax .make_parser ()
18+ parser .setFeature (xml .sax .handler .feature_external_ges , True )
19+ xml .dom .minidom .parse (StringIO (x ), parser = parser ) # $ input=StringIO(..) vuln='Billion Laughs' vuln='DTD retrieval' vuln='Quadratic Blowup' vuln='XXE'
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments