Skip to content

CWE-460: Improper Cleanup on Thrown Exception

BaseLikelihood of exploit: Medium

The product does not clean up its state or incorrectly cleans up its state when an exception is thrown, leading to unexpected state or control flow.

Often, when functions or loops become complicated, some level of resource cleanup is needed throughout execution. Exceptions can disturb the flow of the code and prevent the necessary cleanup from happening.

Consequences

  • Other: Varies by Context

How to prevent it

  • Implementation: If one breaks from a loop or function by throwing an exception, make sure that cleanup happens or that you should exit the program. Use throwing exceptions sparsely.

Recent advisories

  • EEF-CVE-2026-111103 — HTTP/2 StreamError recovery rolls back connection state and bypasses per-connection limits in Bandit
  • GHSA-fhv5-28vv-h8m8 — PyJWKClient unbounded JWKS endpoint requests via attacker-controlled kid values (DoS)
  • GHSA-3p2h-wqq4-wf4h — Apache Tomcat Denial of Service via invalid HTTP priority header
  • GHSA-qq29-5vjh-vxwr — rdiffweb vulnerable to Improper Cleanup on Thrown Exception

All advisories for CWE-460

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor