OTSea
Smart Contract Security Assessment
Dec 18, 2023
SUMMARY
ABSTRACT
Dedaub was commissioned to perform a security audit of the OTSea platform contracts. The OTSea Protocol is a peer-to-peer exchange where users can buy ERC20 tokens for ETH or sell ERC20 tokens for ETH without going through a liquidity pool, while enjoying extra benefits such as order discounts and private exchange opportunities.
The audit covered the new version of the platform’s main contract, OTSea, which acts as the trusted intermediary between sellers and buyers, and the FeeSplitter contract.
The code and accompanying artifacts (e.g., test suite, documentation) have been developed with high professional standards. No security issues/threats that could lead to theft were identified by the audit. No issues leading to loss of funds resulting from the intended use of the system were identified by the audit.
SETTING & CAVEATS
The audit report covers commit hash 9288e4e10f32bf730ecc0a630c6fbf66007b6dca
of the at the time private repository otsea-smart-contracts. Audited suggested fixes were also reviewed up to commit hash b1515946527a35f50881fb832700340447862593
Two auditors worked on the codebase for 5 days.
The test suite was consulted during the audit but was not part of it. The full list of audited files is:
- fees/
- FeeSplitter.sol
- helpers/
- ListHelper.sol
- SignatureHelper.sol
- TransferHelper.sol
- WhitelistHelper.sol
- libraries/
- OTSeaErrors.sol
- OTSeaLibrary.sol
- otc/
- OTSea.sol
The audit’s main target is security threats, i.e., what the community understanding would likely call "hacking", rather than the regular use of the protocol. Functional correctness (i.e. issues in "regular use") is a secondary consideration. Typically it can only be covered if we are provided with unambiguous (i.e. full-detail) specifications of what is the expected, correct behavior. In terms of functional correctness, we often trusted the code’s calculations and interactions, in the absence of any other specification. Functional correctness relative to low-level calculations (including units, scaling and quantities returned from external protocols) is generally most effectively done through thorough testing rather than human auditing.
PROTOCOL-LEVEL CONSIDERATIONS
The OTSea protocol allows the exchange of any token that implements the ERC20 standard. The OTSea contracts do not impose any other restriction or check on the tokens one could sell or buy. Users of the protocol should be aware of this fact and should not trust but verify that the tokens they are exchanging are legitimate and not malicious or scam tokens, as such a token could arbitrarily change users' balances and its total supply, disallow transfers, transfer incorrect amounts, report incorrect balances, etc. The OTSea team is implementing a warning system on their front-end app to protect users from interacting with such tokens, but as this is an ever changing landscape users should be aware that such a system might not always successfully identify a malicious token. The audit results suggest that an adversary would not be able to use a malicious token to extract funds without the users’ consent.
VULNERABILITIES & FUNCTIONAL ISSUES
This section details issues affecting the functionality of the contract. Dedaub generally categorizes issues according to the following severities, but may also take other considerations into account such as impact or difficulty in exploitation:
- User or system funds can be lost when third-party systems misbehave.
- DoS, under specific conditions.
- Part of the functionality becomes unusable due to a programming error.
- Breaking important system invariants but without apparent consequences.
- Buggy functionality for trusted users where a workaround exists.
- Security issues which may manifest when the system evolves.
Issue resolution includes “dismissed” or “acknowledged” but no action taken, by the client, or “resolved”, per the auditors.