String analysis for n00bs
文章介绍了一个Windows可执行文件的反向工程案例。静态和动态分析显示其功能简单(输出"Hello World!"),但代码分析揭示了隐藏功能:当传入特定参数(如"/h")时会输出"Hello Baby!!"。这提醒我们不能盲目依赖自动化工具,需深入分析以发现潜在分支或隐藏行为。 2025-2-23 14:6:52 Author: www.hexacorn.com(查看原文) 阅读量:4 收藏

I like to demo this little windows executable to everyone who thinks they are doing the reverse engineering bit right, by using available automated static and dynamic analysis tools, and trusting them blindly.

The sample is a PE32 that is 2560 bytes long. Running ‘strings’ over it produces these results:

!This program cannot be run in DOS mode.
Rich
.text
`.rdata
@.data
8/u
ExitProcess
GetCommandLineA
kernel32.dll
GetStdHandle
WriteFile
Hello World!

Running it from a CLI gives us the following text being printed out to the STDOUT:

Hello World!

One can say that both static and dynamic analysis give us the same output. Based on this info it’s kinda obvious to conclude that this small binary is a simple CLI program that prints out ‘Hello World!’ when executed.

Except, only code analysis can help us to determine that the program behaves differently if we pass a ‘/h’ argument to it.

In such case, the dynamic analysis will show that the following string is being printed out to the STDOUT:

Hello Baby!!

Static analysis was done right. Default dynamic analysis was done right. And code analysis was done right too. It’s just the automation that failed.

Just a reminder that we can’t blindly trust the automation, because it only sees the obvious. And command line arguments are not the only way to trigger execution of a different branch of code. It could be a guard rail of any sort: time of the day, locale of the OS, delayed payload, payload downloaded from a site that is not available atm, etc.

in the interest of full disclosure: I have not ‘analyzed’ this sample with any AI framework, so am still hopeful that at least some of them would discover this little mischief.


文章来源: https://www.hexacorn.com/blog/2025/02/23/string-analysis-for-n00bs/
如有侵权请联系:admin#unsafe.sh