How "legal" is it to read and edit .exe files, .dll files, and other compiled source files? Decompilation is taking the compiled code of a program, often minified and obfuscated, and trying to get the original source code back as it was written, or at least get it in a form a person could read. There are various reasons a person or company would make its code harder to read while compiling it, but the 2 I've seen most often have to do with saving resources, like space, RAM, power, etc., and making it so the code is harder to read so the user can not see what it does as easily. As we are a community about questioning the practices of reverse engineering, I think it's safe to say most of us don't like the second reason. I am asking for facts here, though, not opinions.

Because this question could get very broad, I will limit this to laws in particular countries and rules of various influential or popular companies, but info about generalities is also welcome. I am definitely not asking about morals/ethics, although I know those will certainly come up.

There was already a question about the legality of reverse engineering in general, but I'm talking only about decompilation here. As the answers to this question stated, decompilation is one type of reverse engineering. As far as I could tell, the other question didn't get answers about decompilation specifically, though you are free to provide these yourself. One answer did say the question was too broad, but perhaps this question will have a better scope.

  • So reverse code engineering (RCE) is not a superset of decompilation then?
    – 0xC0000022L
    Jul 1 '14 at 10:21
  • 3
    I would take any answers to your question on this site with a grain of salt. If you have legal questions, you should be talking with lawyers, not with reverse engineers. Jul 1 '14 at 13:50
  • 1
    @trysis: well this is not a forum, but a Q&A site, so discussion is actually not encouraged.
    – 0xC0000022L
    Jul 1 '14 at 14:23
  • 1
    @trysis: that depends on the context. So a cautious "ynos" to that question. Most of these questions suck because they are either US-centric or otherwise make assumptions, and so do most of the answers - and many not even explicitly. And in the worst case it morphs into a discussion and becomes opinion-based. And yes, those should definitely be closed. And even if we'd have an answer for each individual jurisdiction, what about an international team (or company)?
    – 0xC0000022L
    Jul 2 '14 at 11:48
  • 1
    You might be interested in this Law Stack Exchange proposal which is now in commitment phase. Nov 30 '14 at 18:30

Legality of decompilation depends on the EULA (End User License Agreement) of the binary you wish to work with. While Open Source License Agreements like GPL may allow to edit/decompile the binary, other closed source proprietary agreements will prevent you in most cases.

That being said decompiling is always legal to somewhat a limited extend according to copyright laws of Europe and the US.

More information on this topic here

  • So what do you do in legislation where it's fully legal to decompile (reverse engineer) something for the purpose of interoperability? Which ranks higher: law or EULA?
    – 0xC0000022L
    Jul 1 '14 at 14:24
  • @0xC0000022L It's always legal to decompile for the purposes of interoperability. The DMCA allows it for Security Testing, Evaluation and Reverse Engineering. If someone releases a closed source malware (which obviously applies to all), AV companies would definitely RE & decompile it. They cannot be held guilty by the law.
    – 0xec
    Jul 2 '14 at 4:10
  • so the DMCA affects me in what way? The point is legislation differs based on location and time and so does the content of your answer.
    – 0xC0000022L
    Jul 2 '14 at 11:44

In Australia, you need to have a valid license for the software and be reversing for "compatibility" purposes. Which is pretty wide and includes investigating a security issue. Obviously if the code is available from the vendor, you need to get hold of that source code instead of reversing.

Not the answer you're looking for? Browse other questions tagged or ask your own question.