Optware vs default dd-wrt security?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2
Author Message
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Tue May 17, 2011 20:26    Post subject: Reply with quote
Quote:
addition of an INVALID drop

I've told you in PM's that there's many reports on the net about false matches causing valid traffic to be dropped too. Users need to watch out for problems with it, although I do think it should be a GUI option defaulted off at first.

Quote:
ping flood protection
bruteforce attack protection to port 20,21,22,23,3389, 5900 ('recent' method)

All ICMP is blocked on the WAN by default so it only matters if you want to allow ICMP. My patch fixes the GUI options for SSH and Telnet bruteforce protection to use -m recent and also makes DD-WRT always have a logbrute chain in iptables for people to easily add it for any other ports they want to secure.

Quote:
asiablock - lock out south-east asia (notorious spammers)
worldblock - lock out all foreign countries
birmablock - lock out abusers with additional script

Dirty blacklisting that can block good users and should only be used with care.

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
Sponsor
Masterman
DD-WRT Guru


Joined: 24 Aug 2009
Posts: 2070
Location: South Florida

PostPosted: Wed May 18, 2011 15:26    Post subject: Reply with quote
phuzi0n wrote:
Quote:
addition of an INVALID drop

I've told you in PM's that there's many reports on the net about false matches causing valid traffic to be dropped too. Users need to watch out for problems with it, although I do think it should be a GUI option defaulted off at first.

Quote:
ping flood protection
bruteforce attack protection to port 20,21,22,23,3389, 5900 ('recent' method)

All ICMP is blocked on the WAN by default so it only matters if you want to allow ICMP. My patch fixes the GUI options for SSH and Telnet bruteforce protection to use -m recent and also makes DD-WRT always have a logbrute chain in iptables for people to easily add it for any other ports they want to secure.

Quote:
asiablock - lock out south-east asia (notorious spammers)
worldblock - lock out all foreign countries
birmablock - lock out abusers with additional script

Dirty blacklisting that can block good users and should only be used with care.


The INVALID rule is implemented by default in both Tomato and Open-WRT firewalls. Furthermore, the Policy is set to DROP by default (at least in Tomato) not ACCEPT. I believe this to be a better practice. If you can explain to me otherwise, I'd like to know..

http://www.cipherdyne.org/LinuxFirewalls/ch01/


As far as the ping flood detection, it's used somewhat differently than the default DD-WRT policy for other OTRW services (e.g stophammer) :

Code:
 # Create a ratelimiter for PING
            echo "pos=\`iptables --line-numbers -nvL INPUT | grep icmp | grep $wanf | grep ACCEPT | grep -v limit | head -n1 | awk '{print \$1}'\`" >>${FILE}
            echo "if [ ! -z \"\$pos\" ] ; then"  >>${FILE}
            echo "  iptables -D INPUT \$pos"  >>${FILE}
            echo "  iptables -I INPUT \$pos -p icmp -i $wanf -j DROP"  >>${FILE}
            echo "  iptables -I INPUT \$pos -p icmp -i $wanf -m limit --limit  1/s --limit-burst 1 -j ACCEPT"  >>${FILE}
            echo "fi" >>${FILE}



I agree with the idea of a logbrute chain, as well as a *cough* upnp chain, and it does need to be fixed (counters not working):

Code:
Chain logbrute (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0            0    --  *      *       0.0.0.0/0            0.0.0.0/0           recent: SET name: BRUTEFORCE side: source
    0     0 RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0           !recent: UPDATE seconds: 60 hit_count: 4 name: BRUTEFORCE side: source
    0     0 RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/min burst 1
    0     0 LOG        0    --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 6 level 4 prefix `[DROP BRUTEFORCE] : '
    0     0 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0



Code:
root@AsusTek:~# grep BRUTE /opt/var/log/messages
May 11 22:20:50 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=69.36.233.38 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=51 ID=55937 DF PROTO=TCP SPT=55332 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 11 22:20:53 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=69.36.233.38 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=51 ID=55939 DF PROTO=TCP SPT=55332 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 11 22:20:59 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=69.36.233.38 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=51 ID=55941 DF PROTO=TCP SPT=55332 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 04:07:27 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=94.76.222.178 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=2526 DF PROTO=TCP SPT=51923 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 04:07:30 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=94.76.222.178 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=2527 DF PROTO=TCP SPT=51923 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 04:07:36 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=94.76.222.178 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=47 ID=2528 DF PROTO=TCP SPT=51923 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 15:35:12 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=64.120.15.45 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=54 ID=20984 DF PROTO=TCP SPT=45321 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 15:35:15 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=64.120.15.45 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=54 ID=20985 DF PROTO=TCP SPT=45321 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 12 15:35:21 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=64.120.15.45 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=54 ID=20986 DF PROTO=TCP SPT=45321 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=
May 13 10:45:08 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:38 SRC=208.124.205.166 DST=192.168.1.1 LEN=56 TOS=0x00 PREC=0x00 TTL=50 ID=48899 DF PROTO=TCP SPT=56322 DPT=22 WINDOW=5840 RES=0x00 SYN UR
May 13 10:45:11 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:38 SRC=208.124.205.166 DST=192.168.1.1 LEN=56 TOS=0x00 PREC=0x00 TTL=50 ID=48900 DF PROTO=TCP SPT=56322 DPT=22 WINDOW=5840 RES=0x00 SYN UR
May 13 10:45:17 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:38 SRC=208.124.205.166 DST=192.168.1.1 LEN=56 TOS=0x00 PREC=0x00 TTL=50 ID=48901 DF PROTO=TCP SPT=56322 DPT=22 WINDOW=5840 RES=0x00 SYN UR
May 13 10:57:24 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=201.210.234.56 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=46 ID=9674 DF PROTO=TCP SPT=35084 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 13 10:57:27 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=201.210.234.56 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=46 ID=9675 DF PROTO=TCP SPT=35084 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 13 10:57:33 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=201.210.234.56 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=46 ID=9676 DF PROTO=TCP SPT=35084 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 15 10:53:12 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=95.170.67.140 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=47 ID=47383 DF PROTO=TCP SPT=47270 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 15 10:53:15 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=95.170.67.140 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=47 ID=47384 DF PROTO=TCP SPT=47270 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 15 10:53:21 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=95.170.67.140 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=47 ID=47385 DF PROTO=TCP SPT=47270 DPT=22 WINDOW=5840 RES=0x00 SYN URGP
May 16 10:36:06 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT=br0 SRC=213.163.230.4 DST=192.168.1.4 LEN=60 TOS=0x00 PREC=0x00 TTL=44 ID=51262 DF PROTO=TCP SPT=48616 DPT=21 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B40402080A11F91EBB0000000001030307)
May 16 10:36:09 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT=br0 SRC=213.163.230.4 DST=192.168.1.4 LEN=60 TOS=0x00 PREC=0x00 TTL=44 ID=51263 DF PROTO=TCP SPT=48616 DPT=21 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B40402080A11F92A730000000001030307)
May 16 16:40:05 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=200.189.130.170 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=27854 DF PROTO=TCP SPT=53348 DPT=22 WINDOW=5840 RES=0x00 SYN UR
May 16 16:40:08 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=200.189.130.170 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=27855 DF PROTO=TCP SPT=53348 DPT=22 WINDOW=5840 RES=0x00 SYN UR
May 16 16:40:14 AsusTek user.warn kernel: [DROP BRUTEFORCE] : IN=vlan2 OUT= MAC=00:26:18:85:25:c9:00:01:5c:24:75:81:08:00:45:00:00:3c SRC=200.189.130.170 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=27856 DF PROTO=TCP SPT=53348 DPT=22 WINDOW=5840 RES=0x00 SYN UR
root@AsusTek:~#



Frater's chain is somewhat different:

Code:
Chain bruteprotect (3 references)
 pkts bytes target     prot opt in     out     source               destination
    5   248            0    --  *      *       0.0.0.0/0            0.0.0.0/0           recent: SET name: BRUTEFORCE side: source
    5   248 RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0           !recent: UPDATE seconds: 60 hit_count: 4 name: BRUTEFORCE side: source
    0     0 LOG        0    --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 6 level 4 prefix `[DROP BRUTEFORCE] : '
    0     0 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0

_________________
Optware, the Right Way
Asus RT-AC68U
Asus RT-N66U
Asus RT-N10
Asus RT-N12
Asus RT-N16 x5
Asus WL520gU
Engenious ECB350
Linksys WRT600Nv1.1
Linksys WRT610Nv1
Linksys E2000
Netgear WNDR3300
SonicWall NSA220W
SonicWall TZ215W
SonicWall TZ205W
SonicWall TZ105W
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Wed May 18, 2011 19:54    Post subject: Reply with quote
phuzi0n wrote:
Quote:
addition of an INVALID drop

I've told you in PM's that there's many reports on the net about false matches causing valid traffic to be dropped too. Users need to watch out for problems with it, although I do think it should be a GUI option defaulted off at first.



INVALID DROP is more a performance feature. All subsequent rules are with a NEW and wouldn't match anyhow. Having an IN VALID DROP just make subsequent rules easier to add because you don't have to test its state anymore.

Some dual-wan routers send some packets mid-stream over another wan-interface. These packets will get dropped by the endpoint anyhow. It's just part of sanity checking.

Your patch, just like mine, is just a patch.I would love to see it in the firmware itself and make my set of patches become obsolete. 'fixtables' is not the holy grail although some propagate it a such with the best intentions.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Wed May 18, 2011 20:24    Post subject: Reply with quote
Masterman wrote:
The INVALID rule is implemented by default in both Tomato and Open-WRT firewalls. Furthermore, the Policy is set to DROP by default (at least in Tomato) not ACCEPT. I believe this to be a better practice. If you can explain to me otherwise, I'd like to know..

http://www.cipherdyne.org/LinuxFirewalls/ch01/

I already said that I agree that it should be implemented, it's just a big change that needs to be tested slowly before potentially causing huge headaches. From the man page itself:
Quote:
Possible states are INVALID meaning that the packet could not be identified for some reason which includes running out of memory and ICMP errors which don't correspond to any known connection

And a couple examples of people having trouble because of it (more examples are not hard to find with google):
http://www.webmasterworld.com/forum40/1642.htm
http://forum.mandriva.com/en/viewtopic.php?t=42953

Masterman wrote:
I agree with the idea of a logbrute chain, as well as a *cough* upnp chain, and it does need to be fixed (counters not working):

Chain logbrute (0 references)
pkts bytes target prot opt in out source destination
0 0 0 -- * * 0.0.0.0/0 0.0.0.0/0 recent: SET name: BRUTEFORCE side: source
0 0 RETURN 0 -- * * 0.0.0.0/0 0.0.0.0/0 !recent: UPDATE seconds: 60 hit_count: 4 name: BRUTEFORCE side: source
0 0 RETURN 0 -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 1/min burst 1
0 0 LOG 0 -- * * 0.0.0.0/0 0.0.0.0/0 LOG flags 6 level 4 prefix `[DROP BRUTEFORCE] : '
0 0 DROP 0 -- * * 0.0.0.0/0 0.0.0.0/0

There's nothing wrong with the counters, you don't have any rules referencing the chain so no traffic is going to it. You need to use the GUI options for bruteforce protection or jump to the logbrute chain with your own rules to use it.

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Wed May 18, 2011 20:27    Post subject: Reply with quote
frater wrote:
Your patch, just like mine, is just a patch.I would love to see it in the firmware itself and make my set of patches become obsolete. 'fixtables' is not the holy grail although some propagate it a such with the best intentions.

No, my patch is a patch that landed already and is in the firmware!

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum