Skip to contentSkip to conversation

String matcher "algo bm" broken in OUTPUT since 5.3.x

DISCUSSION ValdikSS 2 participants 2 messages May 31, 2023 – Jun 7, 2023 netfilter

lore
Share & tools
lore

ValdikSS

author
#0 lore raw

Hi list,

Since at least kernel 5.3.x (2019) and up to current 6.2.15, iptables -m string --algo bm does not work when added to the OUTPUT chain.

Quick reproducer (algo bm, does not work properly):

Quoted 5 lines
# iptables -I OUTPUT -p tcp -m string --algo bm --string 'GET /' -j DROP
$ curl -s example.com | head -n3

^^^^ curl executes successfully

This works (algo kmp, works properly):

Quoted 4 lines
# iptables -I OUTPUT -p tcp -m string --algo kmp --string 'GET /' -j DROP
$ curl -s example.com | head -n

^^^^ curl does not execute successfully

See:
https://bugzilla.netfilter.org/show_bug.cgi?id=1390

#1 lore raw
Quoted 14 lines · ValdikSS

Since at least kernel 5.3.x (2019) and up to current 6.2.15, iptables -m string --algo bm does not work when added to the OUTPUT chain.

Quick reproducer (algo bm, does not work properly):

Quoted 4 lines
# iptables -I OUTPUT -p tcp -m string --algo bm --string 'GET /' -j DROP
$ curl -s example.com | head -n3

^^^^ curl executes successfully

This works (algo kmp, works properly):

Quoted 4 lines
# iptables -I OUTPUT -p tcp -m string --algo kmp --string 'GET /' -j DROP
$ curl -s example.com | head -n

^^^^ curl does not execute successfully

I've reproduced this. I'll have a crack at fixing it.

Quoted 2 lines

See:
https://bugzilla.netfilter.org/show_bug.cgi?id=1390

J.