Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-835 (不可达退出条件的循环(无限循环)) — Vulnerability Class 212

212 vulnerabilities classified as CWE-835 (不可达退出条件的循环(无限循环)). AI Chinese analysis included.

CWE-835 represents a logic error where a software loop lacks a reachable termination condition, resulting in an infinite execution cycle. This weakness typically manifests when developers fail to update loop variables correctly or rely on floating-point comparisons prone to precision errors. Attackers exploit this vulnerability to trigger Denial of Service (DoS) attacks by consuming excessive CPU resources, effectively freezing the application or system. To mitigate this risk, developers must ensure loop counters are properly incremented or decremented within the iteration body. Implementing strict boundary checks, avoiding direct equality comparisons with floating-point numbers, and utilizing static analysis tools can help detect unreachable exit conditions early. Additionally, incorporating timeout mechanisms or maximum iteration limits provides a safety net, ensuring that even if logic errors occur, the process terminates gracefully without exhausting system resources.

MITRE CWE Description
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
Common Consequences (1)
AvailabilityDoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Amplification
An infinite loop will cause unexpected consumption of resources, such as CPU cycles or memory. The software's operation may slow down, or cause a long time to respond.
Examples (2)
In the following code the method processMessagesFromServer attempts to establish a connection to a server and read and process messages from the server. The method uses a do/while loop to continue trying to establish the connection to the server when an attempt fails.
int processMessagesFromServer(char *hostaddr, int port) { ... int servsock; int connected; struct sockaddr_in servaddr; // create socket to connect to server servsock = socket( AF_INET, SOCK_STREAM, 0); memset( &servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(port); servaddr.sin_addr.s_addr = inet_addr(hostaddr); do { // establish connection to server connected = connect(servsock, (struct sockaddr *)&servaddr, sizeof(servaddr)); // if connected then read and process messages from server if (connected > -1) { // read and process messages ... } // keep tr
Bad · C
int processMessagesFromServer(char *hostaddr, int port) { ... // initialize number of attempts counter int count = 0; do { // establish connection to server connected = connect(servsock, (struct sockaddr *)&servaddr, sizeof(servaddr)); // increment counter count++; // if connected then read and process messages from server if (connected > -1) { // read and process messages ... } // keep trying to establish connection to the server // up to a maximum number of attempts } while (connected < 0 && count < MAX_ATTEMPTS); // close socket and return success or failure ... }
Good · C
For this example, the method isReorderNeeded is part of a bookstore application that determines if a particular book needs to be reordered based on the current inventory count and the rate at which the book is being sold.
public boolean isReorderNeeded(String bookISBN, int rateSold) { boolean isReorder = false; int minimumCount = 10; int days = 0; // get inventory count for book int inventoryCount = inventory.getIventoryCount(bookISBN); // find number of days until inventory count reaches minimum while (inventoryCount > minimumCount) { inventoryCount = inventoryCount - rateSold; days++; } // if number of days within reorder timeframe // set reorder return boolean to true if (days > 0 && days < 5) { isReorder = true; } return isReorder; }
Bad · Java
public boolean isReorderNeeded(String bookISBN, int rateSold) { ... // validate rateSold variable if (rateSold < 1) { return isReorder; } ... }
Good · Java
CVE IDTitleCVSSSeverityPublished
CVE-2021-37622 Denial of service due to infinite loop in JpegBase::printStructure (#1) — exiv2 5.5 Medium2021-08-09
CVE-2021-37623 Denial of service due to infinite loop in JpegBase::printStructure (#2) — exiv2 5.5 Medium2021-08-09
CVE-2021-34332 Siemens Jt2go 和 Siemens Teamcenter Visualization 安全漏洞 — JT2Go 5.5 -2021-07-13
CVE-2021-21279 Infinite loop in IPv6 neighbor solicitation processing — contiki-ng 7.5 High2021-06-18
CVE-2021-3468 Avahi 安全漏洞 — avahi 5.5 -2021-06-02
CVE-2021-29591 Stack overflow due to looping TFLite subgraph — tensorflow 7.3 High2021-05-14
CVE-2021-29510 Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic — pydantic 3.3 Low2021-05-13
CVE-2021-29482 denial of service in github.com/ulikunitz/xz — xz 7.5 High2021-04-28
CVE-2021-3508 PDFResurrect 安全漏洞 — PDFResurrect 5.5 -2021-04-28
CVE-2021-25663 Siemens Nucleus 安全漏洞 — Capital Embedded AR Classic 431-422 7.5 High2021-04-22
CVE-2021-25664 Siemens Nucleus 安全漏洞 — Capital Embedded AR Classic 431-422 7.5 High2021-04-22
CVE-2021-0273 Junos OS and Junos OS Evolved: Trio Chipset: Denial of Service due to packet destined to device's interfaces. — Junos OS 5.3 Medium2021-04-22
CVE-2021-28657 Infinite loop in Apache Tika's MP3 parser — Apache Tika 5.5 -2021-03-31
CVE-2021-20270 Red Hat Ansible Automation 安全漏洞 — python-pygments 7.5 -2021-03-23
CVE-2021-3416 QEMU 安全漏洞 — QEMU 3.2 -2021-03-18
CVE-2021-25673 Siemens SIMATIC 安全漏洞 — SIMATIC S7-PLCSIM V5.4 5.5 -2021-03-15
CVE-2021-20255 QEMU 安全漏洞 — QEMU 5.5 -2021-03-09
CVE-2018-20803 Infinite loop in aggregation expression — MongoDB Server 6.5 Medium2020-11-23
CVE-2020-25641 Linux kernel 安全漏洞 — kernel 5.5 -2020-10-06
CVE-2020-5761 Grandstream HT800 series 安全漏洞 — Grandstream HT800 Series 7.5 -2020-07-29
CVE-2019-5091 LEAD Technologies LEADTOOLS 安全漏洞 — LEADTOOLS libltdic.so 7.5 -2019-12-11
CVE-2019-5097 Embedthis Software GoAhead 安全漏洞 — EmbedThis 7.5 -2019-12-03
CVE-2019-3560 fizz 缓冲区错误漏洞 — fizz 7.5 -2019-04-29
CVE-2019-3900 Linux kernel 资源管理错误漏洞 — Kernel 7.7 -2019-04-25
CVE-2019-3833 Openwsman 资源管理错误漏洞 — openwsman 7.5 -2019-03-14
CVE-2019-3819 Linux kernel 资源管理错误漏洞 — kernel: 4.4 -2019-01-25
CVE-2018-14621 libtirpc 安全漏洞 — libtirpc 7.5 -2018-08-30
CVE-2016-9581 OpenJPEG 缓冲区错误漏洞 — openjpeg2 8.1 -2018-08-01
CVE-2017-2646 Red Hat keycloak 安全漏洞 — keycloak 7.5 -2018-07-27
CVE-2017-2670 Red Hat Undertow 资源管理错误漏洞 — undertow 7.5 -2018-07-27

Vulnerabilities classified as CWE-835 (不可达退出条件的循环(无限循环)) represent 212 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.