U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] net: lwip: fix use-after-free bugs in the wget and dns commands
@ 2026-08-11 18:48 Shahriyar Jalayeri
  2026-08-11 18:48 ` [PATCH 1/3] net: lwip: wget: return ERR_ABRT after aborting the connection Shahriyar Jalayeri
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shahriyar Jalayeri @ 2026-08-11 18:48 UTC (permalink / raw)
  To: u-boot, Jerome Forissier
  Cc: Tom Rini, David Lechner, Argus, Shahriyar Jalayeri

Three use-after-free bugs in the lwIP wget and dns command glue.

Patch 1 fixes httpc_recv_cb(), which calls altcp_abort() on a store_block()
failure but returns ERR_BUF instead of ERR_ABRT, so tcp_input() keeps using
the freed pcb.

Patch 2 fixes wget, which keeps its transfer context on the stack and hands
its address to the httpc callbacks. Ctrl-C while the host name is still
resolving leaves the connection up, and a later callback runs against the
freed stack frame, writing attacker-controlled data through store_block().
The context moves to the heap with an ownership handoff to the lwIP callback.

Patch 3 fixes the same stack-lifetime bug in the dns command, for its
dns_gethostbyname() callback argument.

A reproducer is available on request.

Signed-off-by: Shahriyar Jalayeri <shahriyar@byteray.co.uk>
---
Shahriyar Jalayeri (3):
      net: lwip: wget: return ERR_ABRT after aborting the connection
      net: lwip: wget: free the transfer context after an aborted request
      net: lwip: dns: free the callback context after an aborted lookup

 net/lwip/dns.c  | 38 ++++++++++++++++++++++------
 net/lwip/wget.c | 77 ++++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 91 insertions(+), 24 deletions(-)
---
base-commit: baa64b2f892890f00a377eac4a3e685472bb56b5
change-id: 20260811-lwip-httpc-uaf-31bf85307bce

Best regards,
--  
Shahriyar Jalayeri <shahriyar@byteray.co.uk>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-12 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 18:48 [PATCH 0/3] net: lwip: fix use-after-free bugs in the wget and dns commands Shahriyar Jalayeri
2026-08-11 18:48 ` [PATCH 1/3] net: lwip: wget: return ERR_ABRT after aborting the connection Shahriyar Jalayeri
2026-08-11 18:48 ` [PATCH 2/3] net: lwip: wget: free the transfer context after an aborted request Shahriyar Jalayeri
2026-08-12 13:38   ` Jerome Forissier
2026-08-11 18:48 ` [PATCH 3/3] net: lwip: dns: free the callback context after an aborted lookup Shahriyar Jalayeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox