Repository navigation
Description
Found by @ARSH871-bot reviewing #443. This is about #443's version of R-1, which is not on main yet.
What is wrong
#443 makes R-1 keep the check's severity (high) for every dead deny. That is right when the line shadowing the deny is a permit: traffic someone meant to block gets through. It is wrong when the shadowing line is also a deny. Then the traffic is still blocked, just by an earlier line, and nothing is exposed.
Example ACL, lan_in inbound on GigabitEthernet0/0:
ip access-list extended lan_in
deny tcp 10.10.10.0 0.0.0.255 host 10.20.0.5
deny tcp host 10.10.10.66 host 10.20.0.5 eq telnet
permit tcp 10.10.10.0 0.0.0.255 host 10.20.0.5 eq 443
deny ip any any
Line 2 can never match, because line 1 already denies all of it.
Measured
Local Batfish, on #443's head 2563f1e. main's R-1 was taken from db59b00 and applied to the same finding.
filterLineReachability, line 2
Unreachable_Line_Action DENY
Blocking_Lines ['deny tcp 10.10.10.0 0.0.0.255 host 10.20.0.5']
Different_Action False
testFilters, telnet 10.10.10.66 -> 10.20.0.5 on lan_in
DENY, by line 1
finding for line 2
Unreachable line: deny tcp host 10.10.10.66 host 10.20.0.5 eq telnet (action DENY).
Blocked by: deny tcp 10.10.10.0 0.0.0.255 host 10.20.0.5. Reason: BLOCKING_LINES
check default high
main's R-1 low
#443's R-1 high
So #443 rates this card high, while ai/explain.py:166-177 reads the same card and says the traffic is actually denied. Line 3 (a dead permit behind a deny) is low on both, as intended.
Why R-1 gets it wrong
R-1 reads only the dead line's own action from the evidence text. It does not know what the blocking line does, so it cannot tell "deny behind a permit" (an exposure) from "deny behind a deny" (not one). It keeps high for both.
Two ways to fix it
- (a)
access_controladds Batfish'sDifferent_Actionto the dead-rule detail (access_control.py:607-611). R-1 then keeps the check's severity only when the blocker's action differs, and lowers the rest tolow. - (b) R-1 reads the blocking lines the way
ai/explain.py:166-177does: if every blocker is a deny,low; anything it does not recognise keepshigh.
(a) uses Batfish's own answer instead of parsing text. Arsh offered to do the access_control.py side.
Not checked
- Only this one ACL was run. No other vendor or fixture with a dead deny behind a deny.
- A dead deny with several blockers that mix permit and deny was not run.
main's R-1 was applied to the finding from R-1: a dead deny keeps its check's severity #443's run, not run through the whole pipeline onmain.
Activity
Say that R-1 over-rates a dead deny whose blocker also denies (#447)
Record Samika's answer on R-1 in the CVSS comparison