r/ReverseEngineering • u/day6reak • Apr 22 '12
Reverser wanting to develop mathematically
I've been reversing for almost a decade now. My work is mostly security oriented with bug hunting and malware. Lately, I've been noticing that my development has been coming up against a mathematical wall. When going through academic papers and other sources where algorithms are described I sometimes have trouble bridging the gap from equation to implementation. It pisses me off when I cannot grasp something so I've decided to devote myself to mathematics.
I am going to be teaching myself advanced math and would like recommendations on what to learn from people who are able to understand reversing and security from a mathematical standpoint. Right now I have refreshed myself on discreet math and basic calculus and will continue with more calculus. What other topics should I branch out into? I am interested in mathematics describing everything from techniques in static analysis to smt solving to reversing complex polynomial expressions in protected binaries.
Practical resources showing how complex math is described through code would be great but any suggestions or advice at all is appreciated.
62
u/rolfr Apr 22 '12 edited Apr 11 '13
I started from scratch on the formal CS side, with an emphasis on program analysis, and taught myself the following starting from 2007. If you're in the United States, I recommend BookFinder to save money buying these things used.
On the CS side:
On the math side, I was advantaged in that I did my undergraduate degree in the subject. Here's what I can recommend, given five years' worth of hindsight studying program analysis:
Final bit of advice: you'll notice that I heavily stuck to textbooks and Ph.D. theses in the above list. I find that jumping straight into the research literature without a foundational grounding is perhaps the most ill-advised mistake one can make intellectually. To whatever extent that what you're interested in is systematized -- that is, covered in a textbook or thesis already, you should read it before digging into the research literature. Otherwise, you'll be the proverbial blind man with the elephant, groping around in the dark, getting bits and pieces of the picture without understanding how it all forms a cohesive whole. I made that mistake and it cost me a lot of time; don't do the same.
6
u/pg1989 Apr 22 '12
There are tons of excellent free resources for learning math on the internet. MIT OCW is probably the most well-known, along with Khan Academy.
To be honest, I would forget about calculus. It's useful for developing a general intuition that is sometimes called "mathematical maturity", but for someone trying to understand academic security papers it is essentially useless. To really understand polynomials, you might instead try abstract/linear algebra, as this is where a ton of well-founded theory on polynomials is used.
5
u/andrewl_ Apr 23 '12
a different approach, from someone with limited time and attention span:
pick one thing that really seems magical or interests you, and go at it, forgetting everything else
examples:
the volume of available subjects and material is itself a hinderence; ignore it. collecting a bunch of foundational material just adds to the size of the endeavor; ignore it. go to wikipedia immediately and read ... some junk you don't understand? cool now subject is more mysterious and challenging! it will be even more rewarding once you've figured it out. let it haunt you while you drive, while you wait in line, etc.
experimenting and playing are more important than reading; download minisat and try to convert some equation to dimacs and see it work right away; now tweak it, change it, play with it; now read a bit more; now play more
4
u/94c3 Apr 22 '12
I suggest MiniSat for learning more about SAT solving. It's designed to be as small as possible and easy to understand. The current version is 3,000 lines of code, but you can check out an earlier version which is just over 1,000 lines. The paper is also available (you'll have to read a few of the citations as well to get the proper background).
What's really cool about MiniSat is that it is still performant; it won the SAT-Race in 2008.
2
u/luciddr34m3r Apr 22 '12
Graph theory is exceptionally useful for reversing. Advanced logic as well. Also, upvotes for the mention about the SAT solver.
2
u/edmcman Apr 22 '12
For program semantics and formal verification, I've been reading Benjamin Pierce's book on Software Foundations: http://www.cis.upenn.edu/~bcpierce/sf/ The book is a mix between an introduction to the Coq proof assistant, and a hands-on introduction to Verification and Program Semantics.
1
u/tripsandleaves Apr 22 '12
bump. this interests me aswell. sometimes reverseme challenge involve solving a set of equations that are needed to satisfy a set of instructions and comparisons and i want a fast way to encode these constraints and solve for bitpatterns matching it without having to write a cumbersome script or manually do it. i know the constraints, i guess i need to learn a equation solving language? examples? learn a smt solver? yices?
-8
u/[deleted] Apr 22 '12
discrete*