RedSun: How Windows Defender Becomes the Write Primitive

A Windows privilege-escalation PoC that chains Cloud Files, reparse points, and native NT file operations into one deeply ironic attack path.

9 min read • View on GitHub • More from Nightmare-Eclipse

A magnifying glass labeled Defender presses into a hidden mechanism, while cloud paths and file redirection levers guide the force toward a protected cabinet. It explains the article’s core idea: a defensive action can be turned into the write primitive that completes the attack.
RedSun’s twist is not bypassing protection. It is making protection do the writing.
Key Takeaways

The Strange Part: Defender Is the Helper

RedSun is interesting because it inverts the usual defender-versus-attacker script. The PoC allegedly tricks Windows Defender into rewriting a malicious file back to its original location, and that write becomes the privilege-escalation path.

That is the whole judo move. Instead of fighting the platform’s protections head-on, the exploit uses a legitimate remediation path as the thing that touches a protected target. The result is a security bug that looks, at first glance, like a feature doing its job.

When Windows Defender realizes that a malicious file has a cloud tag, for whatever stupid and hilarious reason, the antivirus that's supposed to protect decides that it is a good idea to just rewrite the file it found again to it's original location. The PoC abuses this behaviour to overwrite system files and gain administrative privileges.

Nightmare-Eclipse, Project Creator and Maintainer · RedSun GitHub Repository README

Who Built It, and What They Actually Published

The repository is a minimal research drop from Nightmare-Eclipse/RedSun. It is not a product, and it is not trying to be polished. It is a single-purpose PoC with one job: demonstrate the chain.

That matters because the repo’s structure tells you what kind of artifact this is. A flat codebase, a single C++ file, and no attempt at abstraction usually means the author is optimizing for exploit clarity, not maintainability.

A hedcut-style portrait of the GitHub user Nightmare-Eclipse. It identifies the creator behind the repository and gives the article a human anchor for the exploit research.

The Attack Chain, at a Glance

The shortest way to understand RedSun is as a sequence of normal Windows behaviors that become dangerous when chained together. A bait file gets marked as cloud-managed, Defender touches it, the write path is redirected, and the protected target becomes the destination instead of the source.

The exploit is a chain, not a single bug. The control point appears when Defender’s write path meets attacker-controlled redirection.

The interesting part is that none of the ingredients are exotic by themselves. Cloud files, reparse points, VSS enumeration, and NT-native file operations all belong to normal Windows plumbing. RedSun’s novelty is in how it arranges them.

How the PoC Stages the Write

The code leans on native APIs instead of higher-level Win32 convenience wrappers. That gives the author more direct control over file disposition, rename behavior, and object-manager namespace lookup, which is exactly where a race-oriented PoC wants to live.

// Conceptual shape of the primitive, not a full listing.
// The exploit wants the write to land somewhere else.
NtSetInformationFile(hFile, &info, sizeof(info), FileRenameInformation);
NtSetInformationFile(hFile, &disp, sizeof(disp), FileDispositionInformationEx);
// Reparse logic and cloud-managed state influence where Defender's write goes.

That’s why going under Win32 matters. When you stay at the NT layer, you can work with the file system as the kernel sees it, not as a friendly API wants to present it. In a race-heavy exploit, that difference is the whole game.

A single bait file sits on a white desk while a cloud tag hovers above it and a hidden track splits into two paths. One path leads to a harmless folder, the other slips behind a reparse point toward System32, showing how redirection turns a normal file into a privileged write target.
The bait file is ordinary. The path underneath it is not.

Why Cloud Tags Are the Real Twist

The cloud-tag detail is what makes RedSun feel fresh. Cloud Files exists to let Windows treat remote or placeholder-backed content as first-class files, which is great for sync and storage integration. It is also a rich source of unintended behavior when a security product interacts with it.

That is the deeper pattern here. RedSun does not need a memory corruption bug or an exotic kernel exploit. It uses an ordinary trust boundary, cloud-managed file state, and a privileged remediation step to create a write primitive that should not exist.

TechniqueTriggerPrivileged actor abusedMain redirection primitiveWhy RedSun is different
Junction or symlink LPEA privileged process follows a filesystem linkInstaller, service, or cleanup taskDirectory redirectionRelies on path confusion alone, without security software in the loop
Reparse-point file write abuseA privileged write lands on a redirected pathBackup, repair, or cleanup logicReparse point or mount pointUses file system semantics, but not Defender’s remediation behavior
Generic AV tamperingAntivirus acts on a detected threatAntimalware serviceQuarantine, delete, or replace workflowFocuses on AV behavior, but usually not as the write target itself
RedSunCloud-tagged malicious file meets Defender remediationWindows DefenderCloud Files state plus redirection chainTurns protection logic into the privileged writer and folds in modern Windows subsystems

RedSun’s twist is not that it uses a redirect. Plenty of old bugs do that. The twist is that the redirect is apparently reached through a security product’s own cleanup path, which is a much stranger and more modern kind of abuse.

How This Differs From Older LPE Tricks

Classic local privilege escalation often depends on one narrow mistake. A service writes where it should not. A junction catches the write. A privileged installer follows a link. RedSun sits in the same family, but the choreography is newer and more layered.

Instead of a single confused write, RedSun reportedly combines cloud-file handling, shadow-copy enumeration, NT-native file operations, and reparse-point redirection. That makes it feel less like a single bug and more like an emergent failure mode in a feature-rich OS.

It also changes the defensive lesson. The problem is not only broken validation. It is the interaction between components that were each reasonable in isolation.

What RedSun Says About Modern Windows

RedSun is a small PoC with a big implication. As Windows accumulates cloud integration, remediation logic, and low-level file-system features, the number of surprising control surfaces grows too. Security features become part of the attack surface simply because they are powerful enough to act on files.

That is why this repository is worth reading even if you never touch exploit development. It is a compact example of how modern systems fail: not in one obvious place, but in the seams between trusted subsystems.