reversefreeeasy

Rega's Town

HackTheBox

ELF 64-bit LSB PIE executable, x86-64, dynamically linked, not stripped, with debug info. Rust binary `rega_town` (~19MB, typical for Rust). The program asks for a "secret passphrase" and validates input in two stages: first through 9 regex patterns, then through ASCII code product verification of s

$ ls tags/ techniques/
string_analysisregex_constraint_extractionposition_constraint_mappingascii_product_verificationleetspeak_decoding

$ cat /etc/rate-limit

Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.

Rega's Town — HackTheBox

Description

Welcome to Rega Town, a quaint little place where everyone communicates through the magic of patterns and rules!

ELF 64-bit LSB PIE executable, x86-64, dynamically linked, not stripped, with debug info. Rust binary rega_town (~19MB, typical for Rust). The program asks for a "secret passphrase" and validates input in two stages: first through 9 regex patterns, then through ASCII code product verification of substrings.

Analysis

Initial Reconnaissance

$ file rega_town ELF 64-bit LSB PIE executable, x86-64, dynamically linked, with debug_info, not stripped $ strings rega_town | grep -E "Welcome|passphrase|secret" Welcome to our secret town! Enter secret passphrase:

The binary is not stripped and contains debug info — Rust symbols are fully available for analysis.

Key Functions

rega_town::main         @ 0x58230 — entry point, prints greeting, reads input
rega_town::filter_input @ 0x578f0 — validation through 9 regex patterns
rega_town::check_input  @ 0x57c00 — extracts substrings, verifies ASCII code products
rega_town::multiply_characters @ 0x57bd0 — computes product of ASCII values (u128)

Stage 1: Extracting Regex Patterns

Running strings on the binary revealed a block of 9 POSIX-style regex patterns located between called Result::unwrap() on an Err value and src/main.rs:

...

$ grep --similar

Similar writeups