0x41haz THM Walkthrough
好,我需要帮用户总结这篇文章的内容,控制在100字以内。首先,我得快速浏览文章,抓住主要信息。 文章讲的是一个叫0x41haz的逆向工程挑战。作者下载了一个Linux ELF二进制文件,发现它有问题,无法直接运行。于是他用file命令检查,发现ELF头有问题,显示未知架构。 接下来,他用十六进制编辑器修改了ELF头的第六个字节,解决了问题。然后用radare2分析二进制文件,找到了密码字符串。最终输入密码得到了flag。 总结一下:文章描述了修复ELF二进制文件并逆向工程以获取密码的过程。 现在要控制在100字以内,并且不需要特定的开头。所以可以这样写: “文章描述了修复一个受损的Linux ELF二进制文件并逆向工程以获取隐藏密码的过程。通过修改ELF头和使用radare2分析,成功提取出密码THM{2@@25$gfsT&@L}。” 这样既简洁又涵盖了主要步骤和结果。 </think> 文章描述了修复一个受损的Linux ELF二进制文件并逆向工程以获取隐藏密码的过程。通过修改ELF头和使用radare2分析,成功提取出密码THM{2@@25$gfsT&@L}。 2026-1-10 08:2:39 Author: infosecwriteups.com(查看原文) 阅读量:5 收藏

Death Esther

Press enter or click to view image in full size

Introduction

0x41haz is a simple reversing challenge on TryHackMe that focuses on analyzing a Linux ELF binary to recover a hardcoded password. The task is minimal by design, with a small anti-analysis trick that forces you to slow down and inspect the binary properly.

Room link: https://tryhackme.com/room/0x41haz

Downloading the Binary

To get started with 0x41haz, I first downloaded the task file directly from the room. This can be done by clicking the blue download button provided in Task 1.

Press enter or click to view image in full size

Once the file was on my system, the first thing I did was identify what kind of binary I was dealing with. For that, I used the file command, which gives a quick overview of the executable format.

death@esther:~$ file 0x41haz-1640335532346.0x41haz 
0x41haz-1640335532346.0x41haz: ELF 64-bit MSB *unknown arch 0x3e00* (SYSV)

At this point, it was clear that the file was an ELF 64-bit binary. However, the output also showed something unusual: MSB *unknown arch 0x3e00*. That immediately stood out and explained why the binary wouldn’t execute in its current state.

Fixing the Binary Header

The issue turned out to be related to the ELF header. With some quick research and reference material, I found that the problem could be resolved by patching the sixth byte in the file header. Specifically, changing its value from 0x02 to 0x01.

To do this, I opened the binary using a hex editor.

hexedit 0x41haz-1640335532346.0x41haz

Press enter or click to view image in full size

I navigated to the sixth byte and modified it accordingly.

Press enter or click to view image in full size

After making the change, I ran the file command again to verify whether the binary was now recognized correctly.

death@esther:~$ file 0x41haz-1640335532346.0x41haz 
0x41haz-1640335532346.0x41haz: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6c9f2e85b64d4f12b91136ffb8e4c038f1dc6dcd, for GNU/Linux 3.2.0, stripped

The output now looked clean. The binary was properly identified as a 64-bit x86–64 ELF executable.

Executing the Program

With the header fixed, I copied the binary to a simpler name, granted execution permissions, and ran it.

$ cp 0x41haz-1640335532346.0x41haz testbinary
$ chmod +x testbinary
$ ./testbinary

At runtime, the program prompted me for a password.

That confirmed this was a straightforward reversing challenge, so the next step was to analyze the binary to understand how the password check was implemented.

Reversing with Radare2

For analysis, I used radare2, a command-line reverse engineering framework that I personally find efficient for quick static analysis.

Get Death Esther’s stories in your inbox

Join Medium for free to get updates from this writer.

Installation was done as follows:

git clone https://github.com/radareorg/radare2
radare2/sys/install.sh

Once installed, I loaded the binary into radare2.

Press enter or click to view image in full size

The first command I ran was a full analysis pass.

aaa

Press enter or click to view image in full size

After analysis completed, I navigated to the main function.

s main

From there, I disassembled the function to inspect its logic.

pdf

Press enter or click to view image in full size

While reviewing the disassembly, a string pattern stood out during the password comparison logic.

2@@25$gfsT&@L

Retrieving the Flag

With that value identified, I executed the binary again and supplied it as the password.

Press enter or click to view image in full size

The program accepted the input and returned the flag.

What is the password?

THM{2@@25$gfsT&@L}

文章来源: https://infosecwriteups.com/0x41haz-thm-walkthrough-299d7b2c40d2?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh