Amazon WorkSpaces ships a service called Skylight. It runs as NT AUTHORITY\SYSTEM on every managed Windows desktop AWS sells, and on a schedule it performs log rotation: take the files in C:\ProgramData\Amazon\Skylight Metrics Agent\, move them into a subdirectory called ROTATE, enumerate ROTATE, hand the contents to the upload path. Skylight does not create ROTATE. The standard user does.
CVE-2026-7791: Skylight Doesn't Create ROTATE. The Standard User Does.
vendor
patterns
cve
proof of concept
ROTATE is whatever the standard user said it was
The Skylight Workspace Config Service runs as NT AUTHORITY\SYSTEM. Its working directory is C:\ProgramData\Amazon\Skylight Metrics Agent\. The parent C:\ProgramData\Amazon\ inherits the default ProgramData ACL, which grants BUILTIN\Users the (OI)(CI)(special access:) entry that resolves to create-files, create-directories, and read-and-execute on every child. The Skylight installer does not lock the working directory down further with SECURITY_ATTRIBUTES at create time, and the inherited grant carries through.
The PoC's setup logic confirms what the ACL implies. From poc.c:
DWORD rotateAttrs = GetFileAttributesW(L"C:\\ProgramData\\Amazon\\Skylight Metrics Agent\\ROTATE");
if (rotateAttrs == INVALID_FILE_ATTRIBUTES) {
// create as a junction via mklink /J
} else if (rotateAttrs & FILE_ATTRIBUTE_REPARSE_POINT) {
// already a junction, reuse it
} else {
// ROTATE exists as a normal directory; delete and recreate as a junction
if (RemoveDirectoryW(L"...\\ROTATE") || DeleteFileW(L"...\\ROTATE")) { ... }
}Three branches, one for every initial state the standard user might encounter on a live WorkSpaces instance. If Skylight has not yet created ROTATE, the user creates it. If it already exists as a normal directory, the user deletes it and recreates it. If a previous PoC run left a junction in place, the user reuses it. Each branch ends with ROTATE as an NTFS junction pointing wherever the standard user chose. The default target in poc.c is C:\Program Files\Amazon\EC2Launch, the AWS-provided agent that runs at instance boot and loads its plugin DLLs from its own install directory.
The user then drops a payload into the working directory:
copy AutoPilot.dll "C:\ProgramData\Amazon\Skylight Metrics Agent\"Skylight's archive routine, named ArchiveLogFilesExceptFor(currentLog) in the PoC's reverse-engineering notes, is .NET. The relevant call is File.Move:
foreach (var file in Directory.GetFiles(currentDir))
{
if (file == currentLog) continue;
File.Move(file, Path.Combine(rotateDir, Path.GetFileName(file)));
}rotateDir is the literal string "C:\ProgramData\Amazon\Skylight Metrics Agent\ROTATE". The service does not check the path for the FILE_ATTRIBUTE_REPARSE_POINT bit. It does not open the destination with FILE_FLAG_OPEN_REPARSE_POINT and reject the open if the attribute is set. It hands a string to File.Move and lets the NTFS driver walk the reparse point. When the rotation fires, File.Move(".\\Skylight Metrics Agent\\AutoPilot.dll", ".\\ROTATE\\AutoPilot.dll") resolves to C:\Program Files\Amazon\EC2Launch\AutoPilot.dll. SYSTEM writes. The ACL on the resulting file is the EC2Launch directory's ACL. The standard user cannot write to C:\Program Files\Amazon\EC2Launch. SYSTEM just did, on the standard user's behalf, to a file name the standard user picked, with bytes the standard user supplied.
EC2Launch loads DLLs from its install directory at instance start, with LoadLibrary calls on names that resolve before any signature check the WorkSpaces image applies. On the next reboot, AutoPilot.dll runs as SYSTEM inside the EC2Launch process. The local privilege escalation primitive is complete on a single reboot, and the persistence is whatever lifetime EC2Launch has. The persistence path is also why the PoC's default target is the EC2Launch directory rather than System32. The latter would require a more specific filename matching a DLL EC2Launch's loader resolves; the former takes anything the attacker names AutoPilot.
The TOCTOU is downstream of the bug
The CVE record names two issues: TOCTOU and arbitrary file write. The previous section is the arbitrary file write. The TOCTOU is a one-to-ten-millisecond window between File.Move completing and Skylight's next call running. That next call, in the PoC's notes, is:
public static string[] GetArchivedFiles()
{
if (!Directory.Exists(rotateDir)) return new string[0];
return Directory.GetFiles(rotateDir);
}The caller of GetArchivedFiles iterates the returned filenames and moves them again, this time to a sibling directory the PoC's notes call TRANSMITTED. The second move would resolve through the same junction. The attacker's AutoPilot.dll, freshly written to C:\Program Files\Amazon\EC2Launch\, would be picked up by the enumeration, taken back out of EC2Launch, and dropped into C:\ProgramData\Amazon\Skylight Metrics Agent\TRANSMITTED\. The arbitrary file write would have been undone, in milliseconds, by the same loop that wrote it.
The attacker's job in the TOCTOU window is to delete ROTATE between File.Move and the Directory.Exists check. With the junction gone, Directory.Exists returns false. GetArchivedFiles returns the empty array. The cleanup move never runs. The file stays at EC2Launch.
The PoC handles the deletion with four monitor threads, HIGH_PRIORITY_CLASS on the process, THREAD_PRIORITY_HIGH on the watchers, three ReadDirectoryChangesW notifiers, and a one-millisecond polling fallback:
volatile LONG g_rotateDeleted = 0;
bool DeleteRotateJunction(void) {
if (InterlockedCompareExchange(&g_rotateDeleted, 1, 0) != 0) return false;
for (int attempt = 0; attempt < 3; attempt++) {
if (RemoveDirectoryW(ROTATE_DIR)) {
if (GetFileAttributesW(ROTATE_DIR) == INVALID_FILE_ATTRIBUTES) return true;
}
}
// fall back to DeleteFileW, then cmd.exe /c rmdir /Q /S as last resort
}The watchers trigger the deletion when the target file appears in EC2Launch, when the source file disappears from Skylight Metrics Agent\, or when one-millisecond polling notices either before the directory-change notification arrives. The architecture suggests a race the attacker can lose. The architecture is more than the bug requires; the attacker can lose the cleanup race and re-run at the next rotation tick, and the primitive on the rotation tick after that is what it is.
A TOCTOU mitigation here, adding a stat check between the move and the enumeration, replacing Directory.Exists with a handle held across both calls, treating the cleanup as a transactional move, closes the cleanup race. None of them closes the bug. The bug is that the destination of File.Move is a path the standard user owns. The race the PoC describes in detail is the race for the cleanup, not the race for the primitive.
This is the canonical TOCTOU That Isn't wedge: the timing word in the CVE title points the fix toward atomicity. The atomicity fix preserves the primitive.
Why does this exist
This is Junction Preemption. Skylight writes to C:\ProgramData\Amazon\Skylight Metrics Agent\ROTATE as SYSTEM and treats the path as if its installer owned it. The installer did not. The parent's ACL says so, and the PoC's setup branch tests every initial state and handles all of them.
The prior exhibit on this pattern is Lenovo's LdeApi.Server.exe, published in April. LdeApi.Server.exe writes MP27AM7W_estimation.json to C:\ProgramData\Lenovo\LDE\SYSTEM as SYSTEM. The path does not exist on a fresh install. The PoC pre-creates it as an NTFS mount point into the NT object namespace before the service arrives, then plants a symbolic link inside it pointing to the attacker's chosen target. The service writes through the redirection. Skylight is the same shape, on a different vendor's image, with a cleanup loop the attacker has to step around to make the artifact persist past the next rotation tick. Six weeks between exhibits, two vendors, one pattern.
The shape is portable because the convention that produces it is portable. ProgramData is the documented location for shared application state on Windows. The default ACL on ProgramData allows BUILTIN\Users to create subdirectories and files. Microsoft documents both halves of the contract: shared application state goes here, and any service that uses the location must lock down its own subtree on creation with explicit SECURITY_ATTRIBUTES. Vendors implement the first half. The second half is the bug.
The reason the second half stays unimplemented is structural. Subtree ACL lockdown is an install-time decision, and installers are written by a different team than the runtime services that later read and write the paths. The installer ships the directory creation. The service ships the directory use. Nobody owns the ACL on the directory at the moment the service first writes through it. The default inherits. The default is Authenticated Users. The bug is shipped.
Amazon WorkSpaces is sold as a managed Windows desktop. The pitch is that AWS handles the image: provisioning, patching, the baseline service set. The standard user is the persona AWS hands the desktop to. The standard user owns ROTATE.
The patch in Skylight 2.6.2034.0, listed in AWS Security Bulletin 2026-025-AWS, is the right shape for this class. The bulletin does not enumerate the change at source granularity, but the only fixes that close the primitive pre-create ROTATE at install time with an ACL that denies non-admin write, or open ROTATE with FILE_FLAG_OPEN_REPARSE_POINT and reject reparse-point destinations, or resolve the path to a handle once at service start and use the handle for every subsequent move. A pure TOCTOU fix, the one the CVE title invites the reader to imagine, would have closed the cleanup race and left the primitive intact. The CVE record's vocabulary is doing work the patch should not have to.
AWS sold a managed Windows desktop. The standard user on it decides where one of its SYSTEM services writes.