Omniscia rain protocol Audit

Rain Protocol Security Audit

Audit Overview

We were tasked with performing an audit of Beehive's codebase and in particular their full Rain protocol implementation.

The protocol consists of multiple components ranging from a novel superficial on-chain VM taking advantage of SSTORE2 operations and view function execution costs to a large contract suite of supportive contracts for facilitating a fund raise, verifiable identities and more.

Over the course of the audit, we identified a major vulnerability in the Rain virtual machine and in particular their mathematical operation implementation of exponention in addition to certain vulnerabilities and potential attack scenarios that we have extensively outlined in their respective finding pages.

We advise the Rain protocol team to consider all vulnerabilities identified, provide remediations for them and to additionally consider all style and gas optimizations that we have advised to ensure the codebase retains the high level it already attains.

Post-Audit Conclusion

The Rain Protocol team assimilated all exhibits outlined in the report to the codebase, provided adequate documentation and material to refute some of the issues, and indicated future plans meant for acknowledged exhibits that will be fixed in an upcoming update.

Additionally, all of our gas optimization and code style findings were integrated in the codebase were deemed sensible.

The code can be considered of very high quality and conforming to a rigorous security standard.

Contracts Assessed

Files in ScopeRepositoryCommit(s)
BlockOps.sol (BOS)rain-protocold90af97f15,
10c9d1cf93
BPoolFeeEscrow.sol (BPF)rain-protocold90af97f15,
10c9d1cf93
Cooldown.sol (COO)rain-protocold90af97f15,
10c9d1cf93
CombineTier.sol (CTR)rain-protocold90af97f15,
10c9d1cf93
CombineTierFactory.sol (CTF)rain-protocold90af97f15,
10c9d1cf93
ERC20Pull.sol (ERC)rain-protocold90af97f15,
10c9d1cf93
ERC20Config.sol (ECC)rain-protocold90af97f15,
10c9d1cf93
ERC20Redeem.sol (ERR)rain-protocold90af97f15,
10c9d1cf93
EmissionsERC20.sol (EER)rain-protocold90af97f15,
10c9d1cf93
ERC20BalanceTier.sol (ERB)rain-protocold90af97f15,
10c9d1cf93
ERC20TransferTier.sol (ERT)rain-protocold90af97f15,
10c9d1cf93
EmissionsERC20Factory.sol (EEC)rain-protocold90af97f15,
10c9d1cf93
ERC20BalanceTierFactory.sol (ERF)rain-protocold90af97f15,
10c9d1cf93
ERC20TransferTierFactory.sol (ECT)rain-protocold90af97f15,
10c9d1cf93
Factory.sol (FAC)rain-protocold90af97f15,
10c9d1cf93
ITier.sol (ITR)rain-protocold90af97f15,
10c9d1cf93
MathOps.sol (MOS)rain-protocold90af97f15,
10c9d1cf93
Phased.sol (PHA)rain-protocold90af97f15,
10c9d1cf93
RainVM.sol (RVM)rain-protocold90af97f15,
10c9d1cf93
ReadOnlyTier.sol (ROT)rain-protocold90af97f15,
10c9d1cf93
ReadWriteTier.sol (RWT)rain-protocold90af97f15,
10c9d1cf93
RedeemableERC20.sol (RER)rain-protocold90af97f15,
10c9d1cf93
RedeemableERC20Factory.sol (REC)rain-protocold90af97f15,
10c9d1cf93
RedeemableERC20ClaimEscrow.sol (REE)rain-protocold90af97f15,
10c9d1cf93
SeedERC20.sol (SER)rain-protocold90af97f15,
10c9d1cf93
SaturatingMath.sol (SMH)rain-protocold90af97f15,
10c9d1cf93
SeedERC20Factory.sol (SEC)rain-protocold90af97f15,
10c9d1cf93
Trust.sol (TRU)rain-protocold90af97f15,
10c9d1cf93
ThisOps.sol (TOS)rain-protocold90af97f15,
10c9d1cf93
TierOps.sol (TOP)rain-protocold90af97f15,
10c9d1cf93
TierReport.sol (TRT)rain-protocold90af97f15,
10c9d1cf93
TrustEscrow.sol (TEW)rain-protocold90af97f15,
10c9d1cf93
TrustFactory.sol (TFY)rain-protocold90af97f15,
10c9d1cf93
TierConstants.sol (TCS)rain-protocold90af97f15,
10c9d1cf93
TierwiseCombine.sol (TCE)rain-protocold90af97f15,
10c9d1cf93
TierByConstruction.sol (TBC)rain-protocold90af97f15,
10c9d1cf93
Verify.sol (VER)rain-protocold90af97f15,
10c9d1cf93
VMState.sol (VMS)rain-protocold90af97f15,
10c9d1cf93
ValueTier.sol (VTR)rain-protocold90af97f15,
10c9d1cf93
VerifyTier.sol (VTE)rain-protocold90af97f15,
10c9d1cf93
VerifyFactory.sol (VFY)rain-protocold90af97f15,
10c9d1cf93
VerifyConstants.sol (VCS)rain-protocold90af97f15,
10c9d1cf93
VerifyTierFactory.sol (VTF)rain-protocold90af97f15,
10c9d1cf93

Audit Synopsis

SeverityIdentifiedAlleviatedPartially AlleviatedAcknowledged
1100
6402
171403
3121110

During the audit, we filtered and validated a total of 7 findings utilizing static analysis tools as well as identified a total of 48 findings during the manual review of the codebase. We strongly recommend that any minor severity or higher findings are dealt with promptly prior to the project's launch as they introduce potential misbehaviours of the system as well as exploits.

pie title Total Issues "Major" : 1 "Medium" : 6 "Minor" : 17 "Informational" : 31

The list below covers each segment of the audit in depth and links to the respective chapter of the report: