Reported-by: michael1011 Fixes: https://github.com/ElementsProject/lightning/issues/8828 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: plugins: `pay` can crash on errors returned from deep inside routehints.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version
What changed, and why it matters
This commit fixes a crash in Core Lightning's `pay` plugin. When processing a payment failure, the plugin assumed that the reported error location was always within the known payment route. In some cases—likely involving multi-hop route hints—the reported index could be larger than the route array, causing an assertion failure that killed the plugin and, because the plugin is marked as important, shut down the entire `lightningd` node. The fix replaces the crash with a safe early return.
Recommended action
Apply the patch. Because the crash can be triggered by a payment failure response, operators should upgrade nodes that process untrusted payments. Consider reviewing other assertion-based bounds checks in plugin error paths for similar assumptions.
Security signals we found
01
Denial-of-service vector: remote-triggered assertion failure in important plugin
02
Crash in payment error-handling path
03
Out-of-bounds index validation hardened from assert to runtime check
In plugins/libplugin-pay.c, payment_result_infer() previously used assert(i <= len) to validate r->erring_index against tal_count(route). The commit changes this to a runtime check: if i > len, the function returns early. This prevents an abort when an error index points past the end of the route array, which the author hypothesizes may occur with multi-hop routehints. The rest of the function then safely dereferences route[i-1] and route[i] only when the index is in bounds.
diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c
index 2792bc1b..a1895605 100644
--- a/plugins/libplugin-pay.c
+++ b/plugins/libplugin-pay.c
@@ -1196,12 +1196,15 @@ static void payment_result_infer(struct route_hop *route,
len = tal_count(route);
i = *r->erring_index;
- assert(i <= len);
+ /* This can actually be greater than the route length? Perhaps
+ * multi-hop routehints? Ignore. */
+ if (i > len)
+ return;
if (r->erring_node == NULL)
r->erring_node = &route[i-1].node_id;
- /* The above assert was enough for the erring_node, but might be off
+ /* The above check was enough for the erring_node, but might be off
* by one on channel and direction, in case the destination failed on
* us. */
if (i == len)
This commit is a simple documentation revert. It undoes a previous change that told macOS users to install GNU make and GNU patch from Homebrew and to put those tools first in their command path. The reverted instructions now omit gpatch a…
This commit re-adds an old-style 'x' prefix to a string comparison in a test helper script. It is a test-only change with no effect on the actual Core Lightning node software, user funds, network behavior, or security. The change simply re…
This commit only updates macOS installation instructions in the documentation. It tells macOS users to install newer GNU versions of 'make' and 'patch' from Homebrew because Apple's built-in tools are too old for building and running sourc…