Results 1 to 15 of 16

Thread: Bad forwarding rules at the firewall

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2005
    Location
    Madrid
    Posts
    31

    Exclamation Bad forwarding rules at the firewall

    I'm pretty sure that the firewall FORWARD'ing rules are incorrect. Near top, the rule 4 allows any connection, given that don't exceed the 1/connection per seccond rate:

    Code:
    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    num   pkts bytes target     prot opt in     out     source               destination
    1        0     0 ACCEPT     all  --  br0    br0     0.0.0.0/0            0.0.0.0/0
    2        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0          state INVALID
    3        0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0          state RELATED,ESTABLISHED
    4       14   672 ACCEPT     tcp  --  vlan1  *       0.0.0.0/0            0.0.0.0/0          tcp flags:0x16/0x02 limit: avg 1/sec burst 5
    5        0     0 ACCEPT     tcp  --  vlan1  *       0.0.0.0/0            0.0.0.0/0          tcp flags:0x17/0x04 limit: avg 1/sec burst 5
    6        0     0 ACCEPT     icmp --  vlan1  *       0.0.0.0/0            0.0.0.0/0          limit: avg 1/sec burst 5 icmp type 8
    7        0     0 ACCEPT     udp  --  vlan1  br0     0.0.0.0/0            0.0.0.0/0          udp dpts:25500:25599
    8        0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            10.2.1.21          tcp dpts:25600:25699
    9        0     0 DROP       all  --  vlan1  br0     0.0.0.0/0            0.0.0.0/0
    Following that rule, there are other rules that allows the forwarding for the "virtual hosts" feature, but they are almost useless that the previous rule allows that traffic.

    I suppose that the original intention of the programmers was to limit the number of connections allowed, but not to explicitly allow them.

    I think that the best way to solve this bug is to create a new chain called when the limit isn't reached, and put the "virtual hosts" rules in this new chain:

    Code:
    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    num   pkts bytes target     prot opt in     out     source               destination
    1        0     0 ACCEPT     all  --  br0    br0     0.0.0.0/0            0.0.0.0/0
    2        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0          state INVALID
    3        0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0          state RELATED,ESTABLISHED
    4       14   672 VHOSTS     tcp  --  vlan1  *       0.0.0.0/0            0.0.0.0/0          tcp flags:0x16/0x02 limit: avg 1/sec burst 5
    5        0     0 VHOSTS     tcp  --  vlan1  *       0.0.0.0/0            0.0.0.0/0          tcp flags:0x17/0x04 limit: avg 1/sec burst 5
    6        0     0 ACCEPT     icmp --  vlan1  *       0.0.0.0/0            0.0.0.0/0          limit: avg 1/sec burst 5 icmp type 8
    7        0     0 ACCEPT     udp  --  vlan1  br0     0.0.0.0/0            0.0.0.0/0          udp dpts:25500:25599
    8        0     0 DROP       all  --  vlan1  br0     0.0.0.0/0            0.0.0.0/0
    
    Chain VHOSTS (2 references)
    1        0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            10.2.1.21          tcp dpts:25600:25699
    Do you see any flaw?

  2. #2
    Join Date
    Sep 2005
    Location
    Madrid
    Posts
    31
    I've rewritten the firewall rule generator. With this patch:
    - The rules that protects against DOS attacks no longer allows to forward all incoming connections.
    - If you activate MAC filtering, white listed MACs are affected by the remaining rules (with the asus code, white listed MACs runs the special chain MACS instead of FORWARD)

    This patch puts the rules to filter by MAC into the MACS chain. This chain returns if the MAC is allowed, and drops the packet otherwise. This way, MAC filtering is encapsulated and doesn't affect any other rule.

    Also, it creates a new chain called SECURITY, that implements the anti-DOS rules. If a violation is detected, the packet is dropped; otherwise the chain returns. The SECURITY chain is called on every new incoming packet.

    Finally, all the compiler warnings are fixed.

    Reviews of the patch are wellcomed.
    Attached Files Attached Files
    Last edited by unaiur; 09-09-2005 at 01:18.

  3. #3
    Join Date
    Dec 2003
    Location
    Russian Federation
    Posts
    8,356
    Nice. Have you checked, that everything from the web settings are working correctly?

  4. #4
    Join Date
    Sep 2005
    Location
    Madrid
    Posts
    31
    I've played with several elemental settings (the MAC list, the virtual host lists, incoming forwards). I've posted the patch to let other people to play with it before including it in any firmware.

    I will be on holidays until 19th and although I will have internet connection, I can't help much, since my router remains here in Madrid.

    Good bye.

  5. #5
    Join Date
    Sep 2005
    Location
    Berlin, Germany
    Posts
    6
    Quote Originally Posted by unaiur
    Reviews of the patch are wellcomed.
    Your fix seems somehow reasonable to me. Unfortunately I am currently not able to try it out, because I have the build system and all this stuff on my notebook, which just got broken and will not be repaired until tomorrow.

    May I kindly suggest that you put the NAT issue fix in your diff aswell?

  6. #6
    Join Date
    Sep 2005
    Location
    Berlin, Germany
    Posts
    6
    I just tried to apply the patch to oleg's 1.9.2.7-6b and it says:
    Code:
    Hunk #9 FAILED at 710.
    Which version have you used for the diff?

  7. #7
    Join Date
    Dec 2003
    Location
    Russian Federation
    Posts
    8,356
    I'm having problems applying this patch too. Could you please compress it (using zip or gzip) and repost here? Perhaps this is a CR/LF problem...

  8. #8
    Quote Originally Posted by Oleg
    I'm having problems applying this patch too. Could you please compress it (using zip or gzip) and repost here? Perhaps this is a CR/LF problem...
    The posted file WAS in PC format. converted version attached
    Attached Files Attached Files

Similar Threads

  1. Replies: 4
    Last Post: 10-10-2005, 21:09
  2. Firewall rules - pls advice
    By jolae in forum WL-500g Q&A
    Replies: 1
    Last Post: 13-06-2005, 19:42
  3. Replies: 4
    Last Post: 10-11-2004, 15:21
  4. How often are your firewall rules flushed?
    By sesamebike in forum WL-500g Custom Development
    Replies: 3
    Last Post: 02-09-2004, 12:48
  5. 1.7.5.9-4 Firewall/Filter rules bug ?
    By psylockex in forum WL-500g Custom Development
    Replies: 0
    Last Post: 23-08-2004, 08:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •