Skip to contentSkip to conversation

string match and hex strings

DISCUSSION Michael Rash 3 participants 3 messages Mar 1, 2003 – Mar 2, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

My patch to libipt_string.c may introduce a slight problem which I would like to bring up to the list and ask for input.

Any new version of iptables that contains the patch will allow hex chars to be mixed within ascii strings in the "--string" option:

iptables -A INPUT -m string --string "|45 45|blah" -j LOG

The problem is that all old versions of iptables will also accept the same "|45 45|blah" string, but the hex chars won't mean anything; it will just be treated as ascii data. So we descend into version problems...

My thought is that perhaps it would be better to reinstate my original "--hex-string" option and leave the "--string" option to just take input as-is. The --hex-string option would be flexible in the same way the patch is by allowing hex and ascii chars to be mixed.

What do people think?

--Mike

Michael Rash
http://www.cipherdyne.com
Key fingerprint = 53EA 13EA 472E 3771 894F AC69 95D8 5D6B A742 839F

#1 lore raw

Hello Michael,

Quoted 10 lines

iptables -A INPUT -m string --string "|45 45|blah" -j LOG

The problem is that all old versions of iptables will also accept the same "|45 45|blah" string, but the hex chars won't mean anything; it will just be treated as ascii data. So we descend into version problems...

My thought is that perhaps it would be better to reinstate my original "--hex-string" option and leave the "--string" option to just take input as-is.

My thought, exactly. If you don't use a separate --hex-string option specifier, existing uses may fail where they worked before. That's a definite NONO, in my opinion, at least for tools with security implications.

best regards
Patrick

#2 lore raw
Quoted 4 lines · Patrick Schaaf

My thought, exactly. If you don't use a separate --hex-string option specifier, existing uses may fail where they worked before. That's a definite NONO, in my opinion, at least for tools with security implications.

ACK.

Quoted 2 lines

best regards
Patrick

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie