Reverse Engineering Lecture
Reverse Engineering Lecture
Ali Mohamed
What is Reverse Engineering?
• When you take a final product (e.g. a compiled program) and
attempt to break it down and understand what it’s doing, and
possibly modifying it for a new purpose.
• This involves the use of specialized tools such as debuggers and
disassemblers
• Debuggers allow you monitor things live as they happen
• Disassemblers attempt to analyze the program and show you what
it looks like in assembly
Why would you need to reverse engineer something?
• When you have a program that you don’t have the source code for
but what to find out how it does things
• Improving/modifying something you don’t have the source code for
• This may not be legal for every program out there, so exercise it
with caution
We’ll be looking at reverse engineering
through “romhacking”
Why romhacking?
• It’s in a bit of a grey area, however, many hobbyists have written
highly specialized and useful debuggers/emulators that can help
one learn this process
• A game is a good way to break into reverse engineering (and by
extension assembly)
• It’ll be easier to work with gameplay concepts as things we want to
find/alter
Why does it have to be in assembly?
• There is no real way to convert
something back from a High Level Language
compiled format to the original
source code
• The best we can manage is
turning it back into assembly Compiler
nop:
no operation (I believe it’s used for when you need to wait)
*older, simpler CPUs might not have those luxuries, you may have to do your
multiplication/division through bit-shifting
I highly recommend keeping a reference
document up while working on assembly to make it simpler.
Basic approach to reverse engineering
Task we want to accomplish
-> hunt for relevant info (such as RAM addresses & values)
-> set breakpoints (freeze CPU during a certain action)
-> slowly trace through instructions and attempting to figure things out
-> modify (test & check) OR document how it works
Our Target: The GameBoy
T H E S P EC S
CPU :
SHARP LR35902 @ 4.19 MHZ
D I S P L AY:
2 . 6 ” LC D
R E S O LU T I O N :
1 6 0 X 1 4 4 PX
- Don’t ever be afraid to dive into assembly, it may look scary but
given enough time you can figure things out and will learn
a lot of useful info
STUXNET
Background
• Malware that spread on networks to infect systems running WinCC and PCS
7 SCADA
• Took advantage of the fact that PLCs are usually unsecured
o They are behind firewalls and run by other computers that ARE secured
• Once inside, had the ability to reprogram PLC controlling machinery
o Gave the possibility of altering how machinery being controlled will run
"As the story goes, the Stuxnet worm was designed and released by a government--the U.S.
and Israel are the most common suspects--specifically to attack the Bushehr nuclear power
plant in Iran. How could anyone not report that? It combines computer attacks, nuclear
power, spy agencies and a country that's a pariah to much of the world. The only problem
with the story is that it's almost entirely speculation." - Bruce Schneier
• The Stuxnet worm is a "groundbreaking" piece of malware so devious in its use of unpatched
vulnerabilities, so sophisticated in its multipronged approach, that the security researchers who tore it
apart believe it may be the work of state-backed professionals.
• "I'd call it groundbreaking," said Roel Schouwenberg, a senior antivirus researcher at Kaspersky Lab.
In comparison, other notable attacks, like the one dubbed Aurora that hacked Google's network and
those of dozens of other major companies, were child's play.
• But it gets worse. Since reverse engineering chunks of Stuxnet's massive code, senior US cyber
security experts confirm what Mr. Langner, the German researcher, told the Monitor: Stuxnet is
essentially a precision, military-grade cyber missile deployed early last year to seek out and destroy
one real-world target of high importance – a target still unknown.
What a story! I mean theory...
Stuxnet's Authors:
• extremely careful to not leave any traces
What a story! I mean theory...
Stuxnet is sophisticated.
It is fun to speculate its purposes.
http://www.networkworld.com/news/2010/091610-is-stuxnet-the-best-malware.html?page=2
http://www.computerworld.com/s/article/9179618/Iran_was_prime_target_of_SCADA_worm
http://www.computerworld.com/s/article/9185419/Siemens_Stuxnet_worm_hit_industrial_systems
http://www.symantec.com/connect/blogs/stuxnet-p2p-component
http://blogs.technet.com/b/mmpc/archive/2010/07/30/stuxnet-malicious-lnks-and-then-there-was-sality.aspx
http://www.internetnews.com/security/article.php/3903541/Patch+Tuesday+Fixes+Another+Stuxnet+Vulner
ability.htm
http://www.abc.net.au/science/articles/2011/11/01/3353334.htm
http://www.schneier.com/blog/archives/2010/10/stuxnet.html
http://www.schneier.com/blog/archives/2010/09/the_stuxnet_wor.html
http://www.wired.com/threatlevel/2010/10/stuxnet-deconstructed/
THE END!