Skip to content
Memory corruption Write-up Advanced

CreateRCE — Yet Another Vulnerability in CreateUri

Ben Barnea Follow

Published on akamai.com

Client-Side Protection & Compliance

Ben Barnea (@nachoskrnl), on akamai.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

This is the final post in a series on the fallout from CVE-2023-23397, a critical Outlook vulnerability that Microsoft patched in March 2023. That bug let an attacker coerce an Outlook client into connecting to an attacker-controlled server, sending the client's NTLM credentials, which could then be cracked offline or used in a relay attack. It was exploited in the wild by a Russian state-sponsored actor Microsoft calls Forest Blizzard, and in December 2023 Microsoft and the Polish Cyber Command published that they had seen fresh exploitation attempts by the same actor. The original bug was zero-click and reachable over the internet.

The feature at the centre of it is the custom reminder sound. Outlook reads the sound file location from the extended MAPI property PidLidReminderFileParameter. As part of the patch, the code handling that property adds a call to MapUrlToZone, which checks that the supplied URL does not point to an internet resource. That check is the new attack surface: the attacker still controls the path passed into MapUrlToZone.

MapUrlToZone parses the path and calls CreateUri, a WinAPI function that builds an IUri object representing a URI. CreateUri parses both URLs and some DOS Windows paths. When it is given a file path, either through the file:// scheme or as a Windows path pointing to a file or directory, it calls CrackUrlFile. That function is where the earlier bypasses lived, and it is where this new bug lives too.

Akamai researcher Ben Barnea found a critical vulnerability in Microsoft Windows, which was assigned CVE-2023-35628.
Akamai researcher Ben Barnea found a critical vulnerability in Microsoft Windows, which was assigned CVE-2023-35628. From the original on akamai.com

Setup

The work is patch analysis and reverse engineering of Windows binaries, not a live web target. The researcher compared the July 2023 changes to CrackUrlFile against the earlier code. Two trigger surfaces were explored: an Outlook client receiving a crafted email, and File Explorer viewing a folder that contains a malicious downloaded file. For the Explorer route the researcher built a shortcut (.lnk file) pointing at the vulnerable path, and published a proof of concept that crashes Explorer.

Finding it

At the start of CrackUrlFile, the function decides how to treat its input. If it receives a URL rather than a Windows path, it makes a copy of the input and converts that copy to a Windows path with PathCreateFromUrlW. The working buffer is marked as dynamically allocated so it can be freed later. If the input is already a Windows path, the function works directly on the input and does not need to free the pointer.

While parsing the working buffer, the function can advance the buffer. A local device path beginning with \\.\ or \\?\ moves the pointer forward by four characters. If the device name is UNC\, it advances four more. Duplicated backslashes are also skipped by advancing the buffer.

While reversing the patches to the earlier bypasses, the researcher noticed new code added to CrackUrlFile in July 2023 that looked unrelated to those bypasses (Figure 1). During path parsing the function checks whether the path component is a drive path or a rooted path, and if so marks the path as local. The new code overrides the original buffer pointer with a pointer to the path component, that is, the advanced buffer, when the path is a drive path.

That override is the bug. The advanced pointer is saved. Later the original buffer pointer (PPWorkingBuffer in Figure 1) is retrieved and freed if it was dynamically allocated. Because it was overwritten with the advanced pointer, free() is called on a pointer that malloc never returned. That hands an attacker a primitive to supply the memory allocator with a malicious chunk's metadata.

Exploitation

Step 1: satisfy the parsing conditions

Two conditions must hold at once. The input must be a file scheme URL with a UNC path, and the path must then be marked as a drive path, which requires a share such as C:. The full path that triggers the vulnerability looks like this:

Bash
  file://./UNC/C:/Akamai.com/file.wav

When the function later frees the saved pointer, free() is called on a pointer that malloc never returned.

Step 2: deliver it through Outlook

Because the path arrives through PidLidReminderFileParameter, an attacker on the internet can send a crafted email to an Outlook client and trigger the vulnerability with no user interaction at all. This is a zero-click primitive on its own: unlike the earlier chain, which needed two vulnerabilities combined to reach zero-click RCE, this one does not.

Step 3: deliver it through Explorer

A second route needs only that the victim view a folder. The researcher created a shortcut (.lnk file) pointing to the vulnerable path. When the victim views the directory containing the shortcut, the vulnerability triggers in Explorer and Explorer crashes immediately (Figure 2).

Fig. 2: Explorer crashing as a result of the PoC

The published proof of concept crashes Explorer and can be used to check whether a machine is vulnerable. The researcher asks that the specifics and risks described in the security research repository be read carefully before running it.

Root cause

CrackUrlFile keeps two things that must stay consistent: the base of the working buffer, which is what free() must receive, and the current parse position, which advances past device prefixes and duplicated backslashes. The July 2023 change conflated them. When the path component is a drive path, the code stores the advanced pointer into the variable that later serves as the free target. The free path then runs against a pointer that was not returned by malloc, giving the attacker influence over the allocator's view of the chunk metadata. The fix replaces the pointer save with a copy of the path component's bytes using RtlMoveMemory, so the original allocation base is preserved for the free.

The existing defence did not help here. MapUrlToZone was added precisely to stop the original CVE-2023-23397 abuse by rejecting internet resources, but it introduced a parser that the attacker still fully controls the input to, and the memory management mistake sat inside that parser rather than in the zone check itself.

Impact

The vulnerability is a remote code execution flaw in Microsoft Windows, tracked as CVE-2023-35628. An attacker on the internet can trigger it against Outlook clients without any user interaction. The researcher describes the primitive as giving the memory allocator a malicious chunk's metadata, and argues that exposing a sound parsing surface to a remote attacker in a zero-click manner, without a sandbox, presents more danger than value. The Explorer route requires the victim to view a folder containing a malicious downloaded file, and the demonstrated result there is a crash. The report does not give a CVSS score or a bounty figure.

Fix

Microsoft addressed the vulnerability in the December 2023 Patch Tuesday. Windows machines with the December 2023 software update installed are protected. Separately, Outlook clients that use Exchange servers patched with the March 2023 software update are protected against the abused feature.

In code terms, the fixed CrackUrlFile copies the bytes of the path component with RtlMoveMemory instead of saving the advanced pointer, so the original buffer pointer remains the one that gets freed.

The researcher's longer-standing recommendation, made in May 2023 when the first bypass was found, is to remove the abused feature altogether: using MapUrlToZone adds attack surface, and exposing a sound parsing surface to a remote attacker in a zero-click manner, without a sandbox, presents more danger than value. The series as a whole found two bypasses, a sound parsing issue and finally this Windows path parsing memory corruption, which the researcher says proved the point. More MapUrlToZone bypasses cannot be ruled out.

Variants to test

  1. Other device-path prefixes. Feed paths that begin with \\.\ or \\?\ followed by UNC\ and a drive-letter share into any component that reaches CreateUri with a file path, and watch for a crash or allocator corruption. A positive result is a fault inside CrackUrlFile or the allocator rather than a clean rejection.
  2. Duplicated backslashes. Insert repeated backslashes so the parser advances the buffer past them before the drive-path check, then check whether the free target diverges from the allocation base. A positive result is a crash on free or heap metadata corruption.
  3. Other callers of MapUrlToZone. Any feature that lets a remote party supply a URL which is then zone-checked is worth testing with the same file://./UNC/C:/... shape. A positive result is a crash in the client process with no user interaction.
  4. Shell surfaces. Place a shortcut or file with the crafted path in a directory and open that directory in Explorer. A positive result is an immediate Explorer crash, as in the published PoC.
  5. Patch diffing. Compare the July 2023 CrackUrlFile changes against the December 2023 fix and look for other places where an advanced pointer is stored where an allocation base is expected. A positive result is another free of a non-base pointer reachable from attacker-controlled input.
