Skip to content
RCE Write-up Intermediate

Pentesting Cisco SD-WAN Part 2: Breaking Routers

A command injection flaw in the SSH wrapper script allowed an authenticated user to execute arbitrary commands as the binos user. A second flaw in a SUID binary allowed privilege escalation to root by manipulating the PATH environment variable.

Julien Legras Follow

Published on synacktiv.com

Written by Julien Legras, Thomas Etrillard - 07/05/2020 - in Pentest - Download

Julien Legras (@Julien_Legras), Thomas Etrillard, on synacktiv.com

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 wrapper script used eval on the user-supplied SSH command when it started with 'scp', and a SUID binary called 'cat' without an absolute path, allowing PATH manipulation.

What the attacker needed

Valid SSH credentials for the router; access to the SSH service on port 830

The fix

The vulnerability was fixed in Cisco IOS XE SD-WAN Software version 17.2.1r.

How it was found

  1. Connect to the router's SSH service on port 830 with valid credentials.
  2. Send an SSH command that starts with 'scp' followed by shell metacharacters to inject a command.
  3. Use the injected command to obtain an interactive shell as the binos user.
  4. Find SUID binaries and identify /tmp/etc/bexecute, which runs scripts as root.
  5. Create a malicious 'cat' script in a writable directory and prepend that directory to PATH.
  6. Execute bexecute with a whitelisted script that calls 'cat' to run the malicious script and gain a root shell.

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.

The router's SSH service had a script that ran user-supplied commands without proper checks, letting an attacker run their own commands. Then a special program that runs with high privileges could be tricked into running a fake 'cat' command, giving full control of the router.

What is RCE?

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

More by Julien Legras

View all

1 more disclosed report, best first.

More from Cisco

View all

The newest disclosed reports for this program.

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.