-
Notifications
You must be signed in to change notification settings - Fork 33
/
lxml-in-pandas.yaml
42 lines (38 loc) · 1.27 KB
/
lxml-in-pandas.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
rules:
- id: lxml-in-pandas
message: >-
Found usage of the `$FLAVOR` library, which is vulnerable to attacks such as XML external entity (XXE) attacks
languages: [python]
severity: ERROR
metadata:
category: security
cwe: "CWE-611: Improper Restriction of XML External Entity Reference"
subcategory: [vuln]
confidence: HIGH
likelihood: MEDIUM
impact: MEDIUM
technology: [pandas]
description: "Potential XXE attacks from loading `lxml` in pandas"
references:
- https://lxml.de/FAQ.html
pattern-either:
- patterns:
- pattern: pandas.read_html($IO)
- pattern-not: pandas.read_html(**$KWARGS)
- patterns:
- metavariable-pattern:
metavariable: $FLAVOR
patterns:
- pattern: "..."
- pattern-not: |
"bs4"
- pattern-not: |
"html5lib"
- pattern-either:
- pattern: pandas.read_html(..., flavor=$FLAVOR, ...)
- patterns:
- pattern-inside: |
$KWARGS = {..., "flavor": $FLAVOR, ...}
...
- pattern: |
pandas.read_html(**$KWARGS)