← Back to Writeups
HTBEasyHardware

It's Oops PM

XESXOR9/10/20262 min read
#hardware#htb#easy#backdoor_trigger#code_analysis

It's Oops PM

Platform: HackTheBox | Category: Hardware | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-02-16 | Status: Solved Techniques: backdoor_trigger, code_analysis

Summary

Task: Analyze VHDL source code for a TPM chip to find a backdoor. Solution: Identified a pattern comparator that bypasses encryption when input matches 0xFFE9, revealing the hardcoded secret key.

It's Oops PM — HackTheBox

Description

This challenge presents VHDL source code for a Trusted Platform Module (TPM) chip. The goal is to analyze the hardware description, find the backdoor, and understand how to extract the secret key.

Analysis

tpm.vhdl

This is the main entity that combines the following components:

  • ckey: Component that provides the secret key.
  • encryption: Data encryption module.
  • backdoor: Module that checks input data for a backdoor trigger.

The tpm.vhdl architecture implements a process that controls the Output signal:

vhdl
process(Key, Encrypted, B)
begin
    case B is
        when '1' =>
            for i in 0 to 15 loop
                Output(i) <= Key(i);
            end loop;
        when others =>
            for i in 0 to 15 loop
                Output(i) <= Encrypted(i);
            end loop;
    end case;
end process;

If signal B (output of the backdoor module) equals '1', the device outputs the raw secret key Key. Otherwise, it outputs encrypted data.

backdoor.vhdl

This module is responsible for activating signal B. It defines a constant pattern:

vhdl
constant pattern : STD_LOGIC_VECTOR(15 downto 0) := "1111111111101001";

The activation logic is simple:

vhdl
if D = pattern then
    B <= '1';
else
    B <= '0';
end if;

The backdoor triggers when input data D exactly matches the pattern 1111111111101001 (in hexadecimal: 0xFFE9).

key.vhdl

This file contains the hardcoded secret key that the TPM is supposed to protect:

vhdl
constant key : STD_LOGIC_VECTOR(15 downto 0) := "0110001111100001";

Key value in HEX: 0x63E1.

encryption.vhdl

The encryption module performs XOR between input data and the key, but contains intentional errors:

  • Bits 0, 6, and 13 are forcibly set to NOT K(i), ignoring input data D. This makes encryption irreversible for some bits, but doesn't interfere with the backdoor operation.

Backdoor Trigger Logic

The trigger is implemented as a comparator of the input data bus with a predefined 16-bit value. When matched, the control signal switches the multiplexer, routing the internal key register directly to the device's output port, bypassing the encryption block.

Solution

  1. Structure analysis: Examine tpm.vhdl and notice the suspicious backdoor component whose output controls the multiplexer at the device output.
  2. Pattern search: Navigate to backdoor.vhdl and find the trigger value: 1111111111101001.
  3. Secret extraction: Understand that when this value is sent to the input, the device will reveal its key.
  4. Key retrieval: In key.vhdl, find the key itself: 0110001111100001.

In the CTF context, after discovering this logic, you need to send the magic number to the emulated device or server to obtain the flag.