1 730
Nim implementation of Process Hollowing using syscalls (for educational purposes)
https://github.com/snovvcrash/NimHollow
@reverseengine
27 نوامبر 2025, 16:32
int add(int a, int b) { return a + b; }اسم این تکنیک: Frame Omission Optimization Red zone Only on System V Linux/Mac, not Windows A space 128 bytes below the RSP that a function can use without changing the RSP Windows does not have a red zone Is a frame always created? No Cases where a Stack Frame is not created: The function is very simple Leaf Function If the function does not call any other function And does not use callee-saved registers And does not have any local variables The compiler will omit the Frame Example:
int add(int a, int b) { return a + b; }Name of this technique: Frame Omission Optimization
void f() { int a; int b; int c[10]; }کامپایلر ممکنه این فریم رو بسازه: |--------------------------| | return address | | previous RBP | |--------------------------| | a (4 bytes) | | b (4 bytes) | | padding (align) | | c[10] (40 bytes) | |--------------------------| Saved Registers رجیسترهایی که باید ذخیره بشن طبق ABI سه نوع register داریم: نوعنیاز به ذخیره توسط callee مثال caller-savedنهRAX, RCX, RDX callee-savedبلهRBX, RBP, R12-R15 specialبسته به شرایطRSP پس اگر تابعی مثل این باشه:
void foo() { int a; int b; // uses RBX }کامپایلر باید RBX رو هم داخل فریم ذخیره کنه چون callee-saved هست Spill slots وقتی رجیستر کم میاد اگر تعداد متغیرها زیاد بشه رجیستر کم میاد و کامپایلر مجبور میشه بعضی مقدار ها رو داخل استک بریزه مثلا:
void f(int a, int b, int c, int d, int e, int f) { .... }برای اینا رجیستر کم میاد میرن spill slot روی استک Temporary space فضاهای موقت کامپایلر برای کارهایی مثل call هایی که پارامتر زیاد دارن حافظه موقت روی استک میسازه مثال:
printf("%d %d %d %d", a, b, c, d);ممکنه کامپایلر موقت همه رو داخل استک بچینه Locals Every local variable is placed in a stack frame For example, in C:
void f() { int a; int b; int c[10]; }The compiler may create this frame: |--------------------------| | return address | | previous RBP | |---------------------| | a (4 bytes) | | b (4 bytes) | | padding (align) | | c[10] (40 bytes) | |---------------------| Saved Registers Registers that need to be saved According to the ABI, we have three types of registers: Types that need to be saved by the callee Example caller-saved No RAX, RCX, RDX callee-saved Yes RBX, RBP, R12-R15 special Depending on the RSP conditions So if a function is like this:
void foo() { int a; int b; // uses RBX }The compiler must also store RBX in the frame because it is callee-saved Spill slots when the register runs out If the number of variables increases, the register runs out and the compiler is forced to push some values onto the stack For example:
void f(int a, int b, int c, int d, int e, int f) { .... }For this, the register runs out They go to the spill slot on the stack Temporary space Temporary spaces The compiler creates temporary memory on the stack for tasks such as calls that have many parameters For example:
printf("%d %d %d %d", a, b, c, d);The compiler may temporarily push everything onto the stack @reverseengine
# Host A
ft.exe -L 5000:127.0.0.1:3389 --write "\\server\share\1.dat" --read "\\server\share\2.dat"
# Host B
ft.exe --read "\\server\share\1.dat" --write "\\server\share\2.dat"
Tunnel TCP through RDP:
# Host A
ft.exe -L 5000:192.168.1.50:8888 --write "C:\Temp\1.dat" --read "C:\Temp\2.dat"
# Host B
ft.exe --read "\\tsclient\c\Temp\1.dat" --write "\\tsclient\c\Temp\2.dat"
@reverseengine
ما از کوکیها برای بهبود تجربه مرور شما استفاده میکنیم.
با کلیک روی «همگی را قبول میکنم»، با سیاست استفاده از کوکیها موافقت میکنید.