You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] netutils/xmlrpc: xmlrpc_parseparam never bounds argsize against MAX_ARGS, overflowing the fixed args[10]/arguments[10] in the static g_xmlcall (remote global buffer overflow) #3902
The XML-RPC request parser stores one entry per <param> into the fixed arrays args[MAX_ARGS] and arguments[MAX_ARGS] (MAX_ARGS == 10, include/netutils/xmlrpc.h:75) inside the static g_xmlcall (netutils/xmlrpc/xmlparser.c:74), indexing by argsize and incrementing it per parameter — with no check against MAX_ARGS, and the driver loop has no cap either.
Driver xmlrpc_parseparams() loops while (1) (:288) with one argsize++ per <param> and no cap. For argsize >= 10, arguments[argsize] / args[argsize] write past the arrays; the <string> path writes attacker bytes, the int/double paths write attacker values. The struct layout (xmlrpc.h:93) is arguments[10], args[10], argsize, int arg, response[2048], error, so once the overflow reaches argsize itself the index becomes attacker-influenced.
Scope note: writes land in the static g_xmlcall and then into whatever the linker places after it in .bss. g_entries (the handler table, xmlparser.c:76) is a separate static; whether the overflow reaches it is link-order dependent, so control-flow hijack is possible-but-unproven — the reliable outcome is global-state corruption / crash.
Steps:
Build and run the in-tree example XML-RPC server (examples/xmlrpc, CONFIG_EXAMPLES_XMLRPC) — this is the only in-tree consumer of xmlrpc_parse, and it is opt-in, not a default build.
Send one unauthenticated HTTP POST whose body is a methodCall with more than ten <param><value><string>…</string></value></param> elements.
xmlrpc_parse (xmlparser.c:363) → xmlrpc_parseparams → xmlrpc_parseparam writes the 11th parameter past args[10].
Reproduction: logic-level only — a standalone extraction of the parser under ASan (reports/repro/xmlrpc-argsize-overflow/) shows heap-buffer-overflow WRITE ... 0 bytes to the right of a 10-byte region on the 11th <param>. Not reproduced on a real NuttX build.
Expected: a request with more than MAX_ARGS parameters is rejected. Actual: the write runs past args[10]/arguments[10] into adjacent global state.
Suggested fix: at the top of xmlrpc_parseparam, before the args[argsize] write: if (g_xmlcall.argsize >= MAX_ARGS) return XMLRPC_PARSE_ERROR;
Activity