on reading source code
Most people treat source code as instructions for a computer. I think that’s backwards — it’s a record of decisions, and the interesting part is always the gap between what someone intended and what they wrote.
the gap is where bugs live
Take a typical authentication check:
def check_admin(user):
if user.role == "admin":
return True
return False
The intent is clear. The gap: what happens when user.role is None? What if it’s "Admin"? What if the role field is controlled by the user? The code is correct for the happy path. The gap is everything else.
Good vulnerability research is just disciplined gap-reading.
how I approach unfamiliar codebases
- Find the entry points — HTTP handlers, command parsers, file readers. Anything that touches external input.
- Trace data flow forward — follow the input inward. Where does it land? What transforms it along the way?
- Look for trust boundaries — places where the code implicitly trusts data it shouldn’t. Type coercions, format assumptions, length expectations.
- Read the tests — tests tell you what the author was worried about. The absence of a test for a case tells you what they weren’t.
the thing most people skip
Comments. Not the explanatory ones — the apologetic ones.
// TODO: validate this properly later
// this shouldn't happen in practice
// assuming input is well-formed here
These are a map to the gaps. Follow them.
More on methodology in the security section of the wiki.