CWE-674 未经控制的递归 类弱点 212 条 CVE 漏洞汇总,含 AI 中文分析。
CWE-674 属于资源管理不当类漏洞,指程序未对递归深度进行有效限制,导致内存或栈空间被过度消耗。攻击者通常通过构造深层嵌套的输入或恶意请求,触发无限或过深的递归调用,从而耗尽系统资源,引发拒绝服务攻击。开发者应在代码中设置明确的递归终止条件或最大深度阈值,并引入迭代逻辑替代深层递归,以确保资源使用的可控性。
void do_something_recursive (int flg) { ... // Do some real work here, but the value of flg is unmodified if (flg) { do_something_recursive (flg); } // flg is never modified so it is always TRUE - this call will continue until the stack explodes } int flag = 1; // Set to TRUE do_something_recursive (flag);void do_something_recursive (int flg) { ... // Do some real work here // Modify value of flg on done condition if (flg) { do_something_recursive (flg); } // returns when flg changes to 0 } int flag = 1; // Set to TRUE do_something_recursive (flag);CWE-674(未经控制的递归) 是常见的弱点类别,本平台收录该类弱点关联的 212 条 CVE 漏洞。