Ben Barnea
Ben Barnea From the original on akamai.com

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

In April 2024, Akamai researcher Ben Barnea published a write-up about a critical vulnerability in Microsoft Windows, tracked as CVE-2023-35628. The vulnerability is a remote code execution (RCE) flaw: an attacker on the internet can trigger it against an Outlook client without the victim doing anything. The attack can be triggered simply by sending a crafted email to an Outlook client, or by getting a user to view a folder in File Explorer that contains a malicious file. Microsoft fixed it in the December 2023 Patch Tuesday.

Ben Barnea
Ben Barnea From the original on akamai.com

This is the final post in a series about the fallout from an earlier Outlook vulnerability, CVE-2023-23397, which Microsoft patched in March 2023. That earlier bug allowed an attacker to force an Outlook client to connect to an attacker-controlled server and leak the user's NTLM credentials (a Windows login hash), which could then be cracked offline or used in a relay attack. It was exploited in the wild by a Russian state-sponsored group Microsoft calls Forest Blizzard. In December 2023, Microsoft and the Polish Cyber Command reported fresh exploitation attempts by the same actor. The original bug was zero-click and reachable over the internet.

The feature at the centre is the custom reminder sound in Outlook. Outlook reads the sound file location from an extended MAPI property called PidLidReminderFileParameter. As part of the patch for CVE-2023-23397, the code handling that property adds a call to MapUrlToZone, which checks that the supplied URL does not point to an internet resource. That check is the new attack surface: the attacker still controls the path passed into MapUrlToZone.

MapUrlToZone parses the path and calls CreateUri, a WinAPI function that builds an IUri object representing a URI. CreateUri parses both URLs and some DOS Windows paths. When it is given a file path, either through the file:// scheme or as a Windows path pointing to a file or directory, it calls CrackUrlFile. That function is where the earlier bypasses lived, and it is where this new bug lives too.

Akamai researcher Ben Barnea found a critical vulnerability in Microsoft Windows, which was assigned CVE-2023-35628.
Akamai researcher Ben Barnea found a critical vulnerability in Microsoft Windows, which was assigned CVE-2023-35628. From the original on akamai.com

Setup

The work is patch analysis and reverse engineering of Windows binaries, not a live web target. The researcher compared the July 2023 changes to CrackUrlFile against the earlier code. Two trigger surfaces were explored: an Outlook client receiving a crafted email, and File Explorer viewing a folder that contains a malicious downloaded file. For the Explorer route the researcher built a shortcut (.lnk file) pointing at the vulnerable path, and published a proof of concept that crashes Explorer.

Finding it

At the start of CrackUrlFile, the function decides how to treat its input. If it receives a URL rather than a Windows path, it makes a copy of the input and converts that copy to a Windows path with PathCreateFromUrlW. The working buffer is marked as dynamically allocated so it can be freed later. If the input is already a Windows path, the function works directly on the input and does not need to free the pointer.

While parsing the working buffer, the function can advance the buffer. A local device path beginning with \\.\ or \\?\ moves the pointer forward by four characters. If the device name is UNC\, it advances four more. Duplicated backslashes are also skipped by advancing the buffer.

While reversing the patches to the earlier bypasses, the researcher noticed new code added to CrackUrlFile in July 2023 that looked unrelated to those bypasses (Figure 1). During path parsing the function checks whether the path component is a drive path or a rooted path, and if so marks the path as local. The new code overrides the original buffer pointer with a pointer to the path component, that is, the advanced buffer, when the path is a drive path.

That override is the bug. The advanced pointer is saved. Later the original buffer pointer (PPWorkingBuffer in Figure 1) is retrieved and freed if it was dynamically allocated. Because it was overwritten with the advanced pointer, free() is called on a pointer that malloc never returned. That hands an attacker a primitive to supply the memory allocator with a malicious chunk's metadata.

Exploitation

Step 1: satisfy the parsing conditions

Two conditions must hold at once. The input must be a file scheme URL with a UNC path, and the path must then be marked as a drive path, which requires a share such as C:. The full path that triggers the vulnerability looks like this:

Bash
  file://./UNC/C:/Akamai.com/file.wav

When the function later frees the saved pointer, free() is called on a pointer that malloc never returned.

Step 2: deliver it through Outlook

Because the path arrives through PidLidReminderFileParameter, an attacker on the internet can send a crafted email to an Outlook client and trigger the vulnerability with no user interaction at all. This is a zero-click primitive on its own: unlike the earlier chain, which needed two vulnerabilities combined to reach zero-click RCE, this one does not.

Step 3: deliver it through Explorer

A second route needs only that the victim view a folder. The researcher created a shortcut (.lnk file) pointing to the vulnerable path. When the victim views the directory containing the shortcut, the vulnerability triggers in Explorer and Explorer crashes immediately (Figure 2).

Fig. 2: Explorer crashing as a result of the PoC

The published proof of concept crashes Explorer and can be used to check whether a machine is vulnerable. The researcher asks that the specifics and risks described in the security research repository be read carefully before running it.

Root cause

CrackUrlFile keeps two things that must stay consistent: the base of the working buffer, which is what free() must receive, and the current parse position, which advances past device prefixes and duplicated backslashes. The July 2023 change conflated them. When the path component is a drive path, the code stores the advanced pointer into the variable that later serves as the free target. The free path then runs against a pointer that was not returned by malloc, giving the attacker influence over the allocator's view of the chunk metadata. The fix replaces the pointer save with a copy of the path component's bytes using RtlMoveMemory, so the original allocation base is preserved for the free.

The existing defence did not help here. MapUrlToZone was added precisely to stop the original CVE-2023-23397 abuse by rejecting internet resources, but it introduced a parser that the attacker still fully controls the input to, and the memory management mistake sat inside that parser rather than in the zone check itself.

Impact

The vulnerability is a remote code execution flaw in Microsoft Windows, tracked as CVE-2023-35628. An attacker on the internet can trigger it against Outlook clients without any user interaction. The researcher describes the primitive as giving the memory allocator a malicious chunk's metadata, and argues that exposing a sound parsing surface to a remote attacker in a zero-click manner, without a sandbox, presents more danger than value. The Explorer route requires the victim to view a folder containing a malicious downloaded file, and the demonstrated result there is a crash. The report does not give a CVSS score or a bounty figure.

Fix

Microsoft addressed the vulnerability in the December 2023 Patch Tuesday. Windows machines with the December 2023 software update installed are protected. Separately, Outlook clients that use Exchange servers patched with the March 2023 software update are protected against the abused feature.

In code terms, the fixed CrackUrlFile copies the bytes of the path component with RtlMoveMemory instead of saving the advanced pointer, so the original buffer pointer remains the one that gets freed.

The researcher's longer-standing recommendation, made in May 2023 when the first bypass was found, is to remove the abused feature altogether: using MapUrlToZone adds attack surface, and exposing a sound parsing surface to a remote attacker in a zero-click manner, without a sandbox, presents more danger than value. The series as a whole found two bypasses, a sound parsing issue and finally this Windows path parsing memory corruption, which the researcher says proved the point. More MapUrlToZone bypasses cannot be ruled out.

Variants to test

  1. Other device-path prefixes. Feed paths that begin with \\.\ or \\?\ followed by UNC\ and a drive-letter share into any component that reaches CreateUri with a file path, and watch for a crash or allocator corruption. A positive result is a fault inside CrackUrlFile or the allocator rather than a clean rejection.
  2. Duplicated backslashes. Insert repeated backslashes so the parser advances the buffer past them before the drive-path check, then check whether the free target diverges from the allocation base. A positive result is a crash on free or heap metadata corruption.
  3. Other callers of MapUrlToZone. Any feature that lets a remote party supply a URL which is then zone-checked is worth testing with the same file://./UNC/C:/... shape. A positive result is a crash in the client process with no user interaction.
  4. Shell surfaces. Place a shortcut or file with the crafted path in a directory and open that directory in Explorer. A positive result is an immediate Explorer crash, as in the published PoC.
  5. Patch diffing. Compare the July 2023 CrackUrlFile changes against the December 2023 fix and look for other places where an advanced pointer is stored where an allocation base is expected. A positive result is another free of a non-base pointer reachable from attacker-controlled input.
Ben Barnea
Ben Barnea From the original on akamai.com

Glossary

  • Remote code execution (RCE): A type of vulnerability where an attacker can run their own code on a victim's machine, often without physical access.
  • Zero-click: An attack that requires no action from the victim, such as clicking a link or opening a file.
  • NTLM credentials: A Windows authentication hash used to prove identity; if stolen, it can be cracked offline or used in a relay attack.
  • Relay attack: An attack where stolen authentication credentials are forwarded to another service to impersonate the victim.
  • MAPI property: A named data field in Microsoft Outlook's messaging system, used to store information like reminder settings.
  • URI: Uniform Resource Identifier, a string that identifies a resource, such as a web address or file path.
  • WinAPI: The Windows API, a set of functions provided by Microsoft Windows for programs to interact with the operating system.
  • IUri object: A data structure representing a URI, created by the CreateUri function.
  • file:// scheme: A URL prefix indicating that the resource is a local file.
  • UNC path: A Universal Naming Convention path, used to access network shares, typically starting with \\.
  • Drive path: A path that starts with a drive letter followed by a colon, like C:.
  • Rooted path: A path that starts from the root of a drive or share.
  • malloc/free: C functions for allocating and releasing memory dynamically; free() must be given a pointer that was returned by malloc().
  • Chunk metadata: Bookkeeping information stored by the memory allocator alongside each allocated block.
  • Heap: The area of memory used for dynamic allocation.
  • Pointer: A variable that stores a memory address.
  • Interior pointer: A pointer that points inside an allocated block, not to its start.
  • Patch analysis: Examining software updates to understand what changed and why, often to find new vulnerabilities.
  • Reverse engineering: The process of analysing compiled software to understand its behaviour.
  • Proof of concept (PoC): A small program or file that demonstrates a vulnerability, often by causing a crash.
  • Shortcut (.lnk file): A Windows file that points to another file or folder.
  • Explorer: Windows File Explorer, the file management application.
  • Sandbox: A security mechanism that isolates running code to limit its impact.
  • Attack surface: The set of all points where an attacker can try to interact with a system.
  • Bypass: A way to circumvent a security fix or mitigation.
  • CVSS score: A numerical rating of the severity of a vulnerability.
  • Bounty: A monetary reward paid by a vendor for reporting a vulnerability.
  • Patch Tuesday: Microsoft's regular schedule for releasing security updates, typically the second Tuesday of each month.
  • Exchange server: Microsoft's email server product, often used with Outlook.
  • Forest Blizzard: A name used by Microsoft for a Russian state-sponsored threat actor.
  • Polish Cyber Command: The military cyber defence unit of Poland.
  • RtlMoveMemory: A Windows function that copies a block of memory from one location to another.
  • PathCreateFromUrlW: A Windows function that converts a URL to a Windows file path.
  • CrackUrlFile: An internal Windows function that parses file paths within URLs.
  • MapUrlToZone: A Windows function that determines the security zone of a URL, such as internet or local.
  • CreateUri: A Windows function that creates an IUri object from a string.
  • PidLidReminderFileParameter: An extended MAPI property that specifies the file path for a custom reminder sound in Outlook.
  • Akamai: A content delivery and cloud security company.
  • Ben Barnea: The Akamai researcher who discovered and reported the vulnerability.
  • CVE-2023-23397: The original Outlook vulnerability patched in March 2023.
  • CVE-2023-35628: The new vulnerability described in this report, patched in December 2023.

More by Ben Barnea

View all

6 more disclosed reports, best first.

More from Microsoft (Windows)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.