---
title: "CWE-585: Empty Synchronized Block"
url: https://radicalnotion.ai/cwe/cwe-585
type: cwe
description: "The product contains an empty synchronized block."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-585: Empty Synchronized Block

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The product contains an empty synchronized block.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | An empty synchronized block can occur because code no longer needed within the synchronized block is commented out without removing the synchronized block. |

## Applicable platforms

**Languages:** Java (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Other | An empty synchronized block does not actually accomplish any synchronization and may indicate a troubled section of code. An empty synchronized block will wait until nobody else is using the synchronizer being specified. While this may be part of the desired behavior, because you haven't protected the subsequent code by placing it inside the synchronized block, nothing is stopping somebody else from modifying whatever it was you were waiting for while you run the subsequent code. |

## Potential mitigations

### Implementation

When you come across an empty synchronized statement, or a synchronized statement in which the code has been commented out, try to determine what the original intentions were and whether or not the synchronized block is still necessary.

## Detection methods

### 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

## Demonstrative examples

### Example 1

The following code attempts to synchronize on an object, but does not execute anything in the synchronized block. This does not actually accomplish anything and may be a sign that a programmer is wrestling with synchronization but has not yet achieved the result they intend.

Bad code:

```java
synchronized(this) { }
```

Good code:

```java
public void setID(int ID){
    synchronized(this){
        this.ID = ID;
    }
}
```

Instead, in a correct usage, the synchronized statement should contain procedures that access or modify data that is exposed to multiple threads. For example, consider a scenario in which several threads are accessing student records at the same time. The method which sets the student ID to a new value will need to make sure that nobody else is accessing this data at the same time and will require synchronization.

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1071](https://radicalnotion.ai/cwe/cwe-1071) | Empty Code Block |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| Software Fault Patterns | Multiple locks/unlocks | SFP21 | - |

## Frequently asked questions

### What is CWE-585?

The product contains an empty synchronized block.

### How do you prevent CWE-585?

When you come across an empty synchronized statement, or a synchronized statement in which the code has been commented out, try to determine what the original intentions were and whether or not the synchronized block is still necessary.

### How is CWE-585 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-585?

Exploiting CWE-585 can lead to: Other.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/585.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-585). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
