-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unfortunate chain ordering side effect and potential security vulnerability #46
Comments
It is described only as source code or resulting ruleset, but not checking the resulting ruleset creates exposure of vulnerability you have in your ssh. |
I'm not sure I'm getting your meaning here.
So I have to be able to understand nftables rules in order to use the firewall on OpenWRT and not be exposed to nasty surprises like this? Is it really reasonable to expect every OpenWRT user to be able to understand nftables rules and audit them for correctness, or at least expectedness?
I don't have any vulnerability in my ssh. The vulnerability here is that the resulting rules don't seem to reflect what the ordering of the rules in the config file is suggesting. And the work-around is quite nasty. |
previous fw3 orders rules same way, |
Would it help to have warning that there are no-interface rules preceding specific rule? Similar to one listing rejected invalid rule. |
Actually it makes a lot of sense optimizing max chain length...
then nftablize
|
Would that only be displayed to CLI
No disagreement. But optimisation should be a secondary goal behind correctness, I think, particularly where security is involved. Better to be verbose and correct than concise and surprising/insecure, IMO.
I think that will mean that the global rules won't apply to anything that matches the This is interesting because I was (without a terrible amount of thought) wondering if the |
If I have the following rules defined:
Those will not do what I want and I expect them to and creates a security vulnerability.
Rather the above two rules (even in the order they are in the file!) results in a rule in the
input
chain allowing SSH to the router from everyone on the WAN (and every other zone, which is the desired behaviour) that gets put in the chain ahead of the rules which dispatch flow to the per-zone input chains. It is in the per-zone input chain for the WAN (wan_input
) where the first rule gets installed, but since it comes after the rule in theinput
chain (that the second rule above installed), it is never given a chance to be evaluated and effected.The result is that even despite the ordering of the rules in the config file even, the router is open to SSH from the Bad Actor at
1.2.3.4
. Not good.Further, to mitigate the above one has to proliferate the
ACCEPT
rule into different rule for every single zone one has and one has to keep adding a new rule every time one adds a new zone (think VPN zone growth, where new users get a zone for the VPN connection to the router -- so something that can be quite dynamic). You end up with a huge list of rules such as:You can see how this can get quite out of hand quite quickly compared to the single rule that should be able to cover all zones but also allow exceptions (i.e. the Bad Actor at 1.2.3.4).
The text was updated successfully, but these errors were encountered: