News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

section header characteristics at compile time

Started by peterpants, November 27, 2011, 09:11:14 AM

Previous topic - Next topic

peterpants

good day asm masters, how can i change the code section characteristics or the .text section characteristics at compile time? i have a self-modifying code for protection against crackers, it overwrites the .text section with new code at run-time so i need to make the code section writable. currently i do that by using cff explorer and edit the characteristics field every time i test the code. i want the .text section to be read/write/executable after every compile so i dont have to edit it. how can i do that in masm32?  :boohoo:

Antariy

Specify this argument to the linker when you're building an EXE:

/SECTION:.text,rwe

zemtex

If anyone want to break your code they will probably succeed, but in order to defeat newbie olly users, you can apply a few tricks.

First eliminate all your strings, most newbies will try to locate code by using strings, remove the null terminator and make a customized subroutine to handle non-null terminated strings. After you have removed the null terminator, olly will still find strings, so perform rot13 on the string too so that no readable text can be found.

Another thing you can do is to mess up olly's way of listing system calls, you shouldn't make system calls directly, direct calls will be seen instantly in olly, instead you should find a ret instruction in a random system call, store the address of that, instruction. Then with multiple bit-operations, push the address of the real function you want to call, then jump to the random ret instruction inside of an api function, it will return to your function you want to execute. You have to push the address of the real function you want to execute and Olly will identify this constant that you push, so you should push 1 byte ahead, every function have this overhead of preparing the stack frame, do it manually so that you can jump a few bytes ahead of the function to avvoid detecting function adress constants.

Another thing you can do to really screw up the heads of an olly user, and if you don't care about speed in your program, make a sophisticated routine to make unneccesary bit manipulations to get the desired result you want for each register. Instead of doing mov eax, 10, you call a routine that will do sophisticated bit manipulations to get to that result, you basically write simulated instructions to move values between registers. The result in olly will be catastrophically annoying.

Another trick you can do is what I call the 'Terror of constants', olly will list one known system constant all over your program. Pick a random system constant, for example WM_PAINT, then make a function that will add or subtract the value needed to get the real constant you want to use at any given time, olly will list WM_PAINT constants all over your program.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

Farabi

You can call me a newbie cracker, and I used to stuck when facing kifastcallret.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"