News for hackers. Stuff that matters.
Re:Creative anti-debugger technique in Spotify for Windows by vorador on Tuesday May 26, 2009 @03:29PM (#627337)
Not necessarily. I'm sure that an emulator differs in some subtle ways from a real machine.
Re:Creative anti-debugger technique in Spotify for Windows by asciilifeform on Tuesday May 26, 2009 @03:43PM (#627373)
The real question is, do all emulators differ in some consistent way from all "real" machines, and more so than "real" machines differ among themselves? The answer is almost certainly "no", and if it were "yes", the fix ought to be trivial, because there is no fundamental magic which emulators introduce and one might easily detect unspoofably.
Re:Creative anti-debugger technique in Spotify for Windows by vorador on Tuesday May 26, 2009 @04:01PM (#627408)
Re:Creative anti-debugger technique in Spotify for Windows by framiere on Tuesday May 26, 2009 @04:15PM (#627428)
Thanks for the paper, it was a nice read. I was stunned to see how straightforward it was.

Basically by order of appearance you look for

* well know files, or registry keys

* patterns in a memory dump

* use a great hack called "the red pill" using the SIDT instruction

* vm specific hardwares

* specific instructions/capabilities

Re:Creative anti-debugger technique in Spotify for Windows by tptacek on Tuesday May 26, 2009 @04:31PM (#627450)
This is all very old stuff. VMWare is very easy to detect, as it (a) was based on software virtualization, which has a heavy footprint, and (b) made no attempt to be hard to detect.

But the available evidence is that even if you're hardware-virtualizing, there are reliable, millisecond-fast techniques you can use to profile the microarchitecture to detect (say) jumps to hypervisor code in instruction sequences that should run natively. Nate Lawson, Peter Ferrie and I presented some of these at Black Hat a couple years ago.

The gap (in functionality and in performance) between an emulator and a cycle-accurate simulator of an actual chipset is large.

Re:Creative anti-debugger technique in Spotify for Windows by asciilifeform on Tuesday May 26, 2009 @07:16PM (#627692)
> The gap (in functionality and in performance) between an emulator and a cycle-accurate simulator of an actual chipset is large

On the other hand, there is a large degree of fuzziness in the behavior (between individual machines) of the features within this gap. For example, profiling and high-resolution timing instructions are not equally available on all x86 CPUs. As for the chipset, most of the interesting features are very poorly (if at all) standardized. I hypothesize that a thorough emulator detector written today will have many false alarms on actual bare hardware.

Let's also not forget that not a single emulator has yet been written with the explicit goal of being undetectable by hostile code. High-resolution timers could always be fudged, a tick table consulted for spoofing the requisite intervals, etc. if we know what to expect from the raw hardware.

And if one day emulator-writers fall far behind anti-debugger trick specialists, the hardware ICE could make a come-back.

Re:Creative anti-debugger technique in Spotify for Windows by tptacek on Tuesday May 26, 2009 @03:50PM (#627386)
Yes. The predictable difference is timing.
Re:Creative anti-debugger technique in Spotify for Windows by asciilifeform on Tuesday May 26, 2009 @07:26PM (#627707)
Hypothetically, software could be fed false outputs from timer-register reads in much the same way as it is fed false outputs from privileged instruction calls in VMWare. I am not aware of any publicly available emulator which does this, however.

Alternatively, one could use automated means to find sections of a binary which behave in a logically distinct manner (branch differently in at least one place) when emulated instruction timings are twiddled. Then turn the disassembled section red in your debugger and attack it manually.