DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-05-19 21:53:58

dwreynoldsjr
New member
Registered: 2008-05-19
Posts: 3

Disabling the DNS-323 webs http server completely?

I have access to my DNS-323 via SSH login and would like to tighten up security on the device by shutting down the normal DNS-323 webs interface.  If I need to reconfigure the device, I'd like to then be able to restart the webs interface from my SSH session and then shut it down agains when I'm through.

Anyone have any ideas?  I can kill the webs services, but they just seem to restart themselves after awhile.

Thanks in advance for any tips.

Offline

 

#2 2008-05-19 22:22:51

abubin
Member
Registered: 2007-11-01
Posts: 59

Re: Disabling the DNS-323 webs http server completely?

well, another way you can do is to close port 80 into your dns323. That way nobody will be able to access into this webserver. When you want to use it, open back port 80. Even better method is to use port forwarding, create a port like 12345 to forward to port 80 into your dns323. That way only you know the port number and able to access it.

Most basic modem/router is able to do this.

Offline

 

#3 2008-05-19 23:46:35

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: Disabling the DNS-323 webs http server completely?

Easy, just kill the /web/webs program.  If you want it on again, just start it.  You could even write a simple script to do this and have a start / stop command after it.

EDIT - Note: Don't forget to chroot it when you want to start it up, or it will stop as soon as you close your telnet session.

Code:

chroot / /web/webs

Last edited by bq041 (2008-05-19 23:55:39)


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#4 2008-05-20 15:21:35

dwreynoldsjr
New member
Registered: 2008-05-19
Posts: 3

Re: Disabling the DNS-323 webs http server completely?

For clarification, I want to disable the DNS-323 webs http server on my internal network (i.e. inside my router/firewall).  So, manipulation of my router and port forwarding won't solve my problem.

Also, it seems that every time I stop the /webs/webs service it restarts itself within a few minutes.  Is there a special way to shutdown this service so it won't restart itself.  I read somewhere else in the forum that D-Link may have some kind of "watchdog" service looking to see if the /webs/webs service is running and if not it starts it again.

Offline

 

#5 2008-05-20 15:38:09

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Disabling the DNS-323 webs http server completely?

Maybe it helps to kill webs, and instead start a dummy program of the same name that does nothing but sleep.

Offline

 

#6 2008-05-20 15:38:13

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Disabling the DNS-323 webs http server completely?

jayas had done something like this in an attempt to improve security in a school environment. maybe he could shed some light

http://dns323.kood.org/forum/t1524-Auto … -sort.html

Offline

 

#7 2008-05-20 18:47:20

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: Disabling the DNS-323 webs http server completely?

I think? the /usr/sbin/chkbutton process is responsible for being
the web server (webs) watchdog

Code:

/ # strings /usr/sbin/chkbutton | grep webs
kill -9 `pidof webs`
touch /tmp/webs-reload
/web/webs&
ps | grep /web/webs > /tmp/web_chk
webs re-execute
/web/webs &

DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

#8 2008-05-26 17:57:48

dwreynoldsjr
New member
Registered: 2008-05-19
Posts: 3

Re: Disabling the DNS-323 webs http server completely?

Another possible solution from jayas:

"If you do a "ls -l /web", you will see that /web/web and /web/webs are links to respective files in crfs.  You can use fun_plug to link these to something else, say /tmp so that after you kill webs, even if it gets restarted, it will not find it."

Offline

 

#9 2008-05-27 01:36:56

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: Disabling the DNS-323 webs http server completely?

web interface on this device should be rewriten from scratch. its just so unsecure.
i would recommend everyone to turn this off and turn it on just when needed...


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#10 2008-05-27 02:17:02

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Disabling the DNS-323 webs http server completely?

I think we've known for awhile that the web interface is insecure - however, and I know that not everyone agrees with me - given the intended SOHO usage of the device, I don't see it as being such a problem.

Offline

 

#11 2008-12-04 20:31:28

alpha
Member
From: Lithuania
Registered: 2008-10-06
Posts: 88

Re: Disabling the DNS-323 webs http server completely?

So what's the final solution of total killing webs ? I've searched the forum and found some solutions, but don't know which works correctly. I need totally kill of webs process with option sometime enable it.

Offline

 

#12 2008-12-04 21:41:45

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: Disabling the DNS-323 webs http server completely?

Code:

#!/ffp/bin/sh

# PROVIDE: kickwebs
# REQUIRE: LOGIN

#if [ -z ${MAIL} ]; then
#    #setup the ENV variables if not found
#    #this can happen when running from crontab
#    echo "Environment variables not found, including fun_plug defaults."
#    . /ffp/etc/profile
#fi

. /ffp/etc/ffp.subr

name="kickwebs"
start_cmd="kickwebs_start"
#stop_cmd="kickwebs_stop"
status_cmd="kickwebs_status"
original_link=/sys/crfs/web/webs
new_link=/dev/null

kickwebs_start()
{
    echo -n "Kicking webs ..."
    killall webs
    ln -sf $new_link /web/webs
    echo "done."
}

kickwebs_stop()
{
    if [ `kickwebs_temp_status` = "running" ]; then
        echo "INFO: webs already running! Nothing to do."
        exit 1
    fi
    echo -n "Starting webs ..."
    ln -sf $original_link /web/webs
    #/web/webs&
    echo "done."
}

kickwebs_status()
{
    if [ -n "$(pidof webs)" ]; then
        echo "webs running."
    else
        echo "webs stopped."
    fi
}

kickwebs_temp_status()
{
        if [ -n "$(pidof webs)" ]; then
                echo "running"
        else
                echo "stopped"
        fi
}

case "$2" in
    webs)
        if [ "$1" == "stop" ]; then
            kickwebs_stop
        fi
    ;;
    *)
        run_rc_command "$1"
    ;;
esac

# ./kickwebs start
will kill webs and it will not run again

# ./kickwebs stop
will run webs again

having this script +x in /ffp/start direcotry will kick webs on every boot.

Last edited by SilentException (2008-12-04 21:42:04)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#13 2008-12-04 23:05:37

alpha
Member
From: Lithuania
Registered: 2008-10-06
Posts: 88

Re: Disabling the DNS-323 webs http server completely?

Hello,

Thank you for super nice script. I didn't mention that I want to kill webs (config interface of DNS323), but not to kill lighttpd. So I added one line:


SilentException wrote:

Code:

#!/ffp/bin/sh

# PROVIDE: kickwebs
# REQUIRE: LOGIN
# BEFORE: lighttpd
^^^^^^^^^^^^^^
........

and it seems like everything is working just fine. Thank you very very much !

alpha

Offline

 

#14 2008-12-05 19:15:45

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Disabling the DNS-323 webs http server completely?

SilentException wrote:

Code:

#!/ffp/bin/sh

kickwebs_start()
{
    echo -n "Kicking webs ..."
    killall webs
    ln -sf $new_link /web/webs
    echo "done."
}

Would it be better to create the link *before* killing the webs processes to avoid the (theoretical?) race condition of the dns-323 restarting webs before you make the null link?

Offline

 

#15 2008-12-05 19:17:05

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Disabling the DNS-323 webs http server completely?

alpha wrote:

Hello,

Thank you for super nice script. I didn't mention that I want to kill webs (config interface of DNS323), but not to kill lighttpd. So I added one line:


SilentException wrote:

Code:

#!/ffp/bin/sh

# PROVIDE: kickwebs
# REQUIRE: LOGIN
# BEFORE: lighttpd
^^^^^^^^^^^^^^
........

and it seems like everything is working just fine. Thank you very very much !

alpha

I'm not sure I understand why this has to happen before lighttpd. Do you need to kill webs before lighttpd starts because of a port or resource conflict?

Offline

 

#16 2008-12-05 19:33:22

alpha
Member
From: Lithuania
Registered: 2008-10-06
Posts: 88

Re: Disabling the DNS-323 webs http server completely?

Hello,

puterboy wrote:

I'm not sure I understand why this has to happen before lighttpd. Do you need to kill webs before lighttpd starts because of a port or resource conflict?

I kill webs before lighttpd just because lighttpd won't start after this script. You need manually start lighttpd OR write some line of starting lighttpd in this given script. If I run this script without "#BEFORE lighttpd" directive I have no lighttpd server started automatically.

Regards,
alpha

Offline

 

#17 2008-12-05 19:41:04

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Disabling the DNS-323 webs http server completely?

OK. But not clear to me why that is the case though.

Offline

 

#18 2008-12-06 19:03:09

oxygen
Member
Registered: 2008-03-01
Posts: 320
Website

Re: Disabling the DNS-323 webs http server completely?

Because the port 80 is in use by webs, lighttpd fails to start.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB