Windows Installer EOP (CVE-2023-21800)
The Windows Installer's repair process used environment variables set by an unprivileged user when running as SYSTEM, allowing an attacker to redirect privileged file operations to arbitrary locations. This could lead to arbitrary file deletion or creation with SYSTEM privileges, potentially enabling elevation of privilege.
Published on blog.doyensec.com
Recently, I decided to research a single common aspect of many popular Windows applications - their MSI installer packages.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The Windows Installer's rollback mechanism used user-controlled environment variables (such as PROGRAMDATA) when performing privileged file operations during repair, without validating that the resulting paths were safe.
Impact
An attacker could delete arbitrary files with SYSTEM privileges, and potentially create files, leading to elevation of privilege; however, the attack was mitigated by Redirection Guard on Windows 11 Developer Preview and later via the 2022-02-14 update.
What the attacker needed
Unprivileged user account; MSI package that auto-elevates on repair; ability to set environment variables
The fix
Microsoft enabled Redirection Guard on the msiexec process via the 2022-02-14 update, which verifies junctions and prevents following those created by non-admin users.
How it was found
- Identify an MSI package that auto-elevates during repair.
- Modify the PROGRAMDATA environment variable to point to a user-writable directory.
- Start a new command prompt to inherit the changed environment.
- Place a symlink in the fake ProgramData path pointing to a target file.
- Run msiexec with the /fa repair option for the package's GUID.
- Observe the target file being deleted with SYSTEM privileges.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you repair an installed program, Windows sometimes runs parts of the repair with high privileges (as the SYSTEM user). The installer was trusting a setting called an environment variable that a normal user can change. By changing that setting, an attacker could make the high-privilege repair process delete or create files in places it shouldn't, which can be used to take over the machine.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.