Microsoft ASP Code Analyzer for SQL Injection - Postet den (4877 Views)
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
Haven't really tested it, but it's interesting nonetheless:

http://support.microsoft.com/kb/954476<
   
 Sidestørrelse 
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
looks pretty good, I tried it against a file I knew was vunerable and it found the problem.

I then ran it against the base forum files which were ALL ok<
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
Yeah, it may help with the recent batch of SQL Injection attacks. The info about the forum files is reassuring, even more so because it confirms my own findings on the 2 or 3 times I ran a manual analysis smile.<
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
I haven't had a chance to read the directions in-depth, but it looks like it only checks one page at a time. Did you guys set up a batch file or some other automation script to run it through all the files?<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
no, I did it by hand smile you don't need to do the inc_xxxxx files as it does that for you<
Postet den
Support Moderator
Podge
Innlegg: 3776
3776
Bummer. I just have dotnet 1.1 at work. Have to wait until I get home to try it.<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
it is definately the best one I have tried so far, the last ones I tried were worse than useless.<
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
Looks like they posted some VBScript to run through a directory - from http://blogs.msdn.com/sqlsecurity/archive/2008/06/27/getting-started-with-microsoft-source-code-analyzer-for-sql-injection.aspx

Code:
ON ERROR RESUME NEXT



If WScript.Arguments.Count = 0 Then

WScript.Echo "Usage: " + WScript.ScriptName + " sourcedirectory"

WScript.Quit(0)

End If



ProcessFolder WScript.Arguments(0)



Sub ProcessFolder(ByVal folderspec)

Dim fso, f, f1, fc, s, sf

Dim strInputFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.GetFolder(folderspec)

Set fc = f.Files



For Each f1 in fc

If StrComp(LCase(Mid (f1,Len(f1)-3,4)), ".asp") = 0 Then



strInputFile = f1.Path 'f.Path + "\" + f1

ASPScan (strInputFile)

End If

Next



Set sf = f.SubFolders

For Each f2 in sf

ProcessFolder f2.Path

Next

End Sub



Sub ASPScan (ByVal strInputFile)

ON ERROR RESUME NEXT

Err.Clear



Dim WshShell, oExec

Dim strCommand

Dim sTime, strBinary



GenerateSQLInjectionFile = true

Set WshShell = CreateObject("WScript.Shell")



strBinary = GetShortFolderName (GetScriptPath()) + "\" + GetShortFileName ("msscasi_asp.exe")

strCommand = "cmd.exe /c " + strBinary + " /input=""" + strInputFile + """ /Nologo >>" + GetShortFolderName (GetScriptPath()) + "\output.txt"



Set oExec = WshShell.Exec(strCommand)



sTime = Now

Do While (oExec.Status = 0)

WScript.Sleep 1000

Loop



Set oExec = Nothing

Set WshShell = Nothing

End Sub



Function GetScriptPath ()

Dim strPath

strPath = WScript.ScriptFullName

strPath = Mid (strPath, 1, InstrRev(strPath,"\")-1)

GetScriptPath = strPath

End Function



Function GetShortFolderName(ByVal filespec)

Dim fso, f, s

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.GetFolder(filespec)

GetShortFolderName = f.ShortPath

End Function



Function GetShortFileName(ByVal filespec)

Dim fso, f, s

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.GetFile(filespec)

GetShortFileName = f.ShortName

End Function


Create a VBScript file (.vbs) with the above content, place it in the folder where the tool is located and execute the script providing absolute path of the folder containing ASP code. The script will generate the file output.txt with the concatenated tool output in the folder where the tool and script files are located. Please modify the script according to your needs, for example, if your ASP code uses virtual file includes or if you have a global.asa then you will need to pass /IncludePaths and /GlobalAsaPaths parameters to the tool in ASPScan function.
<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
cool, although it didn't take very long to run through the forum files by hand, without the inc_xxxxx files and the admin files there are only about 30 files that need testing<
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
This tool and Microsoft's support for it are looking pretty good. This can really make a difference in protecting ASP files against SQL Injection.<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
yes, seems to work spot on too.<
Du må legge inn en melding