How to enter code into an executable process using C / C ++

I am looking for tips on how to manipulate functions by injecting code directly into memory at runtime. The goal is to ultimately launch the launch of an external application that can control running processes for optimization purposes. So far, I have gone the way of using GDB for memory management, following this guide:

http://www.codeproject.com/Articles/33340/Code-Injection-into-Running-Linux-Application?fid=1534990&df=90&mpp=10&sort=Position&spc=Relaxed&tid=4678205

However, it is quite outdated now, and I cannot get it to work on 64-bit architecture ... I would appreciate any advice on this topic. Greetings

+4
source share
1 answer

To make this possible, there are huge security vulnerabilities, which is why it is strictly prohibited in any reasonable environment. Newer Linux in particular (and much more on x86_64) strictly separates executable memory areas from mutable areas. In addition, modern processors do not voluntarily respond to code changes outside their caches, etc. Perhaps the next will be the dynamic loading of shared libraries.

This type of operation is part of the work of most scripting languages ​​such as Perl or Python.

-5
source

Source: https://habr.com/ru/post/1524283/


All Articles