mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
125 lines (124 loc) • 3.6 kB
YAML
rules:
- id: avoid-pickle
metadata:
owasp:
- A08:2017 - Insecure Deserialization
- A08:2021 - Software and Data Integrity Failures
cwe:
- 'CWE-502: Deserialization of Untrusted Data'
references:
- https://docs.python.org/3/library/pickle.html
category: security
technology:
- python
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: MEDIUM
confidence: LOW
languages:
- python
message: >-
Avoid using `pickle`, which is known to lead to code execution vulnerabilities.
When unpickling, the serialized data could be manipulated to run arbitrary code.
Instead, consider serializing the relevant data as JSON or a similar text-based
serialization format.
severity: WARNING
patterns:
- pattern-either:
- pattern: pickle.$FUNC(...)
- pattern: _pickle.$FUNC(...)
- pattern-not: pickle.$FUNC("...")
- pattern-not: _pickle.$FUNC("...")
- id: avoid-cPickle
metadata:
owasp:
- A08:2017 - Insecure Deserialization
- A08:2021 - Software and Data Integrity Failures
cwe:
- 'CWE-502: Deserialization of Untrusted Data'
references:
- https://docs.python.org/3/library/pickle.html
category: security
technology:
- python
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: MEDIUM
confidence: LOW
languages:
- python
message: >-
Avoid using `cPickle`, which is known to lead to code execution vulnerabilities.
When unpickling, the serialized data could be manipulated to run arbitrary code.
Instead, consider serializing the relevant data as JSON or a similar text-based
serialization format.
severity: WARNING
patterns:
- pattern: cPickle.$FUNC(...)
- pattern-not: cPickle.$FUNC("...")
- id: avoid-dill
metadata:
owasp:
- A08:2017 - Insecure Deserialization
- A08:2021 - Software and Data Integrity Failures
cwe:
- 'CWE-502: Deserialization of Untrusted Data'
references:
- https://docs.python.org/3/library/pickle.html
category: security
technology:
- python
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: MEDIUM
confidence: LOW
languages:
- python
message: >-
Avoid using `dill`, which uses `pickle`, which is known to lead to code execution
vulnerabilities.
When unpickling, the serialized data could be manipulated to run arbitrary code.
Instead, consider serializing the relevant data as JSON or a similar text-based
serialization format.
severity: WARNING
patterns:
- pattern: dill.$FUNC(...)
- pattern-not: dill.$FUNC("...")
- id: avoid-shelve
metadata:
owasp:
- A08:2017 - Insecure Deserialization
- A08:2021 - Software and Data Integrity Failures
cwe:
- 'CWE-502: Deserialization of Untrusted Data'
references:
- https://docs.python.org/3/library/pickle.html
category: security
technology:
- python
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: MEDIUM
confidence: MEDIUM
languages:
- python
message: >-
Avoid using `shelve`, which uses `pickle`, which is known to lead to code execution
vulnerabilities.
When unpickling, the serialized data could be manipulated to run arbitrary code.
Instead, consider serializing the relevant data as JSON or a similar text-based
serialization format.
severity: WARNING
pattern: shelve.$FUNC(...)