setMathHelpers leaks history-dependent full ordering of remotables #4261
Labels
audit-zestival
Vulnerability assessment of ERTP + Zoe
bug
Something isn't working
ERTP
package: ERTP
Zoe
package: Zoe
Milestone
POTENTIAL SECURITY BUG
Currently, because the
setMathHelpers
and theamountMath
built on it are static, we have a dilemma leading to an information leak. The algorithms in https://github.com/Agoric/agoric-sdk/blob/master/packages/store/src/keys/merge-set-operators.js benefit tremendously by being able to fully order a set of elements, not just rank[1] sort them. However, remotables a) can be elements of sets, and b) cannot be objectively ordered. As an expedient temporary measure, athttps://github.com/Agoric/agoric-sdk/blob/5ac65ecdfeed42be99f9316172b2799f70e37562/packages/ERTP/src/mathHelpers/setMathHelpers.js#L21-27
we capture a history-dependent full order into a top level variable, which is therefore mutable static state than can be used as a communications channel. Although the comparator itself is not exposed, the order of the resulting arrays is visible, which is equivalent in power.
The proper solution to this is a breaking change where the setMathHelper, and an amountMath using it are multiply instantiated, and each ERTP issuer locally makes its own instance. Note that there is no distributed coordination needed in any case, as the setMathHelper
coerce
function will always first reorder based on its own full comparator.This communications channel is not an immediate concern, since we're currently running on a public chain that is fully transparent (no confidentiality, can keep no secrets) anyway. All the info that's leaked is already public info, and so no one can rely on it being secret anyway.
Array.prototype.sort
is a stable sort, where the whole concept of a stable sort is only meaningful for a rank order. For a full order, there's no observable difference between a stable sort and a non-stable sort. The objectivecompareRank
function defines only a rank order that does not leak information. But such orderings are too weak to enable the algorithms in merge-set-operators.js .The text was updated successfully, but these errors were encountered: