Skip to content
RCE Write-up Advanced

The Taking of FreeBSD One Two Three

Three pre-authentication bugs in FreeBSD's CTL HA mode let anyone who can reach the HA TCP port read and write kernel memory or overflow a heap buffer, leading to remote root. The maintainers chose to document the trust assumption rather than redesign the protocol.

blog.calif.io

Published on blog.calif.io

In An AI audit of FreeBSD we mentioned in passing that we had "reported 3 RCEs in a rarely used module." The module is CTL, FreeBSD's CAM Target Layer, the kernel subsystem that turns a FreeBSD box into a SCSI storage target for iSCSI and friends. Its High Availability (HA) mode lets two controllers mirror state to…

Calif, on blog.calif.io

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The HA protocol trusts its peer completely and embeds raw kernel pointers in messages, with insufficient validation of inbound messages.

Impact

Anyone able to reach the CTL HA port could execute code remotely as root; the text notes the design assumes the link never touches an untrusted network.

What the attacker needed

CTL HA mode enabled; network access to the HA port

The fix

No code fix was made; the maintainers added a manpage warning that HA must only run on trusted networks, so operators should keep the HA port on a network they fully control.

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 write-up has not been written yet. The Original tab links to the source.

FreeBSD can act as a storage server, and its high-availability mode lets two such servers talk to each other over a network port with no password. The code that handles those messages trusts whatever arrives, so a stranger who can reach the port can take full control of the machine. The vendor says this link was only ever meant to sit on a private network, so they added a warning to the manual instead of changing the code.

What is RCE?

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

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.