http://www.program-transformation.org/Transform/LegalityOfDecompilationLegality Of Decompilation
Program-Transformation.Org: The Program Transformation WikiIf decompilation is possible to a certain extent, is it then also allowed?
Decompilation can be used for a number of reasons (see WhyDecompilation for more), including:
Recovery of lost source code (by accident or via a disgruntled employee),
Migration of assembly language applications to a new hardware platform,
Translation of code written in obsolete languages no longer supported by compiler tools,
Determination of the existence of viruses or malicious code in the program, and
Recovery of someone else's source code (to determine an algorithm for example).
However, not all uses of decompilers are legal uses.
Throughout the world, computer programs are protected by copyright law. Copyright protects the expression of an idea in the form of a program, hence protecting the developer's (or company's) investment in writing the software. Copyright law provides a bundle of exclusive rights to the software developer; among others, the right to reproduce and make adaptations to the developed computer program. It is a breach of these rights to make reproductions or adaptations without permission of the copyright holder. Further, license agreements may also bind the user to operate the program in a certain way and to avoid using decompilation or disassembly techniques on that program.
Different countries have different exceptions to the copyright owner's rights or precedent has been established in court proceedings. This means that these uses are allowed by law. The most common ones are:
Decompilation/disassembly for the purposes of interoperability (to another piece of software or hardware) where the interface specification has not been made available,
Decompilation/disassembly for the purposes of error correction where the owner of the copyright is not available to make the correction, and
To determine parts of the program that are not protected by copyright (e.g. algorithms), without breach of other forms of protection (e.g. patents or trade secrets).
Not all countries implement the same laws, you should contact your lawyer if in doubt.