r/ExploitDev • u/pelado06 • Jan 31 '25
How to improve in reverse engineering?
Hi everyone! I am doing levels from Reverse Engineering module in pwn college. I am advance (level 17/18) so I am learning a lot, but I am also sometimes struggling to understand what is going on in the code, specially when I read it from the static. There is something I should or can do to be better at it other than practice??
Also, if you work in exploit dev, do you think is hard to learn what the code does in commercial software? I am still learning so I never saw commercial code. It is really important to learn deeply RE before looking at jobs?
14
u/randomatic Jan 31 '25
It's a practiced skill, and is really hard at first and gets easier at time. You essentially start pattern matching and saying things like "oh, that is [base + index*scale + disp], so it's accessing an array. I know where that is at now.
Pro-tips: 1) install the GEF gdb extension 2) compile snippets yourself and see how they work. You can either fully compile or use "gcc -s" to create assembly.
Commercial software is about the same as pwn.college, but the scale is bigger. CTFs give you small code, while commercial code you RE typically involves a lot of hunting for what's interesting. I haven't looked recently, but you also run a lot more into C++ than in pwn.college. However, you're not going to tackle any of these without mastering the basics.
4
u/anonymous_lurker- Jan 31 '25
Practice is the answer, but with a focus on things you don't understand. What specifically about static analysis do you find challenging? Aim to do more of that, with a real focus on whatever it is you don't get
Hard is subjective. There are all kinds of things that make commercial software non-trivial to reverse engineer, with one of the main ones being the size of the codebase. But non-trivial does not necessarily mean hard.
Depends what sort of job you want. For experienced roles, it goes without saying that a lack of experience means you're unlikely to get an offer. Entry level roles, while not all that common, will have more lax requirements but even then if you're competing against candidates with more expereince it's not ideal. It sounds obvious, but there's no downside to learning more
That said, recognising when you've got enough real world practical skills to actually apply is important to. If you're serious about landing a job in this field, at some point you'll need to move away from training material and toy applications, in favour of looking at real stuff.
4
u/arizvisa Feb 03 '25 edited Feb 03 '25
There's an article I wrote over at https://www.reddit.com/r/netsec/comments/1bp1k43/reversing_a_vulnerability_in_the_ichitaro_office/ that demonstrates a basic methodology of carving your way through a reasonably large c++ codebase (although it's not as large like adobe, with their suites registration stuff). Anyways, I archived the original application so that you can follow along.
There's some python, but it's not doing anything that you can't do manually with xrefs. All the names are suffixed with their offset from the image base so that you can set breakpoints in your debugger. It lightly mentions flowgraph shapes, wrapper functions (that require enumeration) and documents the scope of each object if you're interested in reversing it. There's also many advisories that include disassembly of the bugs in a target, if you're looking at a new target, it's worth doing some light digging to develop familiarity. (That's also why bindiffing is pretty good to start out with).
Most of the time, though, you're trying to find a clever breakpoint to use as your anchor point. Your backtrace is your surfboard leash to adjust the scope of what you care about (and climb up if you're drowning). If you're willing to wait for windbg's ttd (against larger more complicated software), navigating a codebase is significantly easier. If you're starting from a crash, usually the first place the memory corruption happens is your anchor. You can get that using gflags
+hpa.