Skip to content
Memory corruption Advisory Advanced CVE-2021-30712

Apple macOS SMB server IOCTL request uninitialized stack variable vulnerability

The macOS SMB server fails to initialise a pointer in IOCTL request processing when the input length is zero, leaving a stack variable uninitialised. An attacker can send a crafted compound SMB packet to control that uninitialised pointer and cause a crash or potentially further memory corruption.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

Medium 4.2 View original

A memory corruption vulnerability exists in the SMB Server Apple macOS 11.1. A specially crafted SMB packet can trigger the use of an uninitialized stack variable which can lead to memory corruption and denial of service.

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

Likely the code returns success without initialising the buffer pointer when the input length is zero, so the pointer retains whatever value was previously on the stack.

Impact

The vulnerability could cause a crash and denial of service, but the crash is unreliable and highly dependent on configuration and binary version.

What the attacker needed

Network access to SMB service; ability to send SMB packets

The fix

The vendor patched the vulnerability, likely by ensuring the buffer pointer is initialised before use.

How it was found

  1. Send a TREE_CONNECT request with a long share path to fill the stack with controlled bytes.
  2. Send a compound SMB command that first issues TREE_CONNECT and then IOCTL_REQUEST with input length zero.
  3. The IOCTL_REQUEST processing uses the uninitialised buffer pointer, which now contains the controlled stack bytes.
  4. The server attempts to read from that pointer, causing an invalid memory access and crash.

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.

When a program reads data from the network, it should always set every variable it uses. Here, a pointer (a memory address) was left unset, so it contained leftover data from earlier. An attacker could arrange for that leftover data to be a bad address, making the server crash.

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.