Skip to content

Commit 6a4554b

Browse files
committed
Removed lxml.etree.XMLParser from xml bomb sinks
1 parent 887d80f commit 6a4554b

File tree

1 file changed

+2
-8
lines changed
  • python/ql/lib/semmle/python/frameworks

1 file changed

+2
-8
lines changed

python/ql/lib/semmle/python/frameworks/Lxml.qll

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ module Lxml {
129129
any(True t)
130130
)
131131
or
132-
kind.isXmlBomb() and
133-
this.getKeywordParameter("huge_tree").getAValueReachingSink().asExpr() = any(True t) and
134-
not this.getKeywordParameter("resolve_entities").getAValueReachingSink().asExpr() =
135-
any(False t)
136-
or
137132
kind.isDtdRetrieval() and
138133
this.getKeywordParameter("load_dtd").getAValueReachingSink().asExpr() = any(True t) and
139134
this.getKeywordParameter("no_network").getAValueReachingSink().asExpr() = any(False t)
@@ -305,9 +300,8 @@ module Lxml {
305300
// note that there is no `resolve_entities` argument, so it's not possible to turn off XXE :O
306301
kind.isXxe()
307302
or
308-
kind.isXmlBomb() and
309-
this.getKeywordParameter("huge_tree").getAValueReachingSink().asExpr() = any(True t)
310-
or
303+
// libxml2 has built-in protection against XML bombs via entity reference loop detection,
304+
// so lxml is not vulnerable to XML bomb attacks.
311305
kind.isDtdRetrieval() and
312306
this.getKeywordParameter("load_dtd").getAValueReachingSink().asExpr() = any(True t) and
313307
this.getKeywordParameter("no_network").getAValueReachingSink().asExpr() = any(False t)

0 commit comments

Comments
 (0)