Apple DCERPC packet stats buffer overflow vulnerability
A buffer overflow in the DCERPC library's packet statistics logging allows an attacker to cause out-of-bounds memory modification by sending a packet with an invalid packet type. This can lead to further memory corruption and potentially arbitrary code execution.
Originally disclosed on Cisco Talos
A buffer overflow vulnerability exists in the stats logging functionality of DCERPC library as used in Apple macOS 12.6.1 A specially-crafted network packet can lead to out-of-bounds memory modification which can lead to further memory corruption. An authenticated remote attacker can send a network request to trigger…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The packet type field from an incoming packet is used directly as an index into a fixed-size global statistics array without any bounds check.
Impact
An authenticated remote attacker could trigger out-of-bounds memory modification, potentially leading to further memory corruption and arbitrary code execution; a local attacker could also trigger it via local sockets.
What the attacker needed
Authentication for network attack; Local access for socket attack
The fix
The vulnerability was fixed by Apple on 2023-01-23.
How it was found
- Send a DCERPC packet with a packet type value larger than the maximum allowed (19).
- The receive_dispatch function uses this packet type to index into the pstats array.
- An out-of-bounds increment occurs at a memory location outside the array, potentially modifying sensitive data.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The DCERPC library keeps a count of each type of network packet it receives, using the packet type as an index into a small array. Because the packet type is not checked, a malicious packet can make the program write outside that array, corrupting nearby memory. This could let an attacker run their own code or crash the service.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.