Nytro Posted December 21, 2011 Report Posted December 21, 2011 Reversing Microsoft patches to reveal vulnerable codeHarsimran WaliaComputer Security EnthusiastThe paper would try to reveal the vulnerable code for a particular disclosed vulnerability, which is thefirst and foremost step for making undisclosed exploit and patch verification. The process used hereincould be used to create vulnerability based signatures which are far better than exploit signatures.Vulnerability signature is a superset of all the inputs satisfying a particular vulnerability conditionwhereas exploit based signature would only cater to one type of input satisfying that vulnerabilitycondition. This paper would try to pin point the vulnerable code and the files in Microsoft products byreverse engineering the Microsoft patches.The method used would be to take a binary difference of the file which was patched taken at twodifferent instances, one is the most recent file before patching and the second is after applying thepatch but finding the two files is in itself another problem. Windows now releases two different versionsof patches, GDR (General distribution) which contains only security related updates and the other QFE(Quick Fix Engineering) or LDR (Limited Distribution Release) which has both security related andfunctional updates. The problem addressed is that the versions of the two files to be compared shouldmatch that is either both should be GDR or LDR. The file after patching can be obtained by extractingthe patch of the considered vulnerability. The second file to be compared with a matching version withthe first one could be extracted from some other vulnerability patch addressing the issue with the samesoftware disclosed just before the vulnerability considered. The process of extraction of files frompatches differs in Vista and Windows 7 from the traditional way used in Windows XP.After obtaining the correct files to be compared, the next step would be to get a binary differencebetween the files which can be done very easily and effectively with the use of a tool called DarunGrim.The tool provides a well illustrated difference between the subroutines in the term of percentage matchbetween them. Subroutines from both the files can be viewed in graph mode and can be compared tofind the vulnerability. The change in the code is done to fix that particular vulnerability which may beremoval of a piece of code and addition of another. Another problem arises at this point is that compileroptimizations happen every-time a code is compiled, so if both the files are compiled with differentcompilers or compiler versions, they would have different compiler optimizations and that would alsoshow up as a change in code. Simple Instruction reordering keeps happening over different releaseswhich give rise to another problem as when only the instructions are reordered, still it would show upas changed code. The code change in one of the functions out of several functions in the file beforeapplying the patch would be the vulnerable code. From here knowledge of the reverse engineer wouldcome into play as how effectively and fast he can find the vulnerability from the code shown as beingchanged from the previous file. Till now the process used was static analysis but from now onwardsdynamic analysis would be used as breakpoints could be set at these changed functions and run thesoftware. When a breakpoint is hit we can check in which of the functions is user input being dealt.Obtaining all this information can then be used to write an exploit.This process of reversing the patch and finding the details about the vulnerability would definitely helpin creating vulnerability signatures.Download:http://nullcon.net/nullcon2011presentation/harsimranwalia_nullcon.pdf Quote