background preloader

Self modifying code

Facebook Twitter

Writing Self-modifying Code Part 1: C Hello world with RWX and in-line assembly. To follow along with this tutorial, download all source files here In the first part of this tutorial, we’ll be making a basic C scaffold and getting read, write, and execute permissions for the memory section.

Writing Self-modifying Code Part 1: C Hello world with RWX and in-line assembly

This way we’ll be able to have some self-modifying code in the following tutorials (part 2 is located here). Writing Self-Modifying Code Part 2: Using extended assembly – Practice. Part 1 is here: All the code for this tutorial is on github.

Writing Self-Modifying Code Part 2: Using extended assembly – Practice

Links for particular components are interspersed, or you can just pull the repo. 120. Self Modifying Code: Changing Memory Protection. Self modifying code is a phrase used to describe programs that are able to change themselves.

Self Modifying Code: Changing Memory Protection

Using self modifying code can make it harder to reverse engineer a program, largely because the ‘actual code may differ from that shown’. That is, the actual code that ends up executing may be different from the code that is first shown during disassembly. Join me as I attempt to relive my youth and create some self modifying code, only this time it will have to work under the memory protection schemes implemented by the 80×86 processors and MS Windows. Linuxassembly.org - Using self modifying code under Linux. By Karsten Scheibler thanks to Stefan Esser and Maciej Hrebien Remark (a): Save this page as smc.html and use the following command to extract the source code with a sample Makefile: sh -c "( mkdir smc && cd smc && awk '/^<!

linuxassembly.org - Using self modifying code under Linux

--eof/{d=0}{if(d)print>f}/^<! --sof/{f=\$2;d=1}' ) < smc.html"