Miscellaneous
Overview
The Miscellaneous category covers a variety of issues detected by BugZ that don't fit neatly into other categories. These issues range from potential security vulnerabilities related to the use of certain Python features or libraries to best practices violations in coding patterns and configurations.
Vulnerabilities
5001: assert_used
- Description: Checks for the use of the Python assert keyword. It was discovered that some projects used assert to enforce interface constraints. However, assert is removed with compiling to optimized byte code (python -O producing *.opt-1.pyc files). This caused various protections to be removed. Consider raising a semantically meaningful error or AssertionError instead.
- Severity: Low
- CWE: CWE-703 (opens in a new tab)
- Reference Links:
5002: exec_used
- Description: Checks for the use of Python’s exec method or keyword. The Python docs succinctly describe why the use of exec is risky.
- Severity: Medium
- CWE: CWE-78 (opens in a new tab)
- Reference Links:
5003: set_bad_file_permissions
- Description: Test for setting permissive file permissions. POSIX based operating systems utilize a permissions model to protect access to parts of the file system. This model supports three roles “owner”, “group” and “world” each role may have a combination of “read”, “write” or “execute” flags sets. Python provides chmod to manipulate POSIX style permissions.
- Severity: Medium to High
- CWE: CWE-732 (opens in a new tab)
- Reference Links:
5004: hardcoded_bind_all_interfaces
- Description: Test for binding to all interfaces. Binding to all network interfaces can potentially open up a service to traffic on unintended interfaces, that may not be properly documented or secured. This plugin test looks for a string pattern “0.0.0.0” that may indicate a hardcoded binding to all network interfaces.
- Severity: Medium
- CWE: CWE-605 (opens in a new tab)
- Reference Links:
5005: hardcoded_password_string
- Description: Test for use of hard-coded password strings. The use of hard-coded passwords increases the possibility of password guessing tremendously. This plugin test looks for all string literals and checks for conditions indicating hard-coded passwords.
- Severity: Low
- CWE: CWE-259 (opens in a new tab)
- Reference Links:
5006: hardcoded_password_funcarg
- Description: Test for use of hard-coded password function arguments. The use of hard-coded passwords increases the possibility of password guessing tremendously. This plugin test looks for all function calls being passed a keyword argument that is a string literal.
- Severity: Low
- CWE: CWE-259 (opens in a new tab)
- Reference Links:
5007: hardcoded_password_default
- Description: Test for use of hard-coded password argument defaults. The use of hard-coded passwords increases the possibility of password guessing tremendously. This plugin test looks for all function definitions that specify a default string literal for some argument.
- Severity: Low
- CWE: CWE-259 (opens in a new tab)
- Reference Links:
5008: hardcoded_tmp_directory
- Description: Test for insecure usage of tmp file/directory. Safely creating a temporary file or directory means following a number of rules. This plugin test looks for strings starting with (configurable) commonly used temporary paths.
- Severity: Medium
- CWE: CWE-377 (opens in a new tab)
- Reference Links:
5009: password_config_option_not_marked_secret
- Description: Test for a password-based config option not marked secret. Passwords are sensitive and must be protected appropriately. This plugin detects usages of oslo configuration functions that appear to deal with strings ending in ‘password’ and flag usages where they have not been marked secret.
- Severity: Medium
- CWE: N/A
- Reference Links:
5010: try_except_pass
- Description: Test for a pass in the except block. Errors in Python code bases are typically communicated using Exceptions. However, it is possible to catch an exception and silently ignore it. This pattern is considered bad practice and represents a potential security issue.
- Severity: Low
- CWE: CWE-703 (opens in a new tab)
- Reference Links:
5011: execute_with_run_as_root_equals_true
- Description: Test for the use of rootwrap running as root. Running commands as root dramatically increases their potential risk. This plugin test checks for specific methods being called with a keyword parameter run_as_root set to True, a common OpenStack idiom.
- Severity: Low
- CWE: N/A
- Reference Links:
5012: try_except_continue
- Description: Test for a continue in the except block. Errors in Python code bases are typically communicated using Exceptions. However, it is possible to catch an exception and silently ignore it while in a loop. This pattern is considered bad practice and represents a potential security issue.
- Severity: Low
- CWE: CWE-703 (opens in a new tab)
- Reference Links:
5013: request_without_timeout
- Description: Test for missing requests timeout. This plugin test checks for requests calls without a timeout specified.
- Severity: Medium
- CWE: CWE-400 (opens in a new tab)
- Reference Links:
Best Practices
- Input Validation: Validate all user inputs rigorously to prevent unexpected behaviors and vulnerabilities.
- Output Encoding: Encode output data to mitigate XSS (Cross-Site Scripting) vulnerabilities and prevent malicious script execution.
- Error Handling: Implement robust error handling mechanisms to gracefully handle unexpected situations and prevent information leakage.
- Secure Configuration: Ensure secure configuration of all components and dependencies to reduce attack surface and minimize potential vulnerabilities.
- Regular Updates: Keep all software components, libraries, and frameworks up to date with the latest security patches and updates to address known vulnerabilities.
- Security Testing: Perform regular security testing, including vulnerability scanning, penetration testing, and code reviews, to identify and remediate any weaknesses in the application.
By incorporating these best practices and BugZ into their development processes, developers can enhance the security of their applications and protect against miscellaneous vulnerabilities effectively.