0rp
March 6th, 2004, 23:44
http://msdn.microsoft.com/security/productinfo/XPSP2/memoryprotection/execprotection.aspx
will it harm "inplace" decrypting executables ?
will it harm "inplace" decrypting executables ?
View Full Version : what about XPSP2 "Execution Protection"
[Originally Posted by 0rp]http://msdn.microsoft.com/security/productinfo/XPSP2/memoryprotection/execprotection.aspx will it harm "inplace" decrypting executables ? |
[Originally Posted by mmk] With the NX bit (which is only present in some of the newest x86 CPUs, such as AMD x86-64 and future Intel processors) you could do as sgdt just said and call VirtualProtect() to make the stack executable again. |
[Originally Posted by SiNTAX]Anyway the problem will be calling VirtualProtect(). It will be a tad more difficult, as you can't directly execute your own code anymore, so you need to push the right params on the stack (VirtualProtect() address + it's params + return to the stack location + your code). |
[Originally Posted by mmk]Without the cookie protection, it's very easy to call any function with any argument. original stack in vulnerable func: [locals and saved regs] [ret addr] [args] [callee's local data] after stack based buffer overflow: #1 [locals and saved regs, most likely destroyed now] #2 [address of newfunc] #3 [args] #4 [addr of destaddr which will branch to your shellcode] #5 [input to newfunc; you control this data] When the function returns, it will execute a RET X instruction, which will return to newfunc and remove the input arguments ([args]) from the stack. ESP is now set to #4. When newfunc returns, it will return to destaddr and remove arguments (#5) from the stack. Replace newfunc with VirtualProtect and #5 with VirtualProtect arguments to make the stack executable, and you have an exploit to hack into any computer with that vulnerable software. |
you have to know which version of windows you are targetting as you need to know the exact address of VirtualProtect() |
[Originally Posted by mmk]Using hardcoded addresses for stack based buffer overflows is something exploit writers have always used. You only get one chance with all stack based buffer overflow exploits. Use the wrong return address and you get a lame DoS instead of complete control of the remote system. |
[Originally Posted by mmk]Of course you can make it work on any Windows version. The problem is finding a return address which can be used on all Windows versions. That's usually not possible so you have to scan the remote host and figure out the OS it's using, and then modify the exploit to work with that OS and Service Pack. |
[Originally Posted by mmk]To execute your stack overflow exploit code you must use at least one hardcoded address in the app or a DLL used by it which will jump to your code. |