Skip to content

"Drop" route configuration should add FORWARD rules to block internet/routing of guest/analysis VM #2564

@zOLakh

Description

@zOLakh

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I did read the README!
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)
  • I have read and checked all configs (with all optional parts)

Expected Behavior

When using per-analysis routing, using "drop" configuration should block internet for the guest/analysis VM. This implies blocking FORWARD/routing for the guest/analysis VM IP.

Current Behavior

When using the "drop" configuration, only OUTPUT blocking rules are created. Since no FORWARD rules are generated, the communication between CAPE (acting as the router) and the guest/analysis VM is restricted, but not for internet access.

The fix is quite easy, I could create a PR. However, am I correct here? Should another system/way handle that part of blocking internet access?

Failure Information (for bugs)

Steps to Reproduce

  1. Use a "drop" route type for an analysis.
  2. Internet is still accessible since no FORWARD rules are blocking the communication.

Context

  • "Drop" route configuration :
    elif self.route in ("none", "None", "drop"):
    self.rooter_response = rooter("drop_enable", self.machine.ip, str(self.cfg.resultserver.port))
  • Router "drop_enable" rules creation :

    CAPEv2/utils/rooter.py

    Lines 871 to 880 in 563fd24

    def drop_enable(ipaddr, resultserver_port):
    run_iptables(
    "-t", "nat", "-I", "PREROUTING", "--source", ipaddr, "-p", "tcp", "--syn", "--dport", resultserver_port, "-j", "ACCEPT"
    )
    run_iptables("-A", "INPUT", "--destination", ipaddr, "-p", "tcp", "--dport", "8000", "-j", "ACCEPT")
    run_iptables("-A", "INPUT", "--destination", ipaddr, "-p", "tcp", "--sport", resultserver_port, "-j", "ACCEPT")
    run_iptables("-A", "OUTPUT", "--destination", ipaddr, "-p", "tcp", "--dport", "8000", "-j", "ACCEPT")
    run_iptables("-A", "OUTPUT", "--destination", ipaddr, "-p", "tcp", "--sport", resultserver_port, "-j", "ACCEPT")
    # run_iptables("-A", "OUTPUT", "--destination", ipaddr, "-j", "LOG")
    run_iptables("-A", "OUTPUT", "--destination", ipaddr, "-j", "DROP")

Failure Logs

N.A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions