InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Follow publication

HTB Cyber Apocalypse CTF 2024 — Hardware

Abdul Issa
InfoSec Write-ups
Published in
12 min readMar 21, 2024

--

Hardware challenges
Hardware challenges

Challenges

Maze

💡Solution

Directory tree for Maze folders
Directory tree for Maze folders

Remember that even seemingly ordinary devices, such as printers, faxes, VoIP phones and conference systems can hold valuable information or pose security risks on your network.

BunnyPass

💡Solution

RabbitMQ Login screen
RabbitMQ Login screen
Default “guest” account has administrative access
The default “guest” account has administrative access
Dashboard for admin users
Dashboard for admin users
RabbitMQ Message Queues
Retrieve the 6 messages from the factory_idle queue
Retrieve the 6 messages from the factory_idle queue
Flag was found in Message 6
The flag was found in Message 6

Rids

💡Solution

The Hardware

W25Q128JVSIQ Winbond Memory Chip
W25Q128JVSIQ Winbond Memory Chip

The Code

import socket
import json

def exchange(hex_list, value=0):

# Configure according to your setup
host = '83.136.255.150' # The server's hostname or IP address
port = 35981 # The port used by the server
cs=0 # /CS on A*BUS3 (range: A*BUS3 to A*BUS7)

usb_device_url = 'ftdi://ftdi:2232h/1'

# Convert hex list to strings and prepare the command data
command_data = {
"tool": "pyftdi",
"cs_pin": cs,
"url": usb_device_url,
"data_out": [hex(x) for x in hex_list], # Convert hex numbers to hex strings
"readlen": value
}

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((host, port))

# Serialize data to JSON and send
s.sendall(json.dumps(command_data).encode('utf-8'))

# Receive and process response
data = b''
while True:
data += s.recv(1024)
if data.endswith(b']'):
break

response = json.loads(data.decode('utf-8'))
#print(f"Received: {response}")
return response

# Example command
jedec_id = exchange([0x9F], 3)

print(jedec_id)

The Key Player: JEDEC ID

The jedec_id stores the command to be sent to the hardware device
The jedec_id stores the command to be sent

The Command Exchange

In case you are wondering why I have not simply used exchange([0x03], 16) instead of exchange([0x03], 0x00, 0x00x, 0x03], 16) that is a good question!

And The Execution!

Modified jedec_id command to read 16 bytes
Modified jedec_id command to read 16 bytes
$ python3 client.py 

[72, 84, 66, 123, 109, 51, 109, 48, 50, 49, 51, 53, 95, 53, 55, 48]

The Ta-daa Moment: The Flag!

CyberChef decoding 16 bytes of data received
CyberChef decoding 16 bytes of data received
$ python3 client.py

[72, 84, 66, 123, 109, 51, 109, 48, 50, 49, 51, 53, 95, 53, 55, 48, 50, 51, 95, 53, 51, 99, 50, 51, 55, 53, 95, 102, 48, 50, 95, 51, 118, 51, 50, 121, 48, 110, 51, 95, 55, 48, 95, 53, 51, 51, 33, 64, 125]
CyberChef decoding 50 bytes retrieved from the device
CyberChef decoding 50 bytes retrieved from the device
$ cat data.txt

72, 84, 66, 123, 109, 51, 109, 48, 50, 49, 51, 53, 95, 53, 55, 48, 50, 51, 95, 53, 51, 99, 50, 51, 55, 53, 95, 102, 48, 50, 95, 51, 118, 51, 50, 121, 48, 110, 51, 95, 55, 48, 95, 53, 51, 51, 33, 64, 125
$ cat data.txt  | tr -d ',' | tr " " "\n" | awk '{printf "%c",$1}'

HTB{m3m02135_57023_53c2375_f02_3v32y0n3_70_533!@}

Remember to keep it sexy, keep it Linux :)

Conclusion

I hope this write-up has offered you more than just the solution — it’s my aim to share valuable insights and methodologies to enhance your problem-solving for CTFs as well as real-world scenarios.

🏠 HTB Cyber Apocalypse CTF 2024 Write-ups

--

--

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Penetration Tester, Linux Evangelist, Security Geek, Blogs about Ethical Hacking, CTF, Cybersecurity Career & Certifications. www.linkedin.com/in/abdul-issa

Responses (1)