A flaw was found in libtirpc. The SunRPC UDP/datagram server transport reuses a single receive buffer across requests and resets the XDR decode position without rebinding the decode length to the size of the datagram actually received. As a result, when a short UDP RPC request is received after a longer one, the XDR decoder can read stale bytes left in the reused buffer and interpret them as part of the current request, including credential, verifier, or procedure-argument fields. The highest threat from this vulnerability is to data confidentiality and integrity for services that use a UDP-based SunRPC server.
A flaw was found in libtirpc. A remote attacker can exploit this vulnerability by sending specially crafted PMAPPROCDUMP replies to a client application that uses the pmapgetmaps() function against an attacker-controlled host. This unbounded decoding can lead to excessive memory and CPU allocation, causing the client process to experience a Denial of Service (DoS) due to resource exhaustion.
AIONLYREPORT package: libtirpc-1.3.7-2.1.hum1 ------ Summary: Unbounded pmaplist decoding can cause memory exhaustion (DoS): attacker-controlled PMAPPROCDUMP replies can drive unbounded decode-time allocation in xdrpmaplist() and exhaust memory or CPU in the client process. Requirements to exploit: An attacker must be able to make a libtirpc consumer call pmapgetmaps() against an attacker-controlled host, or otherwise supply the PMAPPROCDUMP response on that path. No authentication or post-request user interaction is required, but the vulnerable client-side portmapper path must be used by the consuming application. Component affected: libtirpc-1.3.7-2.1.hum1 portmapper/XDR decode path in src/pmapprot2.c (xdrpmaplist()), reachable from src/pmapgetmaps.c (pmapgetmaps()) Version affected: libtirpc-1.3.7-2.1.hum1, when the pmapgetmaps() / PMAPPROCDUMP client decode path is exercised Patch available: no released package fix established; proposed patch included below Version fixed: unknown Upstream coordination: Not notified. CVSS: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H - 5.9 (MEDIUM) AV:N - The malicious PMAPPROCDUMP response is delivered over the network to a client using pmapgetmaps(). AC:H - Exploitation depends on the victim using this specific client path against an attacker-controlled or spoofed endpoint; once that precondition holds, the payload is straightforward. PR:N - No authentication is required. UI:N - No additional user interaction is required after the vulnerable request is made. S:U - The impact is limited to the vulnerable client process and its resources. C:N - No confidentiality impact is established by the available evidence. I:N - No integrity impact is established by the available evidence. A:H - A long attacker-controlled list can consume substantial memory and CPU, causing the client to hang, fail allocation, or be terminated. Impact: Moderate. This is a real availability issue, but the available evidence supports a usage-dependent client-side path rather than a broadly exposed server path in the package itself. Under Red Hat's severity guidance, that makes the issue less broadly exploitable than the typical remote DoS cases rated Important, and there is no evidence of confidentiality, integrity, or system-compromise impact. Embargo: no Reason: This is an availability-only flaw in a client-side, usage-dependent path with straightforward short-term mitigations, so immediate public handling appears appropriate. Acknowledgement: Aisle Research Vulnerability Details: pmapgetmaps() uses xdrpmaplist() to decode PMAPPROCDUMP replies. In xdrpmaplist(), loop termination depends entirely on the decoded moreelements value, and no maximum node count or byte budget is enforced: c for (; { moreelements = (boolt)(rp != NULL); if (! xdrbool(xdrs, &moreelements)) return (FALSE); if (! moreelements) return (TRUE); if (! xdrreference(xdrs, (caddrt )rp, (uint)sizeof(struct pmaplist), (xdrproct)xdrpmap)) return (FALSE); rp = (freeing) ? next : &((rp)->pmlnext); } During XDRDECODE, xdrreference() allocates a new struct pmaplist node whenever the pointer is NULL: c case XDRDECODE: pp = loc = (caddrt) memalloc(size); if (loc == NULL) { warnx("xdrreference: out of memory"); return (FALSE); } memset(loc, 0, size); break; This makes both allocation count and decode work peer-controlled. A responder that keeps sending moreelements=TRUE with additional struct pmap records can force repeated allocations until the client slows significantly, fails allocation, or is killed for resource exhaustion. The available transport code does not show a total decode budget in this path; the receive timeout is applied per read/poll cycle, so continued input can continue to drive work. Steps to reproduce: 1. Build or use a libtirpc consumer with the portmapper client path enabled and create a small client that calls pmapgetmaps() against a host you control. 2. Run a malicious or mock rpcbind/portmapper service on TCP/111 that returns a valid PMAPPROCDUMP reply body containing many repetitions of bool TRUE followed by one struct pmap record, with a final bool FALSE only after a very long list or not until resource exhaustion is reached. 3. Observe client memory and CPU consumption while the reply is decoded through xdrpmaplist(). 4. Increase the number of returned elements; the client eventually becomes slow, fails allocation, or is terminated by the OOM killer. 5. As a validation step, add a local decode cap and confirm the same payload is rejected quickly. Mitigation: Until a fix is available, avoid calling pmapgetmaps() against untrusted or attacker-influenced endpoints. If this functionality is required, add a local maximum node or allocation budget for xdrpmaplist() decoding, or isolate the caller so failure only affects a constrained helper process. Proposed Fix: Add an explicit decode-time limit for the number of pmaplist nodes accepted by xdrpmaplist(), and fail decoding once the limit is exceeded. diff diff --git a/src/pmapprot2.c b/src/pmapprot2.c — a/src/pmapprot2.c +++ b/src/pmapprot2.c @@ -38,6 +38,10 @@ #include <rpc/xdr.h> #include <rpc/pmapprot.h> +#ifndef PMAPLISTDECODEMAXNODES +#define PMAPLISTDECODEMAXNODES 1024U +#endif + boolt xdrpmaplist(XDR xdrs, struct pmaplist rp) { @@ -53,6 +57,7 @@ xdrpmaplist(XDR xdrs, struct pmaplist rp) boolt moreelements; int freeing; struct pmaplist next = NULL; / pacify gcc / + uint decodednodes = 0; freeing = (xdrs->xop == XDRFREE); @@ -67,6 +72,12 @@ xdrpmaplist(XDR xdrs, struct pmaplist rp) if (! moreelements) return (TRUE); + if (xdrs->xop == XDRDECODE) { + if (++decodednodes > PMAPLISTDECODEMAXNODES) { + return (FALSE); + } + } + if (freeing) next = &((rp)->pmlnext); if (! xdrreference(xdrs, (caddrt )rp, ------ This report was generated using AI technology. Always review AI-generated content prior to use
An infinite loop vulnerability was found in libtirpc before version 1.0.2-rc2. With the port to using poll rather than select, exhaustion of file descriptors would cause the server to enter an infinite loop, consuming a large amount of CPU time and denying service to other clients until restarted.