support.mikro.strouter help over vpn
since 2014 Contact us now

Router vulnerability note - MikroTik

MikroTik ipt_SAME: an integer overflow in a kernel module nobody enabled on purpose

What happened

ipt_SAME is the Linux-derived iptables match that keeps the source address of a NAT'ed flow the same. RouterOS ships the module, and the function same_check mishandles an arithmetic case, which an attacker reachable by the right kind of traffic can turn into a denial of service. The affected span is broad and old: up to 6.40.5, 6.44, and 7.20.8, with 7.21.5 and 7.23.1 recommended.

This is the sort of entry that looks unimportant and is not. Half the installations using a SAME match do it because a queue or a NAT rule was copied from a forum post in 2016, and nobody in the building can tell you what it does. That is also, incidentally, the definition of most of our work.

Who is affected

RouterOS up to 6.40.5, 6.44 and 7.20.8, when the SAME match is in use.

Check it yourself

Do you actually use it?

[admin@router] > /ip firewall nat print where action~"same" or src-address~"same"
[admin@router] > /ip firewall address-list print where name~"same"
[admin@router] > /modules print where name~"same"
  (if you have never heard of ipt_SAME, the interesting question is who loaded it)

Do this

  • Upgrade to 7.21.5 or 7.23.1 if the module is loaded.
  • Remove NAT rules copied from tutorials that you cannot explain, one at a time, with the export kept.
  • On an old stable build, treat the risk as exposure-driven: is anything reaching that match from outside?
  • If the box is 6.4x and works, weigh a planned upgrade against an unplanned reboot.

How we handle it

We run /export, look for the rules nobody claims, and ask before removing them. That conversation is usually the whole audit.

Sources

Not your thing? We can run these checks for you over an OpenVPN tunnel: €45 fix visit, or just mail us.