ATT&CKing TACACS+ to Pwn Your Network via a Pre-Auth RCE - elttam
A pre-authentication format string flaw in the tac_plus TACACS+ daemon lets an unauthenticated client place format specifiers in the port field of an authentication start packet, which are then passed as the format string to the logging helper. This yields memory disclosure into the daemon log and a blind write primitive, leading to code execution as the daemon user, root by default.
elttam.com
Published on elttam.com
TACACS+ is one of the ways large networks centralise administrative access to their equipment, alongside RADIUS and DIAMETER, and it is the one that tends to be chosen where per-command control matters. Instead of every router, switch, firewall and console server keeping its own local accounts, each device asks a…
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
Likely the daemon copies an unvalidated, client-supplied port string into session.port and later passes it as the format string argument to report(), which forwards it to vsnprintf().
Impact
An unauthenticated attacker could execute code as the daemon user, root by default, though the write primitive is blind and the memory disclosure lands only in the daemon's log rather than in the attacker's hands.
What the attacker needed
Network access to TCP port 49; no authentication needed
The fix
Shrubbery Networks patched it in F4.0.4.32, while the Facebook fork was archived and never will be fixed.
How it was found
- Open a TCP connection to port 49 on the TACACS+ server.
- Send an AUTHEN/START packet whose port field contains format specifiers.
- The server copies that field into session.port and hits the error path in send_authen_error().
- The format string is expanded into the daemon log, and the raw specifiers are returned in the error reply.
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.
TACACS+ is a way for network gear such as routers and switches to ask one central server whether an admin may log in and which commands they may run. The server software here, tac_plus, takes a text field from the very first packet a client sends and uses it as a template for building a log message. Special characters in that template make the program print or overwrite its own memory, so someone who has not logged in at all can run their own code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.