Whether it's rebuilding a car engine or diagramming a sentence, people can learn about many things simply by taking them apart and putting them back together again. That, in a nutshell, is the concept behind reverse-engineering—breaking something down in order to understand it, build a copy or improve it.
Apr 13, 2017 The general answer is yes. The difficulty ranges from easy to very difficult. You can disassembly many compiled programs. If the project was built without stripping the symbol tables, the output of the disassembler can be very informative. Mar 23, 2015 Yes. Here's an example. Back in the 1980s I was the lead developer on the commercial computer game Dungeon Master. I am quite certain that I am one of only two people with the complete original source code. The game enjoyed considerable succes. Reverse-engineering is especially important with computer hardware and software. Programs are written in a language, say C or Java, that’s understandable by other programmers. But to run on a computer, they have to be translated by another program, called a compiler, into the ones and zeros of machine language. Reverse-engineering is the process of taking a piece of software or hardware, analyzing its functions and information flow and then translating those processes into a human-readable format. Software reverse engineering typically aims to answer the question of how does certain applications or systems work. Of course, when detailed documentation is available, the process becomes fairly easy. However, in practice, most of the time such information is very restricted, forcing you to use another way to understand the software in question.
A process that was originally applied only to hardware, reverse-engineering is now applied to software, databases and even human DNA. Reverse-engineering is especially important with computer hardware and software. Programs are written in a language, say C++ or Java, that's understandable by other programmers. But to run on a computer, they have to be translated by another program, called a compiler, into the ones and zeros of machine language. Compiled code is incomprehensible to most programmers, but there are ways to convert machine code back to a more human-friendly format, including a software tool called a decompiler.
Reverse-engineering is used for many purposes: as a learning tool; as a way to make new, compatible products that are cheaper than what's currently on the market; for making software interoperate more effectively or to bridge data between different operating systems or databases; and to uncover the undocumented features of commercial products.
A famous example of reverse-engineering involves San Jose-based Phoenix Technologies Ltd., which in the mid-1980s wanted to produce a BIOS for PCs that would be compatible with the IBM PC's proprietary BIOS. (A BIOS is a program stored in firmware that's run when a PC starts up; see Technology QuickStudy, June 25.)
To protect against charges of having simply (and illegally) copied IBM's BIOS, Phoenix reverse-engineered it using what's called a 'clean room,' or 'Chinese wall,' approach. First, a team of engineers studied the IBM BIOS—about 8KB of code—and described everything it did as completely as possible without using or referencing any actual code. Then Phoenix brought in a second team of programmers who had no prior knowledge of the IBM BIOS and had never seen its code. Working only from the first team's functional specifications, the second team wrote a new BIOS that operated as specified.
The resulting Phoenix BIOS was different from the IBM code, but for all intents and purposes, it operated identically. Using the clean-room approach, even if some sections of code did happen to be identical, there was no copyright infringement. Phoenix began selling its BIOS to companies that then used it to create the first IBM-compatible PCs.
Other companies, such as Cyrix Corp. and Advanced Micro Devices Inc., have successfully reverse-engineered Intel Corp. microprocessors to make less-expensive Intel-compatible chips.
Few operating systems have been reverse-engineered. With their millions of lines of code—compared with the roughly 32KB of modern BIOSs—reverse-engineering them would be an expensive option.
But applications are ripe for reverse-engineering, since few software developers publish their source code. Technically, an application programming interface (API) should make it easy for programs to work together, but experts say most APIs are so poorly written that third-party software makers have little choice but to reverse-engineer the programs with which they want their software to work, just to ensure compatibility.
Ethical Angles
Reverse-engineering can also expose security flaws and questionable privacy practices. For instance, reverse-engineering of Dallas-based Digital: Convergence Corp.'s CueCat scanning device revealed that each reader has a unique serial number that allows the device's maker to marry scanned codes with user registration data and thus track each user's habits in great detail—a previously unpublicized feature.
Recent legal moves backed by many large software and hardware makers, as well as the entertainment industry, are eroding companies' ability to do reverse-engineering.
'Reverse-engineering is legal, but there are two main areas in which we're seeing threats to reverse-engineering,' says Jennifer Granick, director of the law and technology clinic at Stanford Law School in Palo Alto, Calif. One threat, as yet untested in the courts, comes from shrink-wrap licenses that explicitly prohibit anyone who opens or uses the software from reverse-engineering it, she says.
The other threat is from the Digital Millennium Copyright Act (DMCA), which prohibits the creation or dissemination of tools or information that could be used to break technological safeguards that protect software from being copied. Last July, on the basis of this law, San Jose-based Adobe Systems Inc. asked the FBI to arrest Dmitry Sklyarov, a Russian programmer, when he was in the U.S. for a conference. Sklyarov had worked on software that cracked Adobe's e-book file encryption.
The fact is, even above-board reverse-engineering often requires breaking such safeguards, and the DMCA does allow reverse-engineering for compatibility purposes.
'But you're not allowed to see if the software does what it's supposed to do,' says Granick, nor can you look at it for purposes of scientific inquiry. She offers an analogy: 'You have a car, but you're not allowed to open the hood.'
Schwartz is a freelance writer in Arlington, Mass. Contact him at [email protected].
Active6 years, 6 months ago
every c program is converted to machine code, if this binary is distributed. Since the instruction set of a computer is well known, is it possible to get back the C original program?
Ira Baxter
82.7k1111 gold badges137137 silver badges281281 bronze badges
shreyasvashreyasva
5,5332121 gold badges6969 silver badges9999 bronze badges
9 Answers
You can never get back to the exact same source since there is no meta-data about that saved with the compiled code.
But you can re-create code out from the assembly-code.
Check out this book if you are interested in these things: Reversing: Secrets of Reverse Engineering.
Edit
Some compilers-101 here, if you were to define a compiler with another word and not as technical as 'compiler', what would it be?
Answer: Translator
A compiler translates the syntax / phrases you have written into another language a C compiler translates to Assembly or even Machine-code. C# Code is translated to IL and so forth.
The executable you have is just a translation of your original text / syntax and if you want to 'reverse it' hence 'translate it back' you will most likely not get the same structure as you had at the start.
A more real life example would be if you Translate from English to German and the from German back to English, the sentance structure will most likely be different, other words might be used but the meaning, the context, will most likely not have changed.
![]()
The same goes for a compiler / translator if you go from C to ASM, the logic is the same, it's just a different way of reading it ( and of course its optimized ). https://semever.weebly.com/blog/magicfeatures-windows-10.
Filip Ekberg
![]()
30.3k1818 gold badges111111 silver badges176176 bronze badges
It depends on what you mean by original C program. Things like local variable names, comments, etc.. are not included in the binary, so there's no way to get the exact same source code as the one used to produce the binary. Tools such as IDA Pro might help you disassemble a binary.
Darin DimitrovDarin Dimitrov
879k233233 gold badges30773077 silver badges27922792 bronze badges
I would guestimate the conversion rate of a really skilled hacker at about 1 kilobyte of machine code per day. At common Western salaries, that puts the price of, say, a 100 KB executable at about $25,000. After spending that much money, all that's gained is a chunk of C code that does exactly what yours does, minus the benefit of comments and whatnot. Cannot stop windows installer. It is no way competitive with your version, you'll be able to deliver updates and improvements much quicker. Reverse engineering those updates is a non trivial effort as well.
If that price tag doesn't impress you, you can arbitrarily raise the conversion cost by adding more code. Just keep in mind that skilled hackers that can tackle large programs like this have something much better to do. They write their own code. Freemake video converter web pack.
Hans PassantHans Passant
816k114114 gold badges14061406 silver badges21922192 bronze badges
One of the best works on this topic that I know about is:
Pigs from sausages? Reengineering from assembler to C via FermaT.
Best Reverse Engineering Software
The claim is you get back a reasonable C program, even if the original asm code was not written in C! Lots of caveats apply.
Ira BaxterIra Baxter
82.7k1111 gold badges137137 silver badges281281 bronze badges
The Hex-Rays decompiler (extension to IDA Pro) can do exactly that. It's still fairly recent and upcoming but showing great promise. It takes a little getting used to but can potentially speed up the reversing process. It's not a 'silver bullet' - no c decompiler is, but it's a great asset.
Reverse Engineering Tutorialjovehajoveha
1,54911 gold badge1212 silver badges1919 bronze badges
The common name for this procedure is 'turning hamburger back into cows.' It's possible to reverse engineer binary code into a functionally equivalent C program, but whether that C code bears a close resemblance to the original is an open question. Csr dongle driver windows 10.
John BodeJohn Bode
88.4k1515 gold badges8989 silver badges156156 bronze badges
Working on tools that do this is a research activity. That is, it is possible to get something in the easy cases (you won't recover local variables names unless debug symbols are present, for instance). It's nearly impossible in practice for large programs or if the programmer had decided to make it difficult.
Pascal CuoqPascal Cuoq
68.6k66 gold badges132132 silver badges241241 bronze badges
There is not a 1:1 mapping between a C program and the ASM/machine code it will produce - one C program can compile to a different result on different compilers or with different settings) and sometimes two different bits of C could produce the same machine code.
You definitely can generate C code from a compiled EXE. You just can't know how similar in structure it will be to the original code - apart from variable/function names being lost, I assume it won't know the original way the code was split amongst many files.
Mr. BoyMr. Boy
23.4k7575 gold badges253253 silver badges480480 bronze badges
You can try hex-rays.com, it has a really nice decompiler which can decompile assembly code into C with 99% accuracy.
Yuriy Y. YermilovYuriy Y. Yermilov
Not the answer you're looking for? Browse other questions tagged cassemblyreverse-engineeringdisassembly or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |