Skip to contentSkip to conversation

bugs in ftp conntrack

DISCUSSION YU, Haitao 3 participants 4 messages May 25, 2007 – May 26, 2007 netfilter

lore
Share & tools
lore

YU, Haitao

author
#0 lore raw

In your mail:

Quoted 11 lines

From: Patrick McHardy <[email protected]>
Reply-To:
To: "YU, Haitao" <[email protected]>
Subject: Re: bugs in ftp conntrack
Date:Thu, 24 May 2007 20:16:05 +0200

There's not much we can do about this case, we already keep a history of sequence numbers. As you note below that code is pretty broken currently, but I have patches queued to fix it (attached to this mail).

I think if it's possible that we don't record the new seqence of too new packets. "Too new packets" means the sequence of the packet is greater than all seq_aft_nl[] values. We just wait until another "port", "227", etc. packet is parsed correctly.

So the return value of function find_nl_seq() shoule be three:
1: too new, then parse pattern, only if found > 0, then update seq, else keep current seq_aft_nl;
0: match one of the remembered seq, then parse pattern, update seq when found >= 0;
-1: too old(less than all remembered seq), just goto out, (not goto out_update_nl)

Thanks,

YU, Haitao

#1 lore raw

fre 2007-05-25 klockan 09:10 +0800 skrev YU, Haitao:

Quoted 4 lines

I think if it's possible that we don't record the new seqence of too new packets. "Too new packets" means the sequence of the packet is greater than all seq_aft_nl[] values. We just wait until another "port", "227", etc. packet is parsed correctly.

The best (save for doing a full TCP stream reassembly or proxying) would be to drop such out-of-order packets, relying on the sender to retransmit them later.. Might result in quite inefficient communication, but will make the protocol parsing behave correctly.

Regards
Henrik

#2 lore raw
Quoted 9 lines · Henrik Nordstrom

fre 2007-05-25 klockan 09:10 +0800 skrev YU, Haitao:

Quoted 4 lines

I think if it's possible that we don't record the new seqence of too new packets. "Too new packets" means the sequence of the packet is greater than all seq_aft_nl[] values. We just wait until another "port", "227", etc. packet is parsed correctly.

Quoted 4 lines

The best (save for doing a full TCP stream reassembly or proxying) would be to drop such out-of-order packets, relying on the sender to retransmit them later.. Might result in quite inefficient communication, but will make the protocol parsing behave correctly.

That also sounds like a good idea. We shouldn't see any reordering in FTP command streams since clients usually wait for an reply before sending the next command (at least I believe so, or is it always?), so I'm not too worried about inefficient communication.

That would also allow to find silly bugs in newline sequence number tracking faster :)

#3 lore raw
In reply to YU, Haitao
Quoted 15 lines · Haitao
Quoted 6 lines

From: Patrick McHardy <[email protected]>

There's not much we can do about this case, we already keep a history of sequence numbers. As you note below that code is pretty broken currently, but I have patches queued to fix it (attached to this mail).

I think if it's possible that we don't record the new seqence of too new packets. "Too new packets" means the sequence of the packet is greater than all seq_aft_nl[] values. We just wait until another "port", "227", etc. packet is parsed correctly.

Quoted 7 lines

So the return value of function find_nl_seq() shoule be three:
1: too new, then parse pattern, only if found > 0, then update seq, else keep current seq_aft_nl;
0: match one of the remembered seq, then parse pattern, update seq when found >= 0;
-1: too old(less than all remembered seq), just goto out, (not goto out_update_nl)

Would you mind sending a patch to demonstrate your idea?