Skip to main content
Security Advisory

Barracuda WAF Early Boot Root Shell

Advisory ID
KL-001-2017-010
Published
2017-07-06
Vendor
Barracuda

Affected Systems

Product
Web Application Firewall V360
Version
Firmware v8.0.1.014
Platform
Embedded Linux

Discovered By

Matt Bergin (KoreLogic)
Download (signed .txt)

Vulnerability Details

Affected Vendor: Barracuda
Affected Product: Web Application Firewall V360
Affected Version: Firmware v8.0.1.014
Platform: Embedded Linux
CWE Classification: CWE-489: Active Debug Code
Impact: Root Access
Attack Vector: Grub

Vulnerability Description

Firmware reversing of the Barracuda Web Application Firewall uncovered debug features that should have been removed on the production images. Appending a debugging statement onto a grub configuration line leads to an early boot root shell.

Technical Description

After the initramfs image has been decrypted (see https://www.reddit.com/r/netsec/comments/5fonrm/rooting_an_appliance_for_fun/dandnx2/), some extra kernel command-line options are checked for by init.

  # cat init|more
  [snip]
  Some interesting things you can do at the kernel command line:

     * oldscheme - Choose the "old" partitioning scheme.
     * decrypt - Specify that the main partitions are encrypted.
     * shell - Run /sbin/init when we're done setting things up.
     * wyldstallyns - (soon) better debugging
  [snip]

Investigating them further, we find a specific comparison looking for wyldstallyns=69dude.

  # grep -ri "wyldstallyns" *
  lib/Barracuda/Preboot/Utils.pm:        $self->{WYLDSTALLYNS} = 1 if $cmd eq "wyldstallyns=69dude";

This perl module is imported and used during system init.

  # grep "Barracuda::Preboot::Utils" init
  use Barracuda::Preboot::Utils qw/try catch/;

If the kernel line contains the debugging statement, a DEBUG variable is set to one.

  # cat lib/Barracuda/Preboot/Utils.pm
  [snip]
  $self->{DEBUG}                  = 1 if $self->{WYLDSTALLYNS};
  [snip]

This variables determines whether or not the bash shell is executed during early boot.

  # cat init
  [snip]
  eval {
      parse_args($init);
      init( $dialog, $init, $iso );
      main( $dialog, $init, $iso, $tools );
      boot( $dialog, $init, $iso );
  } or do {
      if ( defined $init->{DEBUG} ) {
          print $@;
          exec "/bin/bash";
      }
      else {
          $dialog->hang($@);
      }
  };
  [snip]

Mitigation and Remediation Recommendation

The vendor has patched this vulnerability in the lastest virtual appliance release.

Credit

This vulnerability was discovered by Matt Bergin (@thatguylevel) of KoreLogic, Inc. and Joshua Hardin.

Proof of Concept

Start by rebooting, hit ā€˜e’ during the grub boot menu. When prompted for credentials, provide: root / bimg. Now, on the linux line append wyldstallyns=69dude

Hit F10 when finished.

During the boot process you will be prompted with: Paused (continue|exit)

When you type exit, you are dropped into a root shell.

root@(none):~#

The contents of this advisory are copyright(c) 2017 KoreLogic, Inc. and are licensed under a Creative Commons Attribution Share-Alike 4.0 (United States) License: http://creativecommons.org/licenses/by-sa/4.0/

KoreLogic, Inc. is a founder-owned and operated company with a proven track record of providing security services to entities ranging from Fortune 500 to small and mid-sized companies. We are a highly skilled team of senior security consultants doing by-hand security assessments for the most important networks in the U.S. and around the world. We are also developers of various tools and resources aimed at helping the security community. https://www.korelogic.com/about-korelogic.html

Our public vulnerability disclosure policy is available at: https://korelogic.com/KoreLogic-Public-Vulnerability-Disclosure-Policy.v2.2.txt

Disclosure Timeline

KoreLogic sends vulnerability report and PoC to Barracuda.

Barracuda acknowledges receipt of the vulnerability report.

Barracuda informs KoreLogic that they are working on remediation for this issue.

Barracuda notifies KoreLogic that they do not consider this to be a security vulnerability, but intend to change the hardcoded credentials. Barracuda also asks for additional time beyond the standard 45 business day embargo to address this and other issues reported by KoreLogic.

45 business days have elapsed since the issue was reported.

75 business days have elapsed since the issue was reported.

100 business days have elapsed since the issue was reported.

Barracuda updates KoreLogic on the status of the remediation efforts.

120 business days have elapsed since the issue was reported.

Barracuda informs KoreLogic that the issue has been fixed in the latest release of the WAF virtual appliance.

KoreLogic public disclosure.

Responsible Disclosure

KoreLogic follows responsible disclosure practices. All vulnerabilities are reported to affected vendors with appropriate time for remediation before public disclosure.

Vendor notification and coordination
90+ day disclosure timeline
CVE coordination when applicable