U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@sigma-star.at>
To: Richard Weinberger <richard@nod.at>, upstream@sigma-star.at
Cc: u-boot@lists.denx.de, jmcosta944@gmail.com,
	thomas.petazzoni@bootlin.com, trini@konsulko.com,
	upstream+uboot@sigma-star.at,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PATCH 4/4] squashfs: Fix stack overflow while symlink resolving
Date: Wed, 17 Jul 2024 10:16:06 +0200	[thread overview]
Message-ID: <3173526.TQGk6oTFT5@somecomputer> (raw)
In-Reply-To: <20240717100635.19491668@xps-13>

Hi Miquel,

Am Mittwoch, 17. Juli 2024, 10:06:35 CEST schrieb 'Miquel Raynal' via upstream:
> Hi Richard,
> 
> richard@nod.at wrote on Fri, 12 Jul 2024 10:23:44 +0200:
> 
> > The squashfs driver blindly follows symlinks, and calls sqfs_size()
> > recursively. So an attacker can create a crafted filesystem and with
> > a deep enough nesting level a stack overflow can be achieved.
> > 
> > Fix by limiting the nesting level to 8.
> 
> As this is I believe an arbitrary value, could we define this value
> somewhere and flag it with a comment as "arbitrary" with some details
> from the commit log? Right now the value '8' is hardcoded at least in 3
> different places.

I stole the value from the ext4 code.
Since U-Boot lacks a common filesystem code, there will be always
duplication. I can happily add a common define for the value.

> Also, 8 seems rather small, any reason for choosing
> that? I believe this is easy to cross even in non-evil filesystems and
> could perhaps be (again, arbitrarily) increased a bit?

For ext4 the value seems okay.
So dunno. :-)

Thanks,
//richard

-- 
​​​​​sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT
UID/VAT Nr: ATU 66964118 | FN: 374287y



  reply	other threads:[~2024-07-17  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12  8:23 [PATCH 1/4] squashfs: Fix integer overflow in sqfs_resolve_symlink() Richard Weinberger
2024-07-12  8:23 ` [PATCH 2/4] squashfs: Fix integer overflow in sqfs_inode_size() Richard Weinberger
2024-07-17  7:59   ` Miquel Raynal
2024-07-12  8:23 ` [PATCH 3/4] squashfs: Check sqfs_find_inode() return value Richard Weinberger
2024-07-17  8:00   ` Miquel Raynal
2024-07-12  8:23 ` [PATCH 4/4] squashfs: Fix stack overflow while symlink resolving Richard Weinberger
2024-07-17  8:06   ` Miquel Raynal
2024-07-17  8:16     ` Richard Weinberger [this message]
2024-07-17  8:26       ` Miquel Raynal
2024-07-17  8:45         ` Richard Weinberger
2024-07-17  7:59 ` [PATCH 1/4] squashfs: Fix integer overflow in sqfs_resolve_symlink() Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3173526.TQGk6oTFT5@somecomputer \
    --to=richard@sigma-star.at \
    --cc=jmcosta944@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=upstream+uboot@sigma-star.at \
    --cc=upstream@sigma-star.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox