generated from ossf/project-template
-
Notifications
You must be signed in to change notification settings - Fork 184
pySCG: Adding documentation to CWE-489 #717
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
docs/Secure-Coding-Guide-for-Python/CWE-710/CWE-489/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# CWE-489: Active Debug Code | ||
|
||
Keep design tooling in separate packages from the actual product and supply useful logging. | ||
|
||
Design tooling for functional tests, performance tests, or troubleshooting increases the attackable surface making a product more vulnerable [[MITRE 2023](https://cwe.mitre.org/data/definitions/489.html)]. A need to include them in a final product typically originates from missing the concept of staged testing with separate packaging of the product and required design tooling. Designers only using high privileged users for troubleshooting is often the root cause for badly designed logging that forces the operator to also use highly privileged or shared accounts in production. | ||
|
||
Anti-patterns: | ||
|
||
* Printing debug information directly to stdout or to the web-interface | ||
* Ports left open such as 22 for ssh or 5678 for debugpy | ||
* Verbose logging enabled in production sites. | ||
* Monkey patching [[Monkey patch - Wikipedia 2023](https://en.wikipedia.org/wiki/Monkey_patch)]. | ||
* Hidden functions enabling/disabling verbose logging via external interfaces. | ||
* Hidden functions providing a shell for troubleshooting. | ||
* Operators need of root or superuser access for troubleshooting | ||
* Test tools and results available in the product | ||
* Designing directly on a live instance. | ||
|
||
Not knowing that a product must be deployed differently in production than in staging can leave well known entry points wide open. [[Hammond 2022](https://www.youtube.com/watch?v=jwBRgaIRdgs)]. Well written test-driven design can avoid the need to have such excessive troubleshooting design tooling as seen in Flask. | ||
|
||
## Automated Detection | ||
|
||
|Tool|Version|Checker|Description| | ||
|:---|:---|:---|:---| | ||
|Bandit|1.7.4 on Python 3.10.4|Not Available|| | ||
|Flake8|8-4.0.1 on Python 3.10.4|Not Available|| | ||
|
||
## Related Vulnerabilities | ||
|
||
|Component|CVE|Description|CVSS Rating|Comment| | ||
|:---|:---|:---|:---|:---| | ||
|ceph-isci-cli Red Hat Ceph Storage 2,3|[CVE-2018-14649](https://nvd.nist.gov/vuln/detail/CVE-2018-14649)|ceph-isci-cli package as shipped by Red Hat Ceph Storage 2 and 3 is using python-werkzeug in debug shell mode. This is done by setting debug=True in file /usr/bin/rbd-target-api provided by ceph-isci-cli package. This allows unauthenticated attackers to access this debug shell and escalate privileges.|CVSS 3.xx: 9.8|| | ||
|OpenStack ironic-inspector, ironic-discoverd|[CVE-2015-5306](https://nvd.nist.gov/vuln/detail/CVE-2015-5306)|When debug mode is enabled, might allow remote attackers to access the Flask console and execute arbitrary Python code by triggering an error.|CVSS 2.x: 6.8|| | ||
|
||
## Related Guidelines | ||
|
||
||| | ||
|:---|:---| | ||
|[MITRE CWE](http://cwe.mitre.org/)|Pillar: [CWE-710: Improper Adherence to Coding Standards (4.13) (mitre.org)](https://cwe.mitre.org/data/definitions/710.html)| | ||
|[MITRE CWE](http://cwe.mitre.org/)|Base: [CWE-489: Active Debug Code (4.13) (mitre.org)](https://cwe.mitre.org/data/definitions/489.html)| | ||
|[SEI CERT Coding Standard for Java](https://wiki.sei.cmu.edu/confluence/display/java/SEI+CERT+Oracle+Coding+Standard+for+Java)|[ENV05-J. Do not deploy an application that can be remotely monitored](https://wiki.sei.cmu.edu/confluence/display/java/ENV05-J.+Do+not+deploy+an+application+that+can+be+remotely+monitored)| | ||
|[Python - Secure Coding One Stop Shop](https://eteamspace.internal.ericsson.com/display/DEVEN/Python+-+Secure+Coding+One+Stop+Shop)|[FIO13-P3. Do not log sensitive information outside a trust boundary](https://eteamspace.internal.ericsson.com/display/DEVEN/FIO13-P3.+Do+not+log+sensitive+information+outside+a+trust+boundary)| | ||
|
||
## Bibliography | ||
|
||
||| | ||
|:---|:---| | ||
|[[Monkey patch - Wikipedia 2023](https://en.wikipedia.org/wiki/Monkey_patch)]|Wikimedia Foundation. (2024). Monkey patch [online]. Available from: [https://en.wikipedia.org/wiki/Monkey_patch](https://en.wikipedia.org/wiki/Monkey_patch) [accessed 3 January 2025] | ||
|[[Hammond 2022](https://en.wikipedia.org/wiki/Monkey_patch)]|John Hammond. (2024). DANGEROUS Python Flask Debug Mode Vulnerabilities [online]. Available from: [https://www.youtube.com/watch?v=jwBRgaIRdgs](hhttps://www.youtube.com/watch?v=jwBRgaIRdgs) [accessed 3 January 2025] | ||
s19110 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.