Exploring Three Remote Code Execution Vulnerabilities in RPC Runtime
Three integer overflow vulnerabilities existed in the Windows RPC runtime's dynamic array expansion for three data structures. An attacker could potentially achieve remote code execution by sending many RPC calls to overflow the allocation size, though practical exploitation is extremely slow.
Published on akamai.com
Akamai to acquire LayerX to enforce AI usage control on any browser. Get details
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.
Context
MS-RPC is a heavily used protocol in Windows networks, relied upon by many services and applications. The Akamai Security Intelligence Group spent a year researching it, and this post turns from vulnerabilities in individual services to vulnerabilities in the RPC runtime itself, the "engine" of MS-RPC. Because the RPC runtime library is loaded into all RPC servers, and those are commonly used by Windows services, every Windows version, Desktop and Server, is affected.
The three bugs are integer overflows in three data structures used by the runtime: SIMPLE_DICT (a dictionary that only saves values), SIMPLE_DICT2 (a dictionary that saves both keys and values) and Queue. All three are implemented as a dynamic array that grows when it fills up, by allocating twice the memory of the current array. That doubling is where the overflow lives. The author notes the bugs are similar to a vulnerability the team found in May 2022.

Setup
What it does establish as preconditions is conceptual: to reach the vulnerable insertion path you need a way to drive the relevant data structure from the network, and, for the Queue case, a way to keep one call busy on a connection while more calls arrive. The author used the team's own authentication coercion vulnerability to hold a call open, and links to the team's MS-RPC GitHub repository.
Finding it
The common pattern is the expansion of a dynamic array. Figure 1 shows decompiled runtime code for the insertion into SIMPLE_DICT, with the vulnerable line highlighted where the integer overflow can be triggered.

For the Queue, the structure holds an array of queue entries, the current capacity, and the position of the last item. On insert, if there is a free slot, all items are moved forward in the array and the new item goes to the beginning; the position of the last item is incremented. On dequeue, the last item is pulled out and its position decremented.

When the array is full, the insertion code does the following:
- Allocate a new array with size
CurrentCapacity * 2 * sizeof(QueueEntry). - Copy old items to the new array.
- Free the array of old items.
- Double the capacity.
On a 32-bit system the size calculation overflows. Filling the queue with 0x10000000 items and triggering an expansion computes 0x10000000 * 16, which overflows to a new allocation size of 0. A zero-length array is allocated, the old items are copied into it, and the result is a wild copy, a linear large copy. On a 64-bit system this particular bug is not exploitable: the huge allocation fails and the code exits gracefully without out-of-bounds writes. The author is explicit that 64-bit systems are still vulnerable to the other two overflows, in SIMPLE_DICT and SIMPLE_DICT2.
Exploitation
Step 1: find a flow into the vulnerable function
An RPC connection is represented by the OSF_SCONNECTION class. A connection can handle multiple client calls (OSF_SCALL), but at any given time only one call is allowed to run on the connection while the others are queued. The interesting function is OSF_SCONNECTION::MaybeQueueThisCall, called while dispatching a new call that has arrived on the connection; it puts incoming calls on hold while another call is being processed.
That gives a user-controlled way to fill the queue by sending client calls one after another, but with a requirement: a call must currently be processed by the connection. To fill the queue, the attacker needs one call that takes a long time to complete, and then sends many new calls while it runs.
Step 2: keep a call busy
The author ranks the options for a long-running call:
- Best: a function in which an infinite loop can be caused.
- Second best: an authentication coercion vulnerability, because the server connects back to the attacker, who therefore controls the response time.
- Last resort: a complex function, or one that processes lots of data and so takes a long time.
The team used its own authentication coercion vulnerability.
Step 3: measure whether it is practical
Control over the overflowing variable is minimal: it can only be incremented one at a time, similar to reference count overflows. The author calls this marginally worse than overflows where two fully controlled variables are added or multiplied, or where the added size is partly controllable, such as a packet size. And 0x10000000 (about 268 million) items must be allocated, which is a lot.
On the author's machine the trigger rate was approximately 15 to 20 queued calls per second, which means about 155 days to trigger it on an average machine. The team expected a higher rate and asked whether the runtime is slow, and whether it is not multithreaded.
Step 4: understand the packet handling
Reversing showed the flow differs from the assumption that multiple threads process and queue calls for the same connection simultaneously. Just before a call is dispatched, the code spins a new thread if needed and calls OSF_SCONNECTION::TransAsyncReceive, which tries to receive a request on the same connection and submits it to the new thread via CO_SubmitRead. The other thread picks the request from TppWorkerThread, eventually reaching ProcessReceiveComplete, which calls MaybeQueueThisCall to queue the SCALL to the dispatch queue, then propagates up and tries to receive a new request for the connection. So although multiple threads may run, in practice only one is used per connection, and calls cannot be added to the queue from multiple threads at once.
Step 5: try packet leftovers
While reversing the receiving code, the team noticed that if a packet's length is larger than the actual RPC request inside it, the runtime saves the remainder. When checking for new requests it does not go straight to the socket: it first checks for packet leftovers and serves a new request from them. That allowed sending far fewer packets, each carrying the maximum number of requests. The number of queued calls per second stayed relatively unchanged, so it did not help.
Root cause
The mistake is the unchecked multiplication in the growth path of the dynamic arrays behind SIMPLE_DICT, SIMPLE_DICT2 and Queue: CurrentCapacity * 2 * sizeof(QueueEntry) can wrap, producing a tiny or zero allocation that is then filled by a copy of the old contents. The practical barrier is arithmetic and throughput: the counter can only be incremented one call at a time and the required count is enormous.
Impact
The vulnerabilities can lead to remote code execution, and because the runtime is loaded into all RPC servers, all Windows Desktop and Server versions are affected. The three were assigned CVE-2023-24869, CVE-2023-24908 and CVE-2023-23405, all with a base score of 8.1. The author is careful about likelihood: exploitation is hard, the 32-bit Queue overflow needs roughly 155 days at the observed rate on an average machine, and the 64-bit Queue case is not exploitable at all, though 64-bit systems remain vulnerable to the SIMPLE_DICT and SIMPLE_DICT2 overflows. Even hard-to-exploit vulnerabilities are an opportunity for a competent and patient attacker.
Fix
The vulnerabilities were responsibly disclosed to Microsoft and addressed in the March 2023 Patch Tuesday.
Variants to test
- Look for other dynamic arrays in RPC runtime or similar code that grow by doubling a capacity multiplied by an element size, and check whether the multiplication is bounds-checked. A positive result is a decompiled expansion path where the computed size can wrap to a small value before the copy.
- Enumerate structures reachable from a single connection's dispatch path, as with
MaybeQueueThisCall, and check whether insertion can be driven from the network. A positive result is a user-controlled call sequence that increments a capacity counter. - Search for long-running or blocking calls, including authentication coercion, that let you hold one call open while queueing others. A positive result is a measurable queue growth rate while a single call is stalled.
- Check whether the receive path serves multiple requests from a single packet's leftovers, and measure the queueing rate with packed requests. A positive result would be a materially higher rate than one call per packet; in this research it was not.


What happened, in plain words
Imagine a large office building where every department has a front desk. Visitors arrive, the receptionist writes their request on a slip of paper, and the slip is passed to the right department. In Windows, that front desk and the slip-passing system is called MS-RPC (Microsoft Remote Procedure Call). It is a set of rules that lets one program on a computer ask another program, possibly on a different computer, to run a function and send back the result. It is used constantly inside Windows networks, by many services and applications.
A researcher named Ben Barnea, working at Akamai, spent about a year looking at MS-RPC. Earlier work by the team had found bugs in individual services that use MS-RPC. This time the team looked at the RPC runtime: the shared engine that every MS-RPC server loads and uses. Think of it as the building's internal mail system rather than any one department. If the mail system itself is broken, every department is affected.
The team found three bugs. All three are the same kind of mistake, an integer overflow, in three internal data structures the runtime uses to keep track of things: two kinds of dictionary and one queue. An integer overflow is what happens when a computer tries to store a number that is too big for the fixed amount of space it reserved for it; the number wraps around, often to a very small value or zero. The bugs were responsibly disclosed to Microsoft, addressed in the March 2023 Patch Tuesday (Microsoft's monthly day for releasing security fixes), and given the identifiers CVE-2023-24869, CVE-2023-24908 and CVE-2023-23405, each with a base score of 8.1. A CVE is a public catalogue number for a known security flaw, and the base score is a standard severity rating where higher means more serious.
Because the runtime library is loaded into all RPC servers, and Windows services commonly use RPC servers, every Windows version, both Desktop and Server, is affected. The bugs can lead to remote code execution, meaning an attacker somewhere else on the network could, in principle, make the victim's computer run code of the attacker's choosing.

Introduction: why the engine matters
MS-RPC is a highly used protocol in Windows networks. A protocol is simply an agreed way for two computers to talk, like a shared language and set of etiquette rules. Many services and applications rely on MS-RPC, so vulnerabilities in it can have harsh consequences.
The Akamai Security Intelligence Group had been doing MS-RPC research for the past year: finding and exploiting vulnerabilities, building research tools, and writing up some of the undocumented internals of the protocol. Previous blog posts focused on vulnerabilities in individual services. This post examines vulnerabilities in the RPC runtime, the engine of MS-RPC. The author notes these are similar to a vulnerability the team discovered in May 2022.
A pattern of integer overflow
The three new vulnerabilities share a common theme: they all exist because of an integer overflow when inserting into three data structures:
- SIMPLE_DICT, a dictionary that only saves values.
- SIMPLE_DICT2, a dictionary that saves both keys and values.
- Queue.
A data structure is an organised way of storing related pieces of information in a program's memory, the way a filing cabinet, a stack of trays or a numbered list organises paper. A dictionary here is like a phone book: you look something up by a key and get a value back. SIMPLE_DICT stores only values; SIMPLE_DICT2 stores both the key and the value, like a phone book that keeps both the name and the number.
All three structures are implemented using a dynamic array: a list kept in one contiguous block of memory that grows each time it gets full. When it grows, the code allocates twice the memory allocated for the current array. Allocating means asking the operating system for a block of memory to use. That doubling is where the overflow lives: doubling a number that is already large can produce a result too big to fit in the space reserved for it.
Figure 1 presents decompiled code from the RPC runtime. Decompiled means turning a compiled program, the machine-friendly form shipped to users, back into something closer to readable source code so a researcher can study it. The figure shows the insertion process into the SIMPLE_DICT structure and the vulnerable line of code, highlighted, where the integer overflow can be triggered.

Exploring a vulnerability
To trigger a vulnerability, you need to understand its underlying cause, figure out whether a flow to the vulnerable function exists, and how much time it takes to trigger. A flow here means a path through the program: a sequence of steps that starts from something an outsider can do, such as sending a network message, and ends at the buggy line of code. If no such path exists, the bug cannot be reached from outside.
For the sake of brevity, the write-up describes one of the three vulnerabilities: the one in the Queue data structure. The other integer overflows are similar in nature, so the same analysis can be conducted interchangeably.
Understanding the integer overflow
A queue is a simple FIFO (first in, first out) data structure. Think of a line at a coffee shop: the first person to join is the first to be served. A queue in the RPC runtime is implemented using a struct that contains an array of queue entries, the current capacity, and the position of the last item in the queue. A struct is a bundle of related variables kept together under one name, like a form with several labelled boxes.
When a new entry is added to the queue, given that there is an available slot, all the items are moved forward in the array, and the new item is added to the beginning of the array. The position of the last item in the queue is then incremented. When a dequeue happens, the last item is pulled out, and the last item's position is decremented. Increment means add one; decrement means subtract one.

As mentioned before, the vulnerability happens in the insertion of a new entry. If the dynamic array is full, the code does the following:
- Allocate a new array with the following size:
CurrentCapacity * 2 * sizeof(QueueEntry)
- Copy old items to the new array.
- Free the array of old items.
- Double the capacity.
Line by line in plain words:
- The size formula multiplies the current capacity (how many entries the array can hold) by 2 (because the array is being doubled) and by
sizeof(QueueEntry), which is the number of bytes one queue entry occupies. The result is how many bytes the new, bigger block of memory must be. - Copying the old items means taking every entry from the old block and writing it into the new block, so nothing is lost.
- Freeing the old array means telling the operating system that the old block is no longer needed, so the memory can be reused.
- Doubling the capacity means recording that the array can now hold twice as many entries as before.
For a 32-bit system, the overflow will happen in the calculation of the new array size. A 32-bit system is a computer whose programs handle numbers in a fixed width of 32 binary digits, so the largest value they can hold is limited. When a calculation goes past that limit, it wraps around, like a car odometer rolling from 999999 back to 000000.
- We fill the queue with
0x10000000(!) items. The0xprefix means the number is written in hexadecimal, a base-16 way of writing numbers that programmers use because it maps neatly onto binary.0x10000000is 268,435,456 in ordinary decimal, roughly 268 million. - An expansion happens. The size of the new allocation is calculated:
0x10000000 * 16. As this overflows, the new allocation size is 0. - A zero-length array is allocated.
- The code copies the old items array into the new small array. This will lead to a wild copy, a linear large copy.
A wild copy means copying a large amount of data into a place that is far too small for it, so the data spills past the end of the reserved block and overwrites whatever happens to be next in memory. That kind of spill is called an out-of-bounds write, and it is the raw material from which memory-corruption exploits are built.
On a 64-bit system, this vulnerability is not exploitable because there is a huge allocation that fails. A 64-bit system handles numbers in a much wider fixed width, so the same multiplication does not wrap around; instead the program asks for an absurdly large block, the request fails, and the code exits gracefully without triggering any out-of-bounds writes. Despite 64-bit systems being invulnerable to this issue, they are vulnerable to the other integer overflows, in SIMPLE_DICT and SIMPLE_DICT2.
Code flow
An RPC connection is represented using the OSF_SCONNECTION class. A class in programming is a template that bundles data and the operations on that data; an object of that class represents one connection. Each connection can handle multiple client calls (OSF_SCALL), but at every given time only one call is allowed to run on the connection, while others are queued. A call here is one request from a client asking the server to do something.
Thus, an interesting function that uses a queue is OSF_SCONNECTION::MaybeQueueThisCall. It is called as part of dispatching a new call that has arrived on the connection. Dispatching means deciding what to do with an incoming request and sending it on its way. In this case, the queue is used to put incoming calls on hold while another call is being processed.
So there is a user-controlled way to fill a queue, by sending client calls one after the other, but this function imposes a requirement: a call is currently being processed by the connection. That means that to fill the queue, the attacker needs to have a call that takes time to complete. While that call is processed, the attacker sends multiple new calls that fill up the dispatch queue.
What kind of function call takes the longest to complete? The author ranks the options:
- The best candidate is a function in which an infinite loop can be caused. An infinite loop is a piece of code that never finishes because it keeps repeating.
- The second best option is an authentication coercion vulnerability, because then the server connects to the attacker, who therefore has control over the response time. Authentication coercion is a trick that makes a server reach out and authenticate to a machine the attacker controls; since the attacker's machine answers, the attacker decides how long the server waits.
- A last resort would be a complex function with complicated logic, or a function that processes lots of data and therefore takes a lot of time to complete.
The team decided to use its own authentication coercion vulnerability.
The time it takes to trigger
So far the write-up has explained what it takes to fill the queue and how it can be done. But one important question arises: is it practical?
The attacker has minimal control over the variable in which the integer overflow happens: it can only be incremented one at a time, similar to refcount (reference count) overflows. A reference count is a counter that tracks how many things are using an object; it goes up and down by one as users come and go. This kind of integer overflow is marginally worse than integer overflows where two variables the attacker fully controls are added or multiplied, or where the size added can be somewhat controlled, such as a packet size. In other words, the attacker cannot jump the counter to a huge value in one step; they must nudge it up one unit at a time.
As mentioned previously, the attacker must allocate 0x10000000 (about 268 million) items. This is a lot.
Trying to trigger the vulnerability on the author's machine yielded a rate of approximately 15 to 20 queued calls per second. This means it would take about 155 days to trigger it on an average machine. The team expected a higher number of queued calls per second and asked whether the RPC runtime is slow, and whether it is not multithreaded. Multithreaded means a program can run several sequences of instructions at the same time, like several cashiers serving different customers in parallel.
The team's assumption was that multiple threads process and queue different calls for the same connection simultaneously. After some reversing, they found that in practice the flow is a little bit different. Reversing means studying a compiled program to work out how it behaves, often by reading decompiled code.
MS-RPC packet handling
Just before a call is dispatched, the code spins a new thread, if needed, and calls OSF_SCONNECTION::TransAsyncReceive. Spinning a thread means starting a new sequence of instructions that runs alongside the existing ones. TransAsyncReceive tries to receive a request on the same connection. It then submits the request to the new thread by calling CO_SubmitRead.
The other thread picks the request from TppWorkerThread, and it eventually leads to ProcessReceiveComplete, which calls MaybeQueueThisCall to queue the SCALL to the dispatch queue. Then it propagates up and tries to receive a new request for this connection.
Therefore, although there might be multiple threads running, in practice only one is being used for the connection. This means calls cannot be added to the queue from multiple threads simultaneously.
Packet leftovers
The team tried to find ways to make more calls per second to minimise the time it takes to trigger the vulnerability. While reversing the receiving code, they noticed that if a packet's length is larger than the actual RPC request in the packet, the RPC runtime saves the remainder. A packet is a chunk of data sent over a network, like one envelope in the post. Later, when the runtime checks for new requests, it does not immediately use the socket. A socket is the program's handle for a network connection, the thing it reads from and writes to. It first checks whether it has packet leftovers and, if so, it serves a new request from the leftovers.
That allowed the team to send many fewer packets, each of which contains the maximum number of requests. The number of queued calls per second remained relatively unchanged when they tried to do exactly that, so it did not seem to help.
Summary
Despite the expected low likelihood of exploiting these vulnerabilities, the team added them to the list of important vulnerabilities found in the last year of research on MS-RPC. It is important to remember that even hard-to-exploit vulnerabilities are an opportunity for a competent and patient attacker.
While MS-RPC has existed for several decades, it still has vulnerabilities waiting to be discovered. It is the team's hope that this research will encourage other researchers to look into MS-RPC and the attack surface it presents. Attack surface means all the ways an outsider could possibly interact with a system. The team thanked Microsoft for responding quickly and fixing the issues.
The team's GitHub repository is full of tools and techniques to help others get started.


Glossary
- MS-RPC (Microsoft Remote Procedure Call): a Windows protocol that lets one program ask another program, possibly on another computer, to run a function and return the result.
- Protocol: an agreed set of rules for how two computers communicate.
- RPC runtime: the shared engine library that every MS-RPC server loads and uses to handle connections, calls and internal bookkeeping.
- Integer overflow: what happens when a calculation produces a number too large for the fixed-width storage reserved for it, so the value wraps around, often to a small number or zero.
- CVE: a public catalogue identifier for a known security vulnerability.
- Base score: a standard severity rating for a vulnerability, where a higher number means more serious.
- Remote code execution (RCE): a flaw that lets an attacker elsewhere on the network make the victim's computer run code of the attacker's choosing.
- Data structure: an organised way of storing related information in a program's memory.
- Dictionary: a data structure that stores values that can be looked up by a key, like a phone book.
- SIMPLE_DICT: an RPC runtime dictionary that saves only values.
- SIMPLE_DICT2: an RPC runtime dictionary that saves both keys and values.
- Queue: a first in, first out data structure, like a line at a coffee shop.
- Dynamic array: a list kept in one contiguous block of memory that grows when it fills up.
- Allocate: to ask the operating system for a block of memory to use.
- Decompiled: turned from compiled machine-friendly code back into something closer to readable source code.
- Flow: a path through a program from something an outsider can do to a particular line of code.
- Struct: a bundle of related variables kept together under one name.
- Increment / decrement: add one / subtract one.
- 32-bit system: a computer whose programs handle numbers in a fixed width of 32 binary digits, so large calculations can wrap around.
- 64-bit system: a computer whose programs handle numbers in a much wider fixed width, so the same calculations usually do not wrap around.
- Hexadecimal: a base-16 way of writing numbers, marked with a
0xprefix, used because it maps neatly onto binary. - Wild copy: copying a large amount of data into a place far too small for it, so the data spills past the reserved block.
- Out-of-bounds write: writing data past the end of the memory block that was reserved, overwriting whatever is next.
- Class: a programming template that bundles data and the operations on that data.
- Call: one request from a client asking the server to do something.
- Dispatching: deciding what to do with an incoming request and sending it on its way.
- Infinite loop: a piece of code that never finishes because it keeps repeating.
- Authentication coercion: a trick that makes a server reach out and authenticate to a machine the attacker controls, giving the attacker control over the response time.
- Reference count: a counter that tracks how many things are using an object, going up and down by one.
- Multithreaded: able to run several sequences of instructions at the same time.
- Reversing: studying a compiled program to work out how it behaves.
- Thread: one sequence of instructions running inside a program; a program can have several at once.
- Packet: a chunk of data sent over a network.
- Socket: a program's handle for a network connection, which it reads from and writes to.
- Attack surface: all the ways an outsider could possibly interact with a system.
- Patch Tuesday: Microsoft's monthly day for releasing security fixes.