diff options
| author | n0k0 <osmocom@hacky.software> | 2026-06-25 10:20:37 +0200 |
|---|---|---|
| committer | n0k0 <osmocom@hacky.software> | 2026-08-07 22:59:07 +0200 |
| commit | 2852a03c153cd9418c2a86d0b2193ac41169dbb7 (patch) | |
| tree | 49f338ad500328fe8666bf52d6a8a8c9c426da03 | |
| parent | 1245bb6f5cb4893666be6c4fdec31622f6ca6bac (diff) | |
ipaccess-proxy: reject oversized IPA frame length
ipaccess_proxy_read_msg() reads the 16-bit IPA frame length from the
wire header and passes it straight as the recv() count into a msgb that
was allocated with a fixed PROXY_ALLOC_SIZE (1200) bytes, without ever
checking it against the buffer tailroom. A peer that advertises a body
length larger than the remaining buffer space makes recv() write past
the end of the heap allocation (heap buffer overflow).
Reject frames whose advertised length exceeds the msgb tailroom, the
same way the other IPA read paths bound the read to msgb_tailroom().
This issue has been assigned the CVE candidate identifier
CAN-2026-2051036.
Change-Id: I05137e114eaa99ff0e85eecccf7645c90945214f
| -rw-r--r-- | src/ipaccess/ipaccess-proxy.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c index 61c2fc2bf..71190f62b 100644 --- a/src/ipaccess/ipaccess-proxy.c +++ b/src/ipaccess/ipaccess-proxy.c @@ -583,6 +583,12 @@ struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error) /* then read the length as specified in header */ msg->l2h = msg->data + sizeof(*hh); len = ntohs(hh->len); + if (len > msgb_tailroom(msg)) { + LOGP(DLINP, LOGL_ERROR, "Oversized IPA frame: len %d > tailroom %d\n", len, msgb_tailroom(msg)); + msgb_free(msg); + *error = -EIO; + return NULL; + } ret = recv(bfd->fd, msg->l2h, len, 0); if (ret < len) { LOGP(DLINP, LOGL_ERROR, "short read!\n"); |
