[Lugro-mesh] Lo que tiene le bicho dentro

Sebastián D. Criado lugro-mesh@lugro.org.ar
Tue, 26 Jun 2007 21:57:54 -0300


--nextPart1197562.WFj9FZziE3
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Bueno, luego de andar husmeando por los java script y los htm de configurac=
i=C3=B3n=20
del bicho, solo me quedaba ver donde era que mandaba las configuraciones pa=
ra=20
que se grabaran en el aparatejo.

El tema es el siguiente.

La web de configuraci=C3=B3n usa java script para casi todo.
Hab=C3=ADa muchos js que no se usaban para nada y otros htm que quedaron po=
r all=C3=AD=20
seguramente para pruebas y dem=C3=A1s.

(Ver el http://192.168.1.1/web_shell.htm. Ojo que solo funciona hasta que l=
e=20
erras a alg=C3=BAn comando, luego hay que resetear duro al bicho para que f=
unque=20
de nuevo) Lo pego aqu=C3=AD para que se entienda lo que estoy diciendo:

web_shell.htm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"=20
"http://www.w3.org/TR/html4/loose.dtd">=20
<html>=20
<head>=20
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8">=20
<title>Web Shell</title>=20
</head>=20
<script>=20
function ValidateForm(passForm)=20
{=20
=20
	passForm.data_cmd.value =3D document.forms[0].Data_cmd.value;=20
	passForm.submit();=20
}=20
function InitValue(passForm)=20
{=20
	=20
}=20
</script>=20
<body onload=3D"InitValue();">=20
<form name=3D"web_shell" action=3D"post.cgi" method=3D"post">=20
<input type=3D"hidden" name=3D"data_cmd" value=3D'<%web_shell("data_cmd");%=
>'>=20
<input type=3D"hidden" name=3D"cur_ipaddr" value=3D"<%nvram_get("lan_ipaddr=
");%>">=20
<input type=3D"hidden" name=3D"next_page" value=3D"web_shell.htm">=20
<input type=3D"hidden" name=3D"reboot" value=3D"0">=20
=20
<table width=3D"93%" height=3D"377"  border=3D"0">=20
  <tr>=20
    <td width=3D"80%" height=3D"59" scope=3D"col">=20
	<INPUT class=3Dnum maxLength=3D255 size=3D50 name=3DData_cmd>=20
	=20
	<input type=3D"button" value=3D"sent"=20
onClick=3D"ValidateForm(document.forms[0]);"></td>=20
    </tr>=20
  <tr>=20
    <td scope=3D"row">&nbsp;</td>=20
  </tr>=20
</table>=20
<textarea cols=3D"100" rows=3D"15" name=3D"PingRecord"><%web_shell("respons=
e");%>=20
	</textarea>=20
</form>=20
=20
</body>=20
=20
</html>=20


Para poder volcar las configuraciones, las p=C3=A1ginas usan document.form =
(es la=20
forma que java script tiene para poder usar los datos de un form htm como=20
parametro) y se lo mandaba a un post.cgi el cual, no existe.

<form name=3D"web_shell" action=3D"post.cgi" method=3D"post">=20


el cual es llamado por este INPUT:
<input type=3D"button" value=3D"sent"=20
onClick=3D"ValidateForm(document.forms[0]);"></td>

function ValidateForm(passForm)=20
{=20
=20
	passForm.data_cmd.value =3D document.forms[0].Data_cmd.value;=20
	passForm.submit();=20
}=20

Al diferencia de muchos otros htm dentro del aparato, esta p=C3=A1gina en e=
specia=20
no invoca al javafuntion.js el cual tiene muchas funciones para hacer=20
distintas cosas (ej, armar bien una IP o validar datos)

Entonces. =C2=BFA donde lo manda? y lo peor =C2=BFDonde est=C3=A1 el post.c=
gi que no consegu=C3=AD=20
por ning=C3=BAn lado?

Lo =C3=BAnico que quedaba era ver el binario del httpd.
En charla con Gus, el me dec=C3=ADa que all=C3=AD no podr=C3=ADa estas :D p=
ero miren lo que=20
encontre dentro:

^@^@post.cgi*^

Y sigue:
@^@^@marmot.cgi*^@delete_log.cgi*^@SaveCfgFile.cgi*^@^@^@^@
UploadCfgFile.cgi*^@^@refresh_client.cgi*^@connect_ddns.cgi*^@^@^@system_re=
start.cgi*^
@password.cgi*^@^@^@logout.cgi*^@parentalc.cgi*^@^@parentalc_config.cgi*^@^=
@^
@parental_unblock.cgi*^@^@^@parental_tproxy.cgi*^@^@^@^@wep_passphrase.cgi*^
@syslog_save.cgi*^@^@^@^@syslog_clean.cgi

Lo que me indica (no puedo debuguear) que los cgi est=C3=A1n compilados den=
tro del=20
httpd.
No solo encontre esto, si no tambi=C3=A9n muchos html enbebidos dentro del =
binario.

Ej: (si mir=C3=A1n al final podr=C3=A1n ver el dichoso nvram_commit que bus=
caba Gustavo)
</BODY>
^@^@http://%s:
%s/white_space.gif^@^@^@^@web_use_https^@^@^@https://%s/%s^@^@^@https://%s/=
white_space.gif^@^@http://%s/white_space.gif^@^@^@restart_w0_vlan0^@^@^@^@1=
92.168.1.1^@wiz_set^@top.menu_screen.flash();
^@^@^@window.opener.top.menu_screen.flash();
^@delstatic_route_ipaddr^@^@delstatic_route_netmask^@route del -net %s=20
netmask %s^@^@^@^@wl0_channel^@7^@^@^@traceroute %s > /var/tracert.txt=20
&^@^@PingNum^@Unlimited^@^@^@PingSize^@^@^@^@ping -f -c %d -s %d %s=20
&^@^@^@^@ping -f -c 1000 -s %d %s &^@^@%s > /tmp/web_shell.txt=20
&^@^@^@lan_dhcps_enabled^@^@^@killall udhcpd=20
&^@^@^@^@/bin/renew-wan.sh^@^@^@pppoe^@^@^@pptp^@^@^@^@Content-Disposition:=
^@^@^@^@name=3D"file"^@^M
^@^@/tmp/config.bin^@config.bin^@^@old_ip^@^@fw_version^@^@ae1_macaddr^@lan=
_macaddr^@3ComSN^@^@nvram_statut^@^@^@^@wireless_version^@^@^@^@bootload_ve=
rsion^@^@^@^@httpd_password^@^@httpd_username^@^@httpd_realm^@wan_mac^@cust=
omer_firmware_version^@^@^@my_fw_version^@^@^@hw_version^@^@lan_ifname^@^@l=
an_ifnames^@wl0_macaddr^@lan_mac^@eth1_macaddr^@^@^@^@eth0_macaddr^@^@^@^@w=
an_ifname^@^@nvram=20
commit^

Encotre tambi=C3=A9n con el tema del commit que hay comandos directamente=20
enebebidos:

Ej:
echo "nvram commit ; sleep 3 ; reboot"

Hasta est=C3=A1 enbebida la pagina para el parental control
http://filter.belkin.com/password.asp?SN=3D%s&PW=3D%s&FV=3D1.00.06


Y hasta cosas de otros fabricantes: :D (aja, robando a la competencia)
<head><title>Linksys Home Gateway Reference Design: Apply</title><
Que podr=C3=ADa ser de este bicho que se llama igual
http://www.ciao.co.uk/Linksys_Wireless_G_ADSL_Home_Gateway_WAG354G__6274614


Me parece que tenemos que ver con mayor detalle a este httpd si queremos sa=
ber=20
como guarda los datos el bicho. Eso si, no se s=C3=AD ser=C3=A1 muy util pa=
ra nuestros=20
propositos de dominaci=C3=B3n mundial :D

Saludos.-

=2D-=20
Sebasti=C3=A1n D. Criado - scriado{en}ciudad.com.ar
NO A LA MATRICULACI=C3=93N OBLIGATORIA - http://noalamatricula.wordpress.co=
m/about/
L.U.G.Ro - http://www.lugro.org.ar
GNU/Linux Registered User # 146768
=2D------------------------------------------------------------------
"Si el Universo fuera un programa estar=C3=ADa hecho en C, y correr=C3=ADa =
sobre
un sistema UNIX"
							An=C3=B3nimo.

--nextPart1197562.WFj9FZziE3
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBGgbYc8hmHQ8ZCg0IRAmSKAJ9c4vDo9gD40lh/X7FHYKZ259wjqQCgk8zO
t7aBjO0Iak4J4RDUN8r6rUk=
=n21k
-----END PGP SIGNATURE-----

--nextPart1197562.WFj9FZziE3--