From: Richard GENOUD <richard.genoud@bootlin.com>
To: Piyush Paliwal <piyushthepal@gmail.com>, u-boot@lists.denx.de
Cc: joaomarcos.costa@bootlin.com, miquel.raynal@bootlin.com,
thomas.petazzoni@bootlin.com, trini@konsulko.com,
eric.kilmer@trailofbits.com
Subject: Re: [PATCH 0/2] fs/squashfs: fix two out-of-bounds reads on crafted images
Date: Thu, 25 Jun 2026 10:08:34 +0200 [thread overview]
Message-ID: <cef44406-c4cf-4795-931f-e0b110d36282@bootlin.com> (raw)
In-Reply-To: <20260612075424.83462-1-piyushthepal@gmail.com>
Hi Piyush,
Le 12/06/2026 à 09:54, Piyush Paliwal a écrit :
> Two independent out-of-bounds reads in the SquashFS driver, both reachable
> by pointing U-Boot at an attacker-supplied image (e.g. ls/load on a crafted
> USB/SD/netboot rootfs). Either one crashes the bootloader (DoS); patch 2 can
> also copy adjacent heap memory into the loaded file (information disclosure).
>
> 1/2 sqfs_find_inode()/sqfs_inode_size() walk the decompressed inode table
> using on-disk sizes with no check that the cursor stays inside the
> buffer -> wild read / SEGV, e.g. from a simple "ls".
> 2/2 sqfs_read_nest() uses the on-disk fragment offset as an unbounded
> source index into the fragment block -> out-of-bounds heap read when
> loading a fragment-backed file.
>
> Both were found by fuzzing the sandbox build (CONFIG_ASAN) of sqfsls/sqfsload
> with mutated images. With the fixes, the crashing inputs are rejected
> cleanly, 2000 fuzz iterations produce no further crashes, and the valid-image
> path is unchanged.
>
> These are distinct from the 2024 SquashFS CVE cluster (CVE-2024-57254..57259,
> fixed in 2025.01-rc1) and from the sqfs_frag_lookup() fix (e365a269df5): the
> earlier work added NULL checks at the callers and fixed the symlink-size and
> fragment-table paths, but left these inode-table-walk and fragment-data
> paths unbounded.
>
> The two patches are independent and can be applied in either order.
>
> Piyush Paliwal (2):
> fs/squashfs: bound the inode table walk in sqfs_find_inode()
> fs/squashfs: bound fragment offset/size in sqfs_read_nest()
>
> fs/squashfs/sqfs.c | 50 ++++++++++++----
> fs/squashfs/sqfs_filesystem.h | 6 +-
> fs/squashfs/sqfs_inode.c | 106 +++++++++++++++++++++++++++++-----
> 3 files changed, 134 insertions(+), 28 deletions(-)
>
Those patches look good.
NB: a patch correcting the same issue as patch 1 was sent 12 hours
earlier by Hem Parekh, but it fixes less problems than this one.
Reviewed-by: Richard Genoud <richard.genoud@bootlin.com>
Thanks!
prev parent reply other threads:[~2026-06-25 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 7:54 [PATCH 0/2] fs/squashfs: fix two out-of-bounds reads on crafted images Piyush Paliwal
2026-06-12 7:54 ` [PATCH 1/2] fs/squashfs: bound the inode table walk in sqfs_find_inode() Piyush Paliwal
2026-06-12 7:54 ` [PATCH 2/2] fs/squashfs: bound fragment offset/size in sqfs_read_nest() Piyush Paliwal
2026-06-25 8:08 ` Richard GENOUD [this message]
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=cef44406-c4cf-4795-931f-e0b110d36282@bootlin.com \
--to=richard.genoud@bootlin.com \
--cc=eric.kilmer@trailofbits.com \
--cc=joaomarcos.costa@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=piyushthepal@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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