Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is reflection reverse engineering?

You can find out a great deal about the internals of an application through reflection, it's exposed by the .NET BCL (base class library) and it makes it trivial to retrieve actual IL for any .NET method.

Reverse engineering on Wikipedia:

Reverse engineering is the process of discovering the technological principles of a device, object or system through analysis of its structure, function and operation.

Reflection would certainly satisfy as analysis of structure. But where do you draw the line between introspection and actual reverse engineering? And from a legal standpoint, is reflection reverse engineering?

like image 354
John Leidegren Avatar asked Mar 11 '09 13:03

John Leidegren


2 Answers

The border between the two does seem blurred. Ethically I would draw the line in the programmer's motivation.

If he is using reflection to build a library, tool or similar software that is supposed to interact with any 3rd party code that satisfies certain criteria, I would not see it as reverse engineering.

For example, I was recently writing a generic base class for Linq2SQL data layers. The base class uses reflection to gain insight into the database layout and properly handle updates of nested business entities. If someone else uses my bases class for his web application, I would not gain any knowledge about the his source code. This usage of reflection is certainly no reverse engineering.

If, on the other hand, the programmer is trying to understand the inner workings by a competitor's software using reflection, he is reverse engineering it.

like image 101
Adrian Grigore Avatar answered Nov 09 '22 07:11

Adrian Grigore


One must call into question the definition of Reverse Engineering when the ability to easily decompile the language is a part of the language ala Reflection.

With a tool like .NET Reflector I feel like the lines really start to blur!

Using an example from SO itself, they recently de-obfuscated the source code for their WMD Editor. I would argue that this defines Reverse Engineering more so than Reflection does.

like image 20
Gavin Miller Avatar answered Nov 09 '22 07:11

Gavin Miller