lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA85sZu5S1WdJEoDWCEM7dr8CQf32M6S38Gz0TOQ5PpgHbgrig@mail.gmail.com>
Date: Sun, 30 Jun 2024 01:51:06 +0200
From: Ian Kumlien <ian.kumlien@...il.com>
To: Florian Westphal <fw@...len.de>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: IP oversized ip oacket from - header size should be skipped?

So, yeaj, caffeine induced thinking, been reading RFC:s and yes, it's
completely correct that fragment ip headers should be skipped

completely logical as well, what does confuse me though is that i can
get thousands of:
[ 1415.631438] IPv4: Oversized IP packet from <local ip>

I did change to get the size, and
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -474,7 +474,7 @@ static int ip_frag_reasm(struct ipq *qp, struct
sk_buff *skb,
        err = -ENOMEM;
        goto out_fail;
 out_oversize:
-       net_info_ratelimited("Oversized IP packet from %pI4\n",
&qp->q.key.v4.saddr);
+       net_info_ratelimited("Oversized IP packet from %pI4 %i >
65535\n", &qp->q.key.v4.saddr, len);
 out_fail:
        __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
        return err;

Yields:  66260 > 65535

Which is constantly 725 bytes too large, assumed to be ~16 bytes per packet

Checking the calculation quickly becomes beyond me
        /* Determine the position of this fragment. */
        end = offset + skb->len - skb_network_offset(skb) - ihl;

Since skb_network_offset(skb) expands to:
(skb->head + skb->network_header) - skb->data

And you go, oh... heck ;)

I just find it weird that localhost can generate a packet (without raw
or xdp) that is oversize, I'll continue checking
(once you've started making a fool of yourself, no reason to stop =))

On Fri, Jun 28, 2024 at 3:35 PM Ian Kumlien <ian.kumlien@...il.com> wrote:
>
> So this bug predates 2.6.12-rc2, been digging a bit now... Unless
> gp->len has been pointing to something else weird.
>
> On Fri, Jun 28, 2024 at 1:44 PM Ian Kumlien <ian.kumlien@...il.com> wrote:
> > On Fri, Jun 28, 2024 at 1:28 PM Ian Kumlien <ian.kumlien@...il.com> wrote:
> > > On Fri, Jun 28, 2024 at 12:55 PM Ian Kumlien <ian.kumlien@...il.com> wrote:
> > > > On Fri, Jun 28, 2024 at 12:53 PM Florian Westphal <fw@...len.de> wrote:
> > > > > Ian Kumlien <ian.kumlien@...il.com> wrote:
> > > > > > Hi,
> > > > > >
> > > > > > In net/ipv4/ip_fragment.c line 412:
> > > > > > static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
> > > > > >                          struct sk_buff *prev_tail, struct net_device *dev)
> > > > > > {
> > > > > > ...
> > > > > >         len = ip_hdrlen(skb) + qp->q.len;
> > > > > >         err = -E2BIG;
> > > > > >         if (len > 65535)
> > > > > >                 goto out_oversize;
> > > > > > ....
> > > > > >
> > > > > > We can expand the expression to:
> > > > > > len = (ip_hdr(skb)->ihl * 4) + qp->q.len;
> > > > > >
> > > > > > But it's still weird since the definition of q->len is: "total length
> > > > > > of the original datagram"
> > > > >
> > > > > AFAICS datagram == l4 payload, so adding ihl is correct.
> > > >
> > > > But then it should be added and multiplied by the count of fragments?
> > > > which doesn't make sense to me...
> > > >
> > > > I have a security scanner that generates big packets (looking for
> > > > overflows using nmap nasl) that causes this to happen on send....
> > >
> > > So my thinking is that the packet is 65535 or thereabouts which would
> > > mean 44 segments, 43 would be 1500 bytes while the last one would be
> > > 1035
> > >
> > > To me it seems extremely unlikely that we would hit the limit in the
> > > case of all packets being l4 - but I'll do some more testing
> >
> > So, I realize that i'm not the best at this but I can't get this to fit.
> >
> > The 65535 comes from the 16 bit ip total length field, which includes
> > header and data.
> > The minimum length is 20 which would be just the IP header.
> >
> > Now, IF we are comparing to 65535 then it HAS to be the full packet (ie l3)
> >
> > If we are making this comparison with l4 data, then we are not RFC
> > compliant IMHO

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