我在Windows中使用CreateRemoteThread ,想知道在Linux中是否可以使用同样的东西。 有没有可能在Linux中做到这一点?
在Linux上这样做的传统方法是创建一个动态库(.so),其中包含代码,然后分别强制加载库到正在运行的应用程序中。 与Windows上的CreateRemoteThread
一样,没有一站式商店。
所以这里是基本的步骤:
ptrace
来运行在第2步中写入的二进制有效载荷,这将触发目标应用程序在步骤1中创建的.so上调用_dl_open()
,其中包含您希望运行的实际代码。 (在同一链接中给出样本,第2部分) 如果您需要将代码运行在主泵的单独线程中,则应在步骤1中的代码中使用pthread_create
。
希望这回答你的问题。 是的,它比在Windows上涉及更多; 但它应该同样工作。 此外,您可以重复使用第2步和第3步中的所有代码,以用于将来的远程代码注入项目。
`#include pthread.h
int pthread_create(pthread_t * thread,const pthread_attr_t * attr,void *(* start_routine)(void *),void * arg);`编译并链接到-pthread。
详情请参阅man pthread_create