Skip to content

Commit b3bb08b

Browse files
s19110myteron
andauthored
pySCG: Adding documentation to CWE-489 (#717)
* pySCG: Adding documentation to CWE-489 as part of #531 --------- Signed-off-by: edanhub <[email protected]> Signed-off-by: Hubert Daniszewski <[email protected]> Co-authored-by: myteron <[email protected]>
1 parent f9b9caf commit b3bb08b

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# CWE-489: Active Debug Code
2+
3+
Keep design tooling in separate packages from the actual product and supply useful logging.
4+
5+
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.
6+
7+
Anti-patterns:
8+
9+
* Printing debug information directly to stdout or to the web-interface
10+
* Ports left open such as 22 for ssh or 5678 for debugpy
11+
* Verbose logging enabled in production sites.
12+
* Monkey patching [[Monkey patch - Wikipedia 2023](https://en.wikipedia.org/wiki/Monkey_patch)].
13+
* Hidden functions enabling/disabling verbose logging via external interfaces.
14+
* Hidden functions providing a shell for troubleshooting.
15+
* Operators need of root or superuser access for troubleshooting
16+
* Test tools and results available in the product
17+
* Designing directly on a live instance.
18+
19+
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.
20+
21+
## Automated Detection
22+
23+
|Tool|Version|Checker|Description|
24+
|:---|:---|:---|:---|
25+
|Bandit|1.7.4 on Python 3.10.4|Not Available||
26+
|Flake8|8-4.0.1 on Python 3.10.4|Not Available||
27+
28+
## Related Vulnerabilities
29+
30+
|Component|CVE|Description|CVSS Rating|Comment|
31+
|:---|:---|:---|:---|:---|
32+
|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||
33+
|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||
34+
35+
## Related Guidelines
36+
37+
|||
38+
|:---|:---|
39+
|[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)|
40+
|[MITRE CWE](http://cwe.mitre.org/)|Base: [CWE-489: Active Debug Code (4.13) (mitre.org)](https://cwe.mitre.org/data/definitions/489.html)|
41+
|[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)|
42+
|[Python - Secure Coding One Stop Shop](https://github.com/ossf/wg-best-practices-os-developers/tree/main/docs/Secure-Coding-Guide-for-Python/)|[CWE-532: Insertion of Sensitive Information into Log File](https://github.com/ossf/wg-best-practices-os-developers/tree/main/docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-532/README.md)|
43+
44+
## Bibliography
45+
46+
|||
47+
|:---|:---|
48+
|[[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]
49+
|[[Hammond 2022](https://www.youtube.com/watch?v=jwBRgaIRdgs)]|DANGEROUS Python Flask Debug Mode Vulnerabilities [online]. Available from: [https://www.youtube.com/watch?v=jwBRgaIRdgs](https://www.youtube.com/watch?v=jwBRgaIRdgs) [accessed 3 January 2025]

docs/Secure-Coding-Guide-for-Python/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ It is **not production code** and requires code-style or python best practices t
9797
|:----------------------------------------------------------------|:----|
9898
|[CWE-1095: Loop Condition Value Update within the Loop](CWE-710/CWE-1095/README.md)||
9999
|[CWE-1109: Use of Same Variable for Multiple Purposes](CWE-710/CWE-1109/.)||
100+
|[CWE-489: Active Debug Code](CWE-710/CWE-489/README.md)|[CVE-2018-14649](https://www.cvedetails.com/cve/CVE-2018-14649),<br/>CVSSv3.1: **9.8**,<br/>EPSS: **69.64** (12.12.2023)|
100101

101102
## Biblography
102103

0 commit comments

Comments
 (0)