Skip to content
Memory corruption Advisory Advanced CVE-2023-28180

Apple DCERPC alter context response use-after-free vulnerability

A use-after-free flaw in Apple's DCERPC state machine allows a crafted sequence of packets to free a buffer and then reuse it. An authenticated remote attacker could potentially achieve arbitrary code execution, while a local user can trigger it via local sockets.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 7.5 View original

A use-after-free vulnerability exists in the state machine of DCERPC library as used in Apple macOS 12.6.1 that can lead to a use-after-free condition. A specially-crafted network packet can lead to reuse of a previously freed memory which can lead to arbitrary code execution.

Aleksandar Nikolic, on Cisco Talos

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 state machine processes a BIND_ACK packet in an unexpected state, causing the packet buffer to be freed during event handling and then freed again when the macro checks the same pointer.

Impact

An authenticated remote attacker could potentially achieve arbitrary code execution, and a local attacker can trigger the vulnerability via local UNIX sockets.

What the attacker needed

Authenticated remote access via SMB; or local access to UNIX sockets

The fix

Apple fixed the vulnerability on 2023-03-27.

How it was found

  1. Connect to a local DCERPC UNIX socket such as /var/rpc/ncalrpc/NETLOGON.
  2. Send a BIND packet followed immediately by a partial BIND_ACK packet in a single send call.
  3. Observe that the second packet triggers additional state machine actions, including send_decr_action_rtn.
  4. The buffer is freed inside rpc__cn_assoc_send_fragbuf and then the same pointer is dereferenced again in the macro, causing a use-after-free.

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.

A use-after-free happens when a program frees memory but then keeps using it, like returning a library book and still reading it. Here, sending two special network messages in one go tricks the program into freeing a buffer and then using it again. This could let an attacker run their own code on the machine.

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.

More by Aleksandar Nikolic

View all

147 more disclosed reports, best first.

More from Cisco Talos

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.