From: David Heidelberg <david@ixit.cz>
To: Doruk Tan Ozturk <doruk@0sec.ai>
Cc: oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Pengpeng Hou <pengpeng@iscas.ac.cn>
Subject: Re: [PATCH net] nfc: microread: validate CARD_FOUND event length before parsing targets
Date: Sun, 19 Jul 2026 16:15:31 +0200 [thread overview]
Message-ID: <c1e0bd81-15ef-4aa0-a8d6-bbc193d95cf8@ixit.cz> (raw)
In-Reply-To: <20260713215936.23137-1-doruk@0sec.ai>
On 13/07/2026 23:59, Doruk Tan Ozturk wrote:
> microread_target_discovered() parses a device-supplied MREAD_CARD_FOUND
> event into a struct nfc_target, reading fixed offsets and -- for the
> ISO-A and ISO-A-3 gates -- a variable-length NFCID1 straight out of the
> event skb. The only length check is nfcid1_len vs sizeof(targets->nfcid1);
> skb->len itself is never validated, so a short event makes every gate
> case read out of bounds past the skb:
>
> - ISO-A / ISO-A-3: fixed ATQA/SAK/LEN reads plus a memcpy of an
> attacker-controlled nfcid1_len bytes from the NFCID1 offset;
> - ISO-B / NFC-T1 / NFC-T3: a fixed 4- or 8-byte NFCID1 memcpy from a
> fixed offset.
>
> The copied nfcid1 is exported to user space via nfc_targets_found(), so
> the over-read is an information leak (and a possible oops on an unmapped
> page).
>
> Reject events too short for the fields each gate case reads.
>
> Found by 0sec (https://0sec.ai).
>
> Fixes: cfad1ba87150 ("NFC: Initial support for Inside Secure microread")
> Cc: stable@vger.kernel.org
> Assisted-by: 0sec
> Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
> ---
> drivers/nfc/microread/microread.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
Hello Doruk,
thanks for the patch, 1. 7. I got the same one from Pengpeng, which needs to
address Fixes and Cc tag [1].
Feel free to sync together for the future effort to not get duplicated (and
tokens not wasted ;-) )
Adding Pengpeng to Cc.
David
[1] https://lore.kernel.org/all/20260701053709.45176-1-pengpeng@iscas.ac.cn/
prev parent reply other threads:[~2026-07-19 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 21:59 [PATCH net] nfc: microread: validate CARD_FOUND event length before parsing targets Doruk Tan Ozturk
2026-07-19 14:15 ` David Heidelberg [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=c1e0bd81-15ef-4aa0-a8d6-bbc193d95cf8@ixit.cz \
--to=david@ixit.cz \
--cc=doruk@0sec.ai \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oe-linux-nfc@lists.linux.dev \
--cc=pengpeng@iscas.ac.cn \
--cc=stable@vger.kernel.org \
/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