No CVE · No Patch · No Traces
Ransomware-grade availability impact. Zero writes. Zero encryption. Zero signals in your SIEM.
The security industry has invested a decade building ransomware defenses around one foundational assumption: to deny availability, an attacker must transform the data. Encrypt it. Rename it. Write something to disk.
GhostLock invalidates that assumption entirely. By calling CreateFileW with
dwShareMode = 0x00000000 across a target share, a low-privileged user holds
files in an exclusively locked state indefinitely. Other clients receive
STATUS_SHARING_VIOLATION (0xC0000043) on every access attempt.
ERP systems fail. Workflow queues stall. The impact is indistinguishable from encrypted ransomware.
The attack produces none of the signals that encrypted ransomware produces.
This is not a vulnerability. There is no patch. CreateFileW with no sharing is
correct, documented behavior required for data integrity across thousands of enterprise
applications. The technique has been available to any authenticated Windows user for 30 years.
Any organization running SMB-backed shared file infrastructure where users have standard domain credentials and network access to file shares. This describes essentially every enterprise environment on earth.
Every file open on Windows goes through a single API: CreateFileW. Among its
parameters is dwShareMode — a bitmask that tells the operating system whether
other processes are allowed to open the same file concurrently. Three flags exist:
FILE_SHARE_READ, FILE_SHARE_WRITE, and
FILE_SHARE_DELETE. Setting any flag grants that type of concurrent access.
Setting none of them — passing 0x00000000 — is the exclusive mode.
When dwShareMode = 0, the Windows I/O Manager records the handle as exclusive
in the kernel's per-file SHARE_ACCESS structure. From that moment, any other
process or remote client attempting to open the same file for any reason receives
STATUS_SHARING_VIOLATION (0xC0000043) — immediately, before any disk I/O
occurs. The lock lives entirely in kernel memory. It requires no elevated privilege, no
driver, and no special capability. It is the same mode Microsoft Word uses when you open
a document for editing.
Over SMB, this exclusivity request travels as the ShareAccess field of an
SMB2 CREATE request. The file server receives it, records the exclusive open
in its session table, and begins rejecting all subsequent opens of that file from any other
client on the network. The handle persists — and the lock holds — for as long as the
TCP session remains alive. There is no timeout. There is no server-side limit on how many
files a single session may hold in this state.
The result is exactly what any user experiences when they try to open a file that someone else already has open for editing:
↑ What every client sees while GhostLock holds the handle
GhostLock scales this single API call across an entire directory tree. Using a 32-thread
parallel scanner, it acquires exclusive handles on hundreds of thousands of files within
minutes. Every one of those files then produces this dialog — or its programmatic equivalent,
a STATUS_SHARING_VIOLATION error — for every other client on the network that
tries to access them. Business applications fail. ERP systems throw errors. Workflow queues
stall. The organization experiences the same operational impact as a ransomware attack.
Nothing was written. Nothing was encrypted. The ghost left no trace.
// The entire attack in one API call — repeated across every file HANDLE CreateFileW( L"\\fileserver\share\critical.xlsx", 0x80000000, // GENERIC_READ — standard user permission 0x00000000, // dwShareMode = 0 <-- deny ALL concurrent access NULL, 3, // OPEN_EXISTING 0x00000080, // FILE_ATTRIBUTE_NORMAL NULL ); // Every other client now receives STATUS_SHARING_VIOLATION (0xC0000043) // until this handle is closed or the session is forcibly terminated. // No writes. No renames. No encryption. Nothing on disk changed.
GhostLock uses a 32-thread parallel os.scandir() scanner to discover and lock
files recursively. Each directory listing is a separate SMB round-trip, so parallelizing
across threads cuts wall-clock time dramatically. On a share containing 500,000 files over a
standard 10 GbE LAN, full lock acquisition completes in under 10 minutes — faster than any
encryption-based ransomware operating against the same file set, generating none of the I/O
signatures encryption produces.
If the attacker's session is terminated, re-running GhostLock against the same path re-establishes all locks within minutes. The files are never modified, so there is no partial state to reason about. The attacker can maintain their position indefinitely. The victim has no recourse except to locate the session and terminate it — a task requiring storage administration expertise most incident response teams do not have on-call.
GhostLock v2 introduces a more surgical variant: locking the directory object
itself rather than individual files. By passing
FILE_FLAG_BACKUP_SEMANTICS alongside dwShareMode = 0,
a caller opens a directory with an exclusive deny-share handle using a single API call.
One handle. The entire folder.
Where the original technique requires one handle per file — potentially tens of thousands of handles to cover a share — directory-level locking achieves targeted structural disruption with a single handle. No file enumeration. No parallel scanner. No cache. Just a path and a flag.
// Lock an entire directory with a single handle HANDLE CreateFileW( L"\\\\fileserver\\share\\finance", 0x80000000, // GENERIC_READ 0x00000000, // dwShareMode = 0 <-- deny all concurrent access NULL, 3, // OPEN_EXISTING 0x02000000, // FILE_FLAG_BACKUP_SEMANTICS <-- opens directory objects NULL ); // One handle. One call. The directory becomes a namespace blackout.
Controlled testing over a real SMB share confirms that the SMB server enforces directory exclusivity more aggressively than local NTFS. The results reveal a namespace blackout: the directory structure becomes frozen and invisible to every other SMB client while the single handle is held.
| Operation | Local NTFS | Over SMB |
|---|---|---|
| Rename file inside dir | Blocked | Blocked |
| List directory contents | Allowed | Blocked |
| Recursive copy / backup | Allowed | Blocked |
| Open directory object | Blocked | Blocked |
The critical SMB-specific finding is directory enumeration. On local NTFS, child
operations are largely unaffected by an exclusive handle on the parent directory.
Over SMB, the server enforces the exclusivity at the namespace level:
Get-ChildItem, Explorer browsing, recursive backup operations, and
search indexers that enumerate directory contents all fail with
ERROR_SHARING_VIOLATION. The directory becomes a black box.
Individual files at known paths remain accessible — the lock does not block reads or writes to files whose paths are already known. What it destroys is discoverability. No client can learn what is inside the directory. No backup can traverse it. No indexer can crawl it. With one handle held by one standard user, an entire department folder tree becomes operationally invisible.
| Detection Layer | Encryption Ransomware | GhostLock |
|---|---|---|
| Honeypot / canary files | Triggers on write | Read-only. Silent. |
| Write-rate anomaly detection | High volume fires alert | Zero writes. No alert. |
| Behavioral AI (encryption patterns) | Entropy, bulk renames | No writes. AI sees nothing. |
| EDR on the attacking endpoint | Shellcode, injection | Looks like file indexer |
| Network / DPI inspection | Bulk SMB writes flagged | Identical to Word opening a doc |
| DLP / content inspection | Bulk read anomaly | Indistinguishable from backup agent |
| Storage session open-file count | Not relevant | Only reliable signal |
The only observable that reliably identifies this attack is the per-session open-file count
with ShareAccess = 0 at the file server layer — a metric that lives inside
storage platform management interfaces, not in Windows event logs, not in EDR telemetry,
not in network flow data.
Virtually no enterprise SIEM currently ingests it.
GhostLock is an open-source Python proof-of-concept released for research, authorized red team engagements, and to enable defenders to verify their own detection posture. Run only on systems you own or have explicit written authorization to test.
# Launch interactive menu — no arguments needed python ghostlock.py Select mode: [1] Manual path — paste a UNC path and lock all files [2] Auto-discover — find shared folders on the network, pick which to lock [3] Directory lock — namespace blackout with a single handle (v2) [q] Quit # Option 2 scans the network and shows a multi-select list: [OK] \server\finance 12 files visible [OK] \server\projects 84 files visible [NO] \server\admin (inaccessible) Select : 1,2 <-- or type 'all' # Option 3 — one handle, entire folder locked over SMB: [?] Target directory : \\fileserver\share\finance [+] Exclusive directory handle acquired! Handle: 0x240 [~] Holding ... 12s | directory locked # CLI mode (scripted / automated) python ghostlock.py "\\fileserver\share\dept" --existing-folder --confirm-existing-lock --hold-indefinite
A sentinel file (.ghostlock_authorized) must be placed manually in the target
directory before the tool will operate on existing files. This is a deliberate authorization
gate — the tool cannot run against any path an operator has not explicitly marked.
CreateFileW with dwShareMode = 0 is correct, documented behavior specified in the SMB protocol and required for data integrity by thousands of enterprise applications including Microsoft Office, database engines, and version control systems. Patching this behavior would break the file integrity model that enterprise applications depend on. There is no CVE. There is no fix coming.CREATE request with ShareAccess = 0 over SMB2 is indistinguishable at the packet level from a user opening a document in Microsoft Word for exclusive editing. There is no network signature that separates malicious use from legitimate exclusive file access. Any rule broad enough to catch GhostLock would block normal user activity at scale.ShareAccess field is in scope. This includes on-premises NAS platforms, Windows File Server, and cloud services that expose SMB endpoints such as Azure Files. The technique is not vendor-specific — it is an SMB protocol behavior.NtCreateFile over the network redirector — identical to a file indexer or backup pre-scan agent. No process behavior heuristic flags this workload without simultaneously flagging legitimate applications that do the same thing.CreateFileW API via ctypes and runs on Windows only. However, the underlying SMB2 protocol behavior is platform-agnostic — any SMB2 client capable of sending ShareAccess = 0 in a CREATE request can produce the same effect. The Windows implementation is the most practical because exclusive file handles are a standard part of the Win32 programming model.ShareAccess = 0 simultaneously. Secondary signal: bulk SMB CREATE operations from a single source IP with zero corresponding WRITE operations over a 30-minute window. See the research paper for full SIEM query examples.CreateFileW call with FILE_FLAG_BACKUP_SEMANTICS and dwShareMode = 0 acquires an exclusive handle on the entire folder. Over SMB this creates a namespace blackout: other clients cannot list directory contents, cannot rename anything inside, cannot recursively copy or backup the tree, and cannot open the directory object. Individual files at known paths remain accessible. The detection footprint is a single SMB2 CREATE on a directory path — indistinguishable from a backup agent opening a folder for traversal. One handle. One API call. No file enumeration required.
Research inquiries, authorized testing questions, or detection engineering collaboration:
linkedin.com/in/kim-d-5b3114111
GitHub: github.com/kimd155
Research paper: zenodo.org/records/20070064