Methodology
Random general tips and notes I need to remind myself of.
Document the attack surface:
Recon:
Review the applications memory protections (DEP/ASLR/Etc)
Do your research before doing any reverse engineering:
Read any relevant RFCs for the protocols used.
Read any technical documentation of file formats used.
Read the docs.
Locate an entrance point to the application via ProcMon/Netstat/etc
Enumeration:
Do an intial pass with both dynamic and static analysis to get a very broad idea of what the application is doing with your data.
Note any DLLs called and repeat step 2 for them as necessary.
Start with several full fast passes to get a general understanding.
Don't commit to in depth RE until you are relatively sure you understand the basic flow of the application.
Note suspicious code for later review.
RE:
Just because there are no obviously vulnerable system calls doesn't mean you should skip over a function. For example loops and rep movs as well as a single mov r32, r32 can lead to an overflow or write primitive.
Always send the largest possible buffer to every new path.
Follow calls to other DLLs and put them in IDA for analysis.
Note every opcode tested and go through them in numerical order so you don't miss any. Can use alt+t in IDA to search for cases.
If a function requires some specific input like a filename attempt adding another buffer after the file seperated by a nullbyte/newline/CR
Exploitation:
Check various buffer sizes
In the case where a read is being preformed on user controlled data attempt to increase both the read and the write buffer sizes.
This includes when attempting to cause a crash for SEH overflows.
ROP selection:
Locate write gadget: mov [write], read
gadgets write register must
receive a writable staging area address
increment
decrement by ~0x18
gadgets read register must
receive staging area address
receive dereferenced function address
recieve shellcode address
receive arbitrary small values (ideally pop + neg/sub)
Commonly Vulnerable Calls
(As well as the various derivates of the below functions)
gets
scanf
memcpy
wctomb
mbtowc
strcpy
strcat
sprintf
MultiByteToWideChar
https://www.proggen.org/doku.php?id=security:memory-corruption:protection:stdlib
Suspicious Assembly
Vulnerability Classes
Last updated
Was this helpful?