CWE-460: Improper Cleanup on Thrown Exception
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.
Last updated
Overview
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.
Real-world CVEs
27 recorded CVEs are caused by CWE-460 (Improper Cleanup on Thrown Exception). The highest-severity and most recent are shown first. 10 new CWE-460 CVEs have been recorded so far in 2026 (3 in 2025).
- CVE-2022-22150High · CVSS 8.8 · EPSS 79th2022-02-04
- CVE-2026-123558
Zebra before 7.0.0 Checkpoint Sync Denial of Service via Cancelled Verifier Rewind
High · CVSS 8.7 · EPSS 28th2026-11-08 - CVE-2026-111103
HTTP/2 StreamError recovery rolls back connection state and bypasses per-connection limits in Bandit
High · CVSS 8.2 · EPSS 51th2026-10-26 - CVE-2022-4744High · CVSS 7.8 · EPSS 40th2023-03-30
- CVE-2026-93710
Dancer2 versions from 2.0.0 before 2.2.0 for Perl dispatch a route that a dying hook refused when the exception handler halts the response in compile_hooks
High · CVSS 7.5 · EPSS 50th2026-09-22 - CVE-2025-30157
Envoy crashes when HTTP ext_proc processes local replies
High · CVSS 7.5 · EPSS 38th2025-03-21 - CVE-2024-0316
Improper cleanup vulnerability in FireEye Endpoint Security
High · CVSS 7.5 · EPSS 25th2024-01-15 - CVE-2023-46393High · CVSS 7.5 · EPSS 45th2023-10-27
- CVE-2024-20354High · CVSS 7.4 · EPSS 22th2024-03-27
- CVE-2021-34716
Cisco Expressway Series and TelePresence Video Communication Server Remote Code Execution Vulnerability
High · CVSS 7.2 · EPSS 84th2021-08-18 - CVE-2026-86748
Snipe-IT before 8.7.0 Database Wipe via Invalid Backup Archive
Medium · CVSS 6.9 · EPSS 34th2026-09-09 - CVE-2026-61387
In Eclipse Milo versions 1.0.0 through 1.1.4, monitored-item quota accounting is not exception...
Medium · CVSS 6.9 · EPSS 50th2026-08-04
Showing 12 of 27 recorded CWE-460 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsCommon consequences
What can happen when CWE-460 is exploited.
Varies by Context
Affects: Other
The code could be left in a bad state.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Languages
How to prevent it
Practical mitigations for CWE-460, grouped by where in the lifecycle they apply.
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.
How to detect it
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness: High
Code examples
MITRE examples of the weakness in code.
The following example demonstrates the weakness.
Vulnerable example
public class foo {
public static final void main( String args[] ) {
//check some conditionIn this case, a thread might be left locked accidentally.
Terminology & mappings
Mapped taxonomies
- CLASP: Improper cleanup on thrown exception
- The CERT Oracle Secure Coding Standard for Java (2011): Restore prior object state on method failure (ERR03-J)
- The CERT Oracle Secure Coding Standard for Java (2011): Do not let checked exceptions escape from a finally block (ERR05-J)
- SEI CERT Perl Coding Standard: Do not suppress or ignore exceptions (EXP31-PL) — Imprecise fit
Frequently asked questions
Common questions about CWE-460.
- What is CWE-460?
- 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.
- What CVEs are caused by CWE-460?
- 27 recorded CVEs are attributed to CWE-460, including CVE-2022-22150, CVE-2026-123558 and CVE-2026-111103.
- How do you prevent CWE-460?
- 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.
- How is CWE-460 detected?
- Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
- What are the consequences of CWE-460?
- Exploiting CWE-460 can lead to: Varies by Context.
- Is CWE-460 actively exploited?
- 27 recorded CVEs are caused by CWE-460; none are currently in CISA's KEV catalog of actively exploited flaws.
Sources
- [1]The CLASP Application Security Process (2005)
References
- MITRE CWE definition (CWE-460) (opens in a new tab)
- CWE-460 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Track CWE-460 CVEs
Get an alert when a new CWE-460 CVE affects your products, with AI-written analysis and remediation steps.