Certainly!
-A OUTPUT -p udp -m udp --sport 53 -m string --hex-string "|8500|" --algo kmp --from 30 --to 31 -j ACCEPT
-A OUTPUT -p udp -m udp --sport 53 -m string --hex-string "|8400|" --algo kmp --from 30 --to 31 -j ACCEPT
-A OUTPUT -p udp -m udp --sport 53 -j DROP
The above used in the filter table drops anything that does not match NOERROR recursive and NOERROR non-recursive responses. -A PREROUTING -i eth0 -p udp -m udp --dport 53 -m string --hex-string "|0000ff0001|" --algo bm --from 40 --to 65535 -j DROP
The above used in the raw table drops "ANY". It could probably be optimized to search through less of the packet. -A INPUT -i eth0 -p udp -m state --state NEW -m length --length 24:120 -m udp --dport 53 -j ACCEPT
Above is the inbound rule that blocks some overflow attempts.