Skip to content
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

Forbid traffic forwarding between device network ports #3837

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

milan-zededa
Copy link
Contributor

It should not be possible to take advantage of EVE device and use it as a router to hop from one network to another.

However, with out current iptables rules, EVE inadvertently allows icmp as well as tcp traffic on ports 22 (ssh), 4822 (Guacamole) and 5900-5999 (VNC) to get forwarded from one port to another. These are the protocols that we allow to be initiated from outside and enter EVE (if enabled by configuration), but we do not check if the traffic is locally destined or if it will continue out through another port.

This is obviously a security issue. Luckily, it is not so easily exploitable - for an attacker to establish connection with an endpoint in another network, the routing in the other network must be configured such that the EVE device is used as the gateway (at least for the attacker's IP). Otherwise, the returning traffic will not take the same path and most likely will not reach the attacker.

The solution in this commit is to first ensure that application traffic is always marked with app IDs (including for implicit ACL rules). Then, we can take advantage of the fact that only application traffic (non-zero app ID mark) should be allowed to be forwarded. Everything else that hits the FORWARD chain should be dropped.

It should not be possible to take advantage of EVE device and use it as
a router to hop from one network to another.

However, with out current iptables rules, EVE inadvertently allows icmp
as well as tcp traffic on ports 22 (ssh), 4822 (Guacamole) and 5900-5999
(VNC) to get forwarded from one port to another. These are the protocols
that we allow to be initiated from outside and enter EVE (if enabled by
configuration), but we do not check if the traffic is locally destined
or if it will continue out through another port.

This is obviously a security issue. Luckily, it is not so easily
exploitable - for an attacker to establish connection with an
endpoint in another network, the routing in the other network must be
configured such that the EVE device is used as the gateway (at least for
the attacker's IP). Otherwise, the returning traffic will not take
the same path and most likely will not reach the attacker.

The solution in this commit is to first ensure that application traffic
is always marked with app IDs (including for implicit ACL rules).
Then, we can take advantage of the fact that only application traffic
(non-zero app ID) should be allowed to be forwarded. Everything else
that hits the FORWARD chain should be dropped.

Signed-off-by: Milan Lenco <milan@zededa.com>
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 17.51%. Comparing base (7859da6) to head (7ebd749).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3837   +/-   ##
=======================================
  Coverage   17.51%   17.51%           
=======================================
  Files           3        3           
  Lines         805      805           
=======================================
  Hits          141      141           
  Misses        629      629           
  Partials       35       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@milan-zededa milan-zededa marked this pull request as ready for review April 2, 2024 09:28
@eriknordmark eriknordmark merged commit 860f4d6 into lf-edge:master Apr 7, 2024
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants