This weakness occurs when a function or method has an overly complex control flow, measured by a high McCabe Cyclomatic Complexity score. This makes the code difficult to read, test, and maintain.
High cyclomatic complexity directly impacts code quality and security. Complex, tangled code paths are harder for developers to fully understand, making it easy to miss edge cases or introduce logic errors during modifications. This complexity also makes thorough unit testing impractical, as covering all possible execution paths becomes unmanageable, leaving untested code that could contain vulnerabilities. From a security perspective, this creates a risky environment. Security flaws are more likely to hide within the convoluted logic and are more difficult to spot during code reviews or audits. Furthermore, fixing any discovered vulnerability within such a complex function is riskier and more time-consuming, increasing the chance of introducing new bugs or security regressions.