The analysis of the provided vulnerability description and commit patches reveals a critical flaw in how transaction outputs are handled when using a remote storage provider. The root cause is a failure to validate that the transaction outputs returned by the storage server match the outputs requested by the client application.
The primary vulnerable function is buildSignableTransaction. Prior to the patches, this function would construct a transaction using the lockingScript directly from the storage server's response for any non-change outputs. This created a window for a malicious or compromised storage server to substitute the intended recipient's address with an attacker's address. The patches 5492cabbef4ddc7f60cc49cdf5d8c74ed2e5d949 and 3a11f6111919245a3090e9f3895cfc4f21a80d28 directly address this by introducing two new verification functions, verifyRequestedOutputsUnchanged and verifyUnrequestedOutputsAreChangeOrCommission, within buildSignableTransaction. These new functions ensure that the user-requested outputs are not altered and that no unexpected malicious outputs are injected.
A secondary, but related, vulnerable function is WalletPermissionsManager.createAction. As described in the vulnerability summary, this function had the opportunity to act as a safeguard by validating the final transaction's outputs against the initial request before signing. However, it failed to do so, instead only checking inputs and fees. The changelog from the release commit confirms that a defense-in-depth fix was added here, highlighting its role in the vulnerability.