CWE-674 — Uncontrolled Recursion
CWE-674: Uncontrolled Recursion
MITRE CWE weakness
| Kind | Weakness |
| Abstraction | Class |
| Status | Draft |
| Likelihood of exploit | — |
Description
The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.
Common consequences
- Availability: DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory)
- Confidentiality: Read Application Data
Mitigations
Implementation — Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
Implementation — Increase the stack size.
References
- CWE page: https://cwe.mitre.org/data/definitions/674.html
- CWE list: https://cwe.mitre.org/data/index.html