views:

716

answers:

11

I was just wondering if it was wrong to reverse engineer code?

I understand that with languages such as C# it is a pretty easy thing to do.

Is it was something that programmers use as a tool in their box of tricks?

+8  A: 

Decompiling can be a very good way to learn from other people, especially in cases where it's a trivial operation (Right-click -> View Source for example)

However morally it's wrong to use that technique to steal and use someone else's code for a use they haven't given permission for.

Now, how enforcable that licence is depends on a lot of variables, but to answer the question of "wrongness" that depends entirely on the original developer's intentions, which it's your responsibility to find out and adhere to

Gareth
A: 

No, its not at all wrong to reverse engineer the code. Reverse engineering the code helps you understand the code in a better way whereas helps you in cases when you are put into a partially built project and you have to finish it off sooner....

Samiksha
+4  A: 

Check the license. They often contain a clause that any kind of reverse engineering is forbidden.

Gamecat
A: 

Note that it may actually be illegal for you to decompile the code, if you agreed with an EULA when you installed / downloaded the software.

Phill Sacre
I doubt that it's ever "illegal". In the case of EULAs, it may be a breach of contract.
Ferruccio
+1  A: 

Sometimes it can be a legitimate tool to try to solve a problem, though I would imagine its most common uses are to try to reverse engineer something or to try to exploit it (which could be for malicious reasons or as part of trying to improve security). In any case, I don't think the act of decompiling code is either right or wrong but rather it depends why you are doing it and what you do with it once decompiled. In particular if you're doing it for the sake of learning, then I don't think there is anything ethically wrong with that, however I am not sure on the legal issues (and that would of course depend on where you are anyway).

lemnisca
+2  A: 

I don't feel that reverse engineering in itself is wrong. Especially if there is nothing in the licensee which stops you from doing it. Depending on what you do with the reverse engineered code and your knowledge of it, it may be an ethical problem though.

It is not something I have used very often, but it has happened. Once I was dependent on a third-party library on do a crucial task in a system we were building. The provider of the third-party library was also one of our service providers (Telecom).

I kept getting unexpected results when calling one of the methods in their API. After repeated attemps at getting them to help me figure out what the problem was, I decided to decompile their library to check if the methods were doing what the documentation said and I expected them do to.

It turned out that there was a bug in their code. I told them about it, and they were very happy. (They sent out a fixed version of the third-party library to all their clients)

Nicolai
The ethical problem arises only if you use the code unchanged and without own understanding.
Svante
+6  A: 

Opinions will be divided on whether it is morally wrong - I'd say it depends on what you do with the knowledge gained.

Legally, it is also a complex question with complex answers. Wikipedia has detailed info.

Michael Borgwardt
+2  A: 

First, the usual disclaimer: IANAL

In Europe, reverse engineering is allowed under the following circumstances: To create a product which is compatible to the one you're disassembling unless you can get the same information from an official source (say, developer docs or the support hotline or a developer conference).

If that other company refuses to give you the information you need, you can go ahead . The law doesn't protect hanging a competitor out of the window for drying in the sun.

Unless explicitly granted, you must not:

  1. Copy the code 1:1 into your product
  2. Create a book which contains details of the code (but you can write a book which explains how the API works). Example: if there wasn't any documentation about OOXML, you could disassemble the files and Word to find out how things work. You could then write a book which explains OOXML (the format) but the ice would start to get thin as soon as you start writing "word is doing this and that based on the code in function foo()".
  3. Spread the code in any form. You can look at it, you can learn from it but you can't make direct profit from it.

That's about it. If you want to know more, check the copyright legislation. Legally, computer programs are work of art (like paintings and texts). The EULAs usually aren't worth the bytes they are stored in because users see them only after buying the product and such contracts are void.

Again: This is for Europe! In the US, the laws are completely different!

Aaron Digulla
+1  A: 

Here we have another example where moral problems in martial arts and moral problems in software enigneering meet.
You have the ability to take a piece of machine language and turn it back into source code everyone might be able to read and modify. The question if this is bad is pretty similar to the question: "Is knowing hard martial arts bad?" (hard martial arts target winning a fight, seconding the opponents health. Soft martial arts value the opponents health higher than winning).

Sometimes it is necessary. Imagine the disaster struck and you lost the source code to a software. Is it really bad to reverse engineer the software from machine language, just because it might be illegal in other cases? The analogy to this is self defense. If you "unintenionaly" kill someone that threatened your life or the life of someone close to you, is this bad?
I certainly disagree to that.

Sometimes it would be a good thing. Given a software and you really want to know how a certain thing is implemented. You can reverse enigneer the program and look at it, and use the knowledge you gain in order to do something similar. The analogy in this case is to do sparring or hard training. You beat someone, and he beats you, and both grow stronger, however, the health of both participants might decrease. Hard training basically means: you punch solid rocks, until you can punch solid rocks really hard. After that, your fist will be stable enough to break anything.
This is the "grey zone". It is not clear if this is right or wrong. It might be right in certain situations, and it might be wrong in others. It might be wrong if someone notices, or it might be right if someone notices.

Sometimes it is a bad thing. If you reverse engineer a software and simply steal ideas -- not, not ideas, steal LITERAL CODE -- then you steal work. It is the same as stealing a chair someone produced.
The analogy to this is to use martial arts to bully someone around. You are able to do so and if you are good, no one can stop you. but it is morally wrong.

Adding to these problems, you will have legal constraints that might apply, as well as being able to whack someone really hard has legal constraints. This must be explored on a case-by-case base, as well as one has to check if he would be accused for the use of techniques he knows. If I reverse enigneer my own software, no one will accuse me. If I reverse engineer a software because the owner told me to do so, no one will accuse me either.

HtH, Tetha.

Tetha
+2  A: 

obviously not according to the download statistics of reflector ;)

Seriously, why would that be bad...?

If you disassemble and then redistribute the source to the competitor of the company, then maybe you're breaking a couple of IP rights, but to disassemble to learn there cannot possibly be anything wrong with...

Reverse engineering was how Compaq "broke up" the x86 architecture, and theygo away with it. I guess that's a pretty strong statement ... ;)

(They reverse engineered the BIOS which was the only proprietary thing IBM stuffed into their "PC")

Thomas Hansen
A: 

Close to be duplicate of Is reverse engineering evil? which is itself near duplicate of Is it legal to reverse engineer binary file formats.

At least we have some cross-reference for those looking for answers...

PhiLho
I think you are right, the first one is more or less what I was after... I'm not so interested in legality
DrG