Tainted computations
RLBox does not permit some operations on tainted values for safety reasons
- Using a
tainted<unsigned int>
to index an array in the host, i.e.,int[]
. This can lead to an out of bounds array access if allowed. - Branching on a tainted value, i.e.,
if
conditions with tainted values in the condition,for
loops with tainted values in the condition. The only exception here is comparing a tainted pointer tonullptr
. So assumingret
is atainted<int>
, code of the formif (ret == 4) {...}
would not be allowed. This is because any scenario where an application's control flow is determined by a tainted value is inevitably going to result in security issues. Thus, RLBox returnstainted<bool>
during comparisons likeret == 4
which do not allow branching or loops. You can, of course, try to verify thetainted<bool>
usingcopy_and_verify
, or better, verifyret
prior to comparison to avoid this issue. - Any form of comparison on the result of dereferencing a tainted pointer.
Concretely, code of the form
would not compile. This is because dereferencing a tainted pointer refers to a location in the sandbox's memory, and the sandbox could change that at any moment. To represent the volatility of this comparison, RLBox returns a new typetainted<int*> a = ...; tainted<bool> b = *(*a == 4)*;
tainted_bool_hint
with the result of this comparison.