Skip to content
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

Add CWE information to snmp_security_check #787

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions bandit/core/cwemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"B505": issue.Cwe.INADEQUATE_ENCRYPTION_STRENGTH,
"B506": issue.Cwe.IMPROPER_INPUT_VALIDATION,
"B507": issue.Cwe.IMPROPER_CERT_VALIDATION,
"B508": issue.Cwe.CLEARTEXT_TRANSMISSION,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get a chance to review the last PR, but I'm wondering if we really need this map here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same, it would make it harder/confusing for 3rd party plugins to have this map here. That being said, I wanted to merge this change and fix up a number of other things as a result of this PR.

"B509": issue.Cwe.CLEARTEXT_TRANSMISSION,
"B601": issue.Cwe.OS_COMMAND_INJECTION,
"B602": issue.Cwe.OS_COMMAND_INJECTION,
"B603": issue.Cwe.OS_COMMAND_INJECTION,
Expand Down
3 changes: 3 additions & 0 deletions bandit/plugins/snmp_security_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: Apache-2.0
import bandit
from bandit.core import cwemap
from bandit.core import test_properties as test


Expand All @@ -29,6 +30,7 @@ def snmp_insecure_version_check(context):
) or context.check_call_arg_value("mpModel", 1):
return bandit.Issue(
severity=bandit.MEDIUM,
cwe=cwemap.CWEMAP["B508"],
confidence=bandit.HIGH,
text="The use of SNMPv1 and SNMPv2 is insecure. "
"You should use SNMPv3 if able.",
Expand Down Expand Up @@ -62,6 +64,7 @@ def snmp_crypto_check(context):
if context.call_args_count < 3:
return bandit.Issue(
severity=bandit.MEDIUM,
cwe=cwemap.CWEMAP["B509"],
confidence=bandit.HIGH,
text="You should not use SNMPv3 without encryption. "
"noAuthNoPriv & authNoPriv is insecure",
Expand Down