Today, I am going to share a writeup for the boot2root challenge of the Vulnhub machine “Sumo: 1”. It was an intermediate box based on the Linux machine. The goal for this machine is to read the flag file Download From Here
A portable version of this application is available: Portable SUMo runs on: Windows 10 32/64 bit Windows 8 32/64 bit Windows 7 32/64 bit file size: 3.7 MB filename: sumolite.exe main category: System. KC Softwares - Software Development Company. Developpers of SUMo, DUMo, KCleaner and other powerful System Utilities.
Walkthrough
We begin by scanning our network for the target machine using Netdiscover. The target machine is active on 192.168.1.104
Let’s scan it and see which services are running and which ports are open.
The scan gives us a lot of good and useful information, but what stands out the most is that port 22 and 80 are open, let’s explore port 80 first and see what we can find there.
This webpage seemed like a dead-end so, we decided to perform a Nikto scan in the hope that it will provide us with some more insight.
The Nikto scans the web application to find the /cgi-bin/ directory. on further inspection, the application was found vulnerable to shellshock vulnerability. Time to exploit it.
Open a terminal type msfconsole for loading Metasploit framework and use the following module. This module targets CGI scripts in the Apache webserver by setting the HTTP_USER_AGENT environment variable to a malicious function definition.
2 4 6 | python-c'import pty;pty.spawn('/bin/sh') /usr/bin/passwd cat root.txt |
Here we got our root flag. So that’s for now. See you next time.
Author: Sushma Ahuja is a Technical Writer, Researcher, and Penetration Tester. Can be Contacted on LinkedIn
Please make sure your host PC is running Ubuntu 14.04/ 64-bit and install the following packages:
Documentation is available from www.yoctoproject.org
Documentation is available from http://freescale.github.io
Documentation is available for download from fsl-yocto-imx-4.1.15_2.0.0-docs
Now, choose between downloading a release tag, and downloading the latest revision (recommended) and follow only one of the next two bullet sections, accordingly:
Each release in https://github.com/varigit/variscite-bsp-platform/releases corresponds to a tag.
The tags are also listed in https://github.com/varigit/variscite-bsp-platform/tags
To specify a specific release/tag, run the following:
or
The following images are provided by Variscite for evaluation purpose
The following images are provided by FSL Community BSP:
See the list of Yocto Project’s reference images in Yocto Project Reference Manual
The following distros can be used:
Note: Also standard Poky distros can be used
The above command is only mandatory for the very first build setup: whenever restarting a newer build session (from a different terminal or in a different time), you can skip the full setup and just run
Optional steps: local.conf customization
launch bitbake:
Optional steps: local.conf customization
Create a /opt/yocto_downloads directory and set its permissions:
Direct downloads to it, by replacing 'DL_DIR ?= '${BSPDIR}/downloads/' with 'DL_DIR = '/opt/yocto_downloads/' in conf/local.conf under your build directory:
Append the following to the conf/local.conf file in your Yocto build directory, to add Eclipse debug and Qt creator support to your images:
Append the following to the conf/local.conf file in your Yocto build directory, to use systemd instead of SysV init in your images:
Append the following to the conf/local.conf file in your Yocto build directory, to create a read-only rootfs:
The resulting images are located in tmp/deploy/images/imx6ul-var-dart.
| Image Name | How to use |
|---|---|
| fsl-image-gui-imx6ul-var-dart.sdcard | This image is for SD card boot. It can be flashed as-is on an SD card that can then be used to boot your system, according to the relevant startup-guide of your product (usually requires to press the boot select button, or toggle a DIP switch). For detailed information refer to the Create a bootable SD card section below. |
| fsl-image-gui-imx6ul-var-dart.tar.gz | Tarball with rootfs files. Can be used to create an NFS root file system on the host. See the Yocto Setup TFTP/NFS section for more info. Also used to create our extended SD card. See the Create a bootable SD card section below. |
| fsl-image-gui-imx6ul-var-dart.ubi | A complete UBI image containing a UBIFS volume, for writing to NAND flash. |
| zImage | Linux kernel image, same binary for SD card/eMMC or NAND flash. |
| SPL-sd | SPL built for SD card boot or eMMC boot. |
| SPL-nand | SPL built for NAND flash. |
| u-boot.img-sd | U-Boot built for SD card boot or eMMC boot. |
| u-boot.img-nand | U-Boot built for NAND flash. |
| File Name | Description |
|---|---|
| zImage-imx6ul-var-dart-emmc_wifi.dtb | Device tree blob for DART-6UL with eMMC & WI-FI enabled. (SD card & NAND disabled) |
| zImage-imx6ul-var-dart-nand_wifi.dtb | Device tree blob for DART-6UL with NAND flash & WI-FI enabled. (SD card & eMMC disabled) |
| zImage-imx6ul-var-dart-sd_emmc.dtb | Device tree blob for DART-6UL with SD card & eMMC enabled (WIFI & NAND disabled) |
| zImage-imx6ul-var-dart-sd_nand.dtb | Device tree blob for DART-6UL with SD card & NAND flash enabled (WIFI & eMMC disabled) |
| zImage-imx6ull-var-dart-emmc_wifi.dtb | Device tree blob for DART-6ULL with eMMC & WI-FI enabled. (SD card & NAND disabled) |
| zImage-imx6ull-var-dart-nand_wifi.dtb | Device tree blob for DART-6ULL with NAND flash & WI-FI enabled. (SD card & eMMC disabled) |
| zImage-imx6ull-var-dart-sd_emmc.dtb | Device tree blob for DART-6ULL with SD card & eMMC enabled (WIFI & NAND disabled) |
| zImage-imx6ull-var-dart-sd_nand.dtb | Device tree blob for DART-6ULL with SD card & NAND flash enabled (WIFI & eMMC disabled) |
This is the structure of our Recovery/Extended SD card:
The SD card is divided into 3 sections as shown in the picture above:
Note:
The last unallocated area is not used. It is there so that the rootfs will fit on any 4GB SD card, as not all 4GB SD cards are really the same size. If you want, you can use a program such as GParted to resize the roofs partition and make it end at the end of your specific SD card (of course, you can also use SD cards with much bigger capacity than 4GB, and then it makes more sense to resize the partition).
Also, if you create the extended SD card yourself by following the Create an extended SD card section below, and you use the '-a' option, the rootfs partition will end at the end of your specific SD card automatically.
The Yocto build products contains many files as explained in the Build Results section. For example, fsl-image-gui-imx6ul-var-dart.sdcard, depending on your build. This is a complete image to be flashed directly to an SD card.
Example usage:
Drawbacks of the native .sdcard yocto-built image, (relative to the Recovery/Extended SD card):
Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card - an SD card based on the fsl-image-gui filesystem, which copies the NAND flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow either the more automatic Yocto Recovery SD card guide or the more manual VAR-SOM-MX6 NAND flash burning guide to burn your images to NAND flash or eMMC.
Note:
This is essentially the same as our pre-built Recovery SD image, with the following main differences:
Naturally, the pre-built image is more straight forward and easier to use, while the script method is easier to customize.
Usage:
It is also possible to use the var-create-yocto-sdcard.sh script to create an extended SD card image, while using a loop device instead of attaching a real SD card.
Create an empty file using the following command:
The above command creates a 3700MiB file representing the SD card.
Attach the first available loop device to this file:
To find the actual loop device being used, run:
Write the content to the loop device to generate the SD card image:
(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)
Detach the loop device from the file:
To compress the SD card image file use the following command:
To write the SD card image to a real SD card device use the following command:
(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb)
Note: The WiFi is not operational when booting from SD card, as the WiFi and SD card are using the same SDIO interface.
A typical use-case is to boot from an SD card, flash the eMMC/NAND flash, and re-boot from the eMMC/NAND flash to have the WiFi operational.
Booting your system from an SD card requires switching the Boot DIP switches. See picture below.
.jpg)
As shown in the Build Results table above, we have different kernel device trees, corresponding to our different H/W configurations.
We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware.
To enable the automatic device tree selection in U-Boot (already enabled by default):
To disable the automatic device tree selection in U-Boot, set the device tree file manually:
Useful example: To list all files in the boot partition (where the dtb files are by default) of an SD card:
Please refer to Yocto NAND Flash Burning guide.
From time to time we update the Yocto sources (especially meta-variscite) with new features and bug fixes.
Follow the Download the latest revision (recommended) bullet section of the Download Yocto Morty based on Freescale Community BSP step again to update your tree to the latest revision, and rebuild your image.
Follow the Download a release tag bullet section of the Download Yocto Morty based on Freescale Community BSP step to update your tree to a release tag, and rebuild your image.
To run Qt5 applications without X11 backend the platform specific plugins (e.g. EGLFS or LinuxFB) should be configured with QT_QPA_PLATFORM environment variable or with -platform command-line.
DART-6UL supports only LinuxFB plugin
LinuxFB plugin is optimized for not accelerated platforms, but do not provide rotation capabilities.
If required you may be interested in reading this article, providing a dedicate patch and usage instructions.
To integrate the patch in yocto BSP, you are supposed to:
When no windowing system is present, the mouse, keyboard, and touch input are read directly via evdev or tslib.
By default, the Qt5 uses automatic device discovery based on libudev. In case you want to override the default touchscreen configuration the following parameters can be used:
Tslib is used for resistive single-touch touchscreens and should be pre-configured with:
It is recommended to put the above setup inside /etc/profile.d/tslib.sh.
By default we create ubifs image for 512MB NAND flash size.You can change the size by editing ~/var-fslc-yocto/sources/meta-variscite-fslc/conf/machine/include/variscite.inc
and comment / uncomment the relevant section based on size.
The following is usually not the recommended way to work with Yocto.
You should usually create new specific recipes (.bb files) and/or append to specific present recipes by using .bbappend files.
However, if you are not yet experienced enough with Yocto, and you just want to quickly add your files to the resultant file system (or make any other change to it), you can do it in a general way, by using the following variable:
The functions will be called right after the root filesystem is created and right before it is packed to images (.sdcard, .ubi, .tar.gz, etc.).
Let's say you have your files that you want to put in the filesystem arranged on your host under a directory called /my_rootfs_additions, like the following:
And let's say you want to build the fsl-image-gui image.
Create a file called ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-images/images/fsl-image-gui.bbappend
with the following content:
Now, when you bitbake fsl-image-gui, the files in /my_rootfs_additions will be added to the rootfs (be careful when overwriting files).