CWE-407: Inefficient Algorithmic Complexity
Official CWE-407 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Glexia's Take
CWE-407: Quadratic Complexity
Inefficient Algorithmic Complexity represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Availability: DoS: Resource Consumption (CPU),DoS: Resource Consumption (Memory),DoS: Resource Consumption (Other): The typical consequence is CPU consumption, but memory consumption and consumption of other resources can also occur.
Developer Pattern
CWE-407 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-407, 4.20.
Official CWE Definition
CWE-407: Inefficient Algorithmic Complexity
An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- This example attempts to check if an input string is a "sentence" [REF-1164]. [object Object],Note that [REF-1164] has a more thorough (and lengthy) explanation of everything going on within the RegEx.
Remediation
- Use safe APIs
- Centralize the control
- Add regression tests
- Review logs and telemetry for attempted abuse
Detection
- Code review
- SAST
- DAST
- Focused regression tests
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.