-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[+] Added: TLS by default, a self signed cert has added. If one is NOT Specified this one will be used. A X509Certificate2 can be passed via the PSSocksServer.CreateSocksController Method [+] Fixed: Domain Fronting now works as expected, corrected a bug which meant that the payload wasn't being sent correctly for the fronted host [+] Fixed: Authenticated Proxy out via the implant should now work correctly
- Loading branch information
Showing
24 changed files
with
905 additions
and
136 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
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
Binaries/SharpSocksImplantTestApp/SharpSocksImplantTestApp.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-512 Bytes
(95%)
Binaries/SharpSocksServerTestApp/SharpSocksServerTestApp.exe
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
...ocksImplant/ImplantSide/Classes/Common/Encryption/SimpleEncryptor/DebugSimpleEncryptor.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,87 @@ | ||
using Common.Classes.Encryption; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
|
||
namespace Common.Encryption.SimpleEncryptor | ||
{ | ||
|
||
/// <summary> | ||
/// This is a simple encryptor | ||
/// </summary> | ||
public class DebugSimpleEncryptor : IEncryptionHelper | ||
{ | ||
List<byte> _key = new List<byte>(); | ||
|
||
public DebugSimpleEncryptor(String base64Key) | ||
{ | ||
byte[] key = Convert.FromBase64String(base64Key); | ||
System.Security.Cryptography.ProtectedMemory.Protect(key, System.Security.Cryptography.MemoryProtectionScope.SameProcess); | ||
_key.AddRange(key); | ||
Array.Clear(key, 0, key.Length); | ||
} | ||
|
||
public DebugSimpleEncryptor(SecureString base64Key) | ||
{ | ||
IntPtr valuePtr = IntPtr.Zero; | ||
try | ||
{ | ||
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(base64Key); | ||
var key = Convert.FromBase64String(Marshal.PtrToStringUni(valuePtr)); | ||
System.Security.Cryptography.ProtectedMemory.Protect(key, System.Security.Cryptography.MemoryProtectionScope.SameProcess); | ||
_key.AddRange(key); | ||
Array.Clear(key, 0, key.Length); | ||
} | ||
finally | ||
{ | ||
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr); | ||
} | ||
} | ||
|
||
public List<byte> Decrypt(string encodedEncPayload) | ||
{ | ||
var ciphrBytes = Convert.FromBase64String(encodedEncPayload).ToList(); | ||
using (var aes = new System.Security.Cryptography.RijndaelManaged()) | ||
{ | ||
aes.Mode = System.Security.Cryptography.CipherMode.CBC; | ||
aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7; | ||
aes.IV = ciphrBytes.Take(16).ToArray(); | ||
var key = _key.ToArray(); | ||
System.Security.Cryptography.ProtectedMemory.Unprotect(key, System.Security.Cryptography.MemoryProtectionScope.SameProcess); | ||
aes.Key = key; | ||
var dec = aes.CreateDecryptor(); | ||
var encBytes = ciphrBytes.Skip(16).ToArray(); | ||
var plainbytes = dec.TransformFinalBlock(encBytes, 0, encBytes.Length).ToList(); | ||
Array.Clear(key, 0, key.Length); | ||
return plainbytes; | ||
} | ||
} | ||
|
||
public string Encrypt(List<byte> payload) | ||
{ | ||
using (var aes = new System.Security.Cryptography.RijndaelManaged()) | ||
{ | ||
var result = new List<byte>(); | ||
aes.Mode = System.Security.Cryptography.CipherMode.CBC; | ||
aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7; | ||
aes.GenerateIV(); | ||
var key = _key.ToArray(); | ||
System.Security.Cryptography.ProtectedMemory.Unprotect(key, System.Security.Cryptography.MemoryProtectionScope.SameProcess); | ||
aes.Key = key; | ||
var enc = aes.CreateEncryptor(); | ||
result.AddRange(aes.IV); | ||
result.AddRange(enc.TransformFinalBlock(payload.ToArray(), 0, payload.Count)); | ||
Array.Clear(key, 0, key.Length); | ||
return System.Convert.ToBase64String(result.ToArray()); | ||
} | ||
} | ||
|
||
public string Initialize() | ||
{ | ||
//NO WORK TO DO IN THIS VERSION | ||
return "USING DEBUG SIMPLE ENCRYPTOR"; | ||
} | ||
} | ||
} |
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
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
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.