5. System enumeration (via shell)

**some of the logs have been changed after resetting router

  • /tmp/gn-httpd does not exist anymore

  • ...

5.1 Gaining a shell

[...insert image of physical connection from host to device using USB-UART adapter + wires]

First, identify the device name of the USB-UART adapter:

Next, use picocom to retrieve a shell, with the baud rate as 115200 (a common first guess)

  • Received a log output with non-gibberish text

    • this means that the correct baud rate was chosen

  • A "Hit enter to continue..." message was shown

    • From there, we are able to pop a BusyBox v1.7.2 shell

5.2 General enumeration

List of enumeration steps:

  1. Read through the initial boot logs

  2. Identify firmware version (to verify if the current version is still vulnerable)

  • nvram

  • build date

  1. Identify architecture

  2. Identify httpd binary locations

  3. ...

5.2.1 Boot logs

  1. Boot version

  1. Commands

The following compiles a few interesting commands listed in the boot logs:

Discussion of important commands:

a. httpd binary

  • Both the httpd and /tmp/gn-httpd binary are executed on ports 80 (likely) and 51000 respectively

  • The iptables rule forcefully redirects all traffic destined for 192.168.33.1 port 80 to port 51000 instead

  1. Other useful information

5.2.2 Firmware version

  • We have identified that the build date is Feb 15 2012

With the following simple Google dork:

I managed to find details for a few release notes, with the earliest on Aug 28, 2013, and the latest on Jan 5, 2018

It is highly probable that the current firmware on the device has not been patched at all, and would most likely still be vulnerable to the CVEs we have discussed before.

5.2.3 Further enumeration

Available memory:

List all the available binaries:

Architecture & stack protections:

5.3 /tmp/gn-httpd binary (CVE)

Let's focus on the following CVE:

First, we have to identify the location of the vulnerable binary. From previous enumeration steps, we know that requests to port 80 are redirected to port 51000, which is handled by the /tmp/gn-httpd binary

Next, we have to understand the entry point of the vulnerability. In this case, it would be the URL path we need to send our HTTP request (either GET, POST, etc.) in order to reach the get_merge_ipaddr function of the httpd binary

The function concatenates up to four user-supplied CGI parameters

We know that the vulnerability deals with CGI

5.3.1 Find all .cgi files

Look for all occurrences of the string value .cgi and extract the filenames. Next, we can look for the location, and view the content of these files:

5.3.2 Finding information for the get_merge_ipaddr function

Last updated