M-1: Revoked KYC holders can liquidate DealVault positions through the MatchingEngine
Summary:
The MatchingEngine validates the KYC status of each order's receiver, but it does not validate the DealVault seller identified by the ask order's payer. A holder whose KYC token has been frozen or revoked can therefore continue controlling and liquidating the position by directing the sale proceeds to another KYC address.
Description:
Both posting and secondary-market matching check only the receiver:
// MatchingEngine.postOrder()
_isKYC(_signedOrder.order.receiver);
// MatchingEngine.matchOrders()
_isKYC(_bidMatch.signedOrder.order.receiver);
_isKYC(_askMatch.signedOrder.order.receiver);
For a DealVault ask, however, settlement transfers shares directly from ask.payer, not from ask.receiver:
DealVault(_bidOrder.instrument).transferDeal(
_askOrder.payer,
_bidOrder.receiver,
uint96(_bidOrder.trancheId),
_instrumentAmount - instrumentFee
);
DealVault.transferDeal() authorizes the MatchingEngine as the caller but does not validate the current KYC status of _from. Consequently, the following path succeeds through the normal PRE_WINDOW flow:
- A KYC-approved seller acquires DealVault shares.
- The seller's KYC token is subsequently frozen or revoked, for example after the wallet is reported compromised.
- The old wallet posts or signs an ask with itself as
payerand another KYC address asreceiver. - A normal KYC and BLP-whitelisted buyer posts a crossing bid.
- The orders are matched because both receivers pass KYC validation.
- The DealVault shares leave the revoked wallet and the stablecoin proceeds are sent to the seller-selected KYC receiver.
Impact:
Medium. KYC revocation is intended to prevent the revoked holder from continuing to control or liquidate its DealVault position. Because the seller's KYC status is not checked, the revoked wallet can nevertheless dispose of its entire position through the ordinary secondary-market path, potentially affecting its full value without malicious operator behavior. This defeats both compromised-wallet recovery and compliance-driven asset restrictions, while allowing the proceeds to be redirected to another KYC address. Exploitation does, however, require access to a KYC proceeds receiver and sufficient matching liquidity.
Recommendation:
In the paired secondary-market branch of MatchingEngine.matchOrders(), validate the ask payer after determining whether the instrument is a MasterVault:
if (!isMasterVault) {
_isKYC(_askMatch.signedOrder.order.payer);
}
Performing this check during matching ensures that a DealVault ask cannot execute if the seller's KYC is revoked after the order was posted, while preserving the existing payer/receiver separation for purchases and MasterVault orders.
Developer Response:
Mitigated in PR #320, commit 7eb34298. DealVault secondary settlement now checks the ask payer’s current KYC, preventing revoked or frozen sellers from routing proceeds to another eligible receiver. Tests cover signed orders, revocation after posting, and valid payer/receiver separation. MasterVault behaviour remains unchanged.