Download audit report
This document presents the security review performed by Nethermind on the PWN Contracts. PWN Finance is a DeFi solution for lending and borrowing tokens following ERC20, ERC721, ERC1155, and CryptoKitties standard. The protocol has an offer/request mechanism created off-chain to be fulfilled by a borrower/lender. PWN solves the possibility of under-collateralizing assets through a fixed amount of return of assets specified when the offer/request is created. PWN uses the MultiToken to interact with multiple types of assets in a single interface, providing functionalities such as transferring assets, approving allowance, and checking balances of a particular asset based on a certain category.
The audited code consists of 1,037 lines of Solidity with code coverage of 92.3%. The PWN team provided the developer docs, which contains most of the info required for understanding the system. The audit was performed using (a) manual analysis of the codebase, (b) automated analysis tools, and (c) simulation of the smart contracts.
| Audit assessment | |
| Audit Type | Security Review |
| Initial Report | Mar. 13, 2023 |
| Response from Client | Mar. 20, 2023 |
| Final Report | Mar. 27, 2023 |
| Methods | Manual Review, Automated Analysis |
| Repository | PWN |
| Commit Hash (Initial Audit) | 455e8f7d5a |
| Commit Hash (Reaudit) | 13c67a5c74 |
| Documentation | PWN Developer Docs |
| Documentation Assessment | Medium |
| Test Suite Assessment | High |
Findings by severity
PWN is a hub for peer-to-peer (P2P) loans backed by digital assets (DAI, LINK, APE, NFTs, and others) as collateral, and receive any ERC20 assets for the same. The borrower has the flexibility to provide any standard ERC20, ERC721, ERC1155 and CryptoKitties token. The lender can earn interest on the asset provided. The codebase is organized in the folders, as shown in Fig. 2.

lib/MultiToken/MultiToken.solThis library provides functionalities for transferring assets of different categories. The library has the following imports.
import "openzeppelin-contracts/contracts/interfaces/IERC20.sol";
import "openzeppelin-contracts/contracts/interfaces/IERC721.sol";
import "openzeppelin-contracts/contracts/interfaces/IERC1155.sol";
import "openzeppelin-contracts/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "./interfaces/ICryptoKitties.sol";Thus, we can notice that the protocol supports ERC20, ERC721, ERC1155 and CryptoKitties tokens, as illustrated in the enum Category reproduced below.
enum Category {
ERC20,
ERC721,
ERC1155,
CryptoKitties
}Each asset is stored in the structure Asset reproduced below. The field category indicates the asset category according to the enum Category. The field assetAddress indicates the contract address defining the asset. The field id indicates the TokenID when the asset is an NFT. The field amount indicates the number of fungible tokens.
struct Asset {
Category category;
address assetAddress;
uint256 id;
uint256 amount;
}The transfer functionalities are implemented using the six functions listed below.
function transferAssetFrom(Asset memory asset, address source, address dest) internal;
function safeTransferAssetFrom(Asset memory asset, address source, address dest) internal;
function _transferAssetFrom(Asset memory asset, address source, address dest, bool isSafe) internal;
function transferAssetFromCalldata(Asset memory asset, address source, address dest, bool fromSender) pure internal returns (bytes memory);
function safeTransferAssetFromCalldata(Asset memory asset, address source, address dest, bool fromSender) pure internal returns (bytes memory);
function _transferAssetFromCalldata(Asset memory asset, address source, address dest, bool fromSender, bool isSafe) pure private returns (bytes memory);The library also implements one function for granting approval via permit signature, which can be standard (65 bytes) or compact (64 bytes) defined in the EIP-2098.
function permit(Asset memory asset, address owner, address spender, bytes memory permitData) internal;The balance on various token interfaces can be queried using the function balanceOf(...).
function balanceOf(Asset memory asset, address target) internal view returns (uint256);The tokens’ approval can be performed using the function approveAsset(...).
function approveAsset(Asset memory asset, address target) internal;Finally, the library also has two helper functions. The function isValid(...) returns if a given structure Asset is valid or not, while the function isSameAs(...) returns if two assets are equal.
function isValid(Asset memory asset) internal pure returns (bool);
function isSameAs(Asset memory asset, Asset memory otherAsset) internal pure returns (bool);src/configThis folder holds the contract PWNConfig.sol, which provides configurable values for the PWN protocol. The contract has the following imports.
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/proxy/utils/Initializable.sol";The contract has three state variables. The fee is stored as an uint16 having the precision of two decimal digits, i.e., the value 100 indicates 1% of fee. All the fees collected by the protocol are sent to the feeCollector address. The contract also stores one mapping that relates the loan contract address to the loan token metadata uri. These state variables are reproduced below.
uint16 public fee;
address public feeCollector;
mapping (address => string) public loanMetadataUri;The contract provides initialization and re-initialization functionalities. Fees management is performed using the function setFee(...), while the fees collector is set using the function setFeeCollector(...). Both functions can only be called by the contract owner.
function setFee(uint16 _fee) external onlyOwner;
function _setFee(uint16 _fee) private;
function setFeeCollector(address _feeCollector) external onlyOwner;
function _setFeeCollector(address _feeCollector) private;The contract also has the function setLoanMetadataUri(...), which assigns a metadataUri to a loanContract, only callable by the contract owner.
function setLoanMetadataUri(address loanContract, string memory metadataUri) external onlyOwner;src/deployerThis folder has two contracts: a) PWNContractDeployerSalt.sol; and, b) PWNDeployer.sol. The contract PWNContractDeployerSalt.sol is only a placeholder for constants used by the PWN protocol, while the contract PWNDeployer.sol presents the logic for deploying a release of the protocol. The contract PWNDeployer.sol has the following imports.
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/utils/Create2.sol";The contract offers three functions. The function deploy(...) receives the bytecode and the salt for deploying a new contract at a deterministic address. The address where the contract will be deployed can be queried using the function computeAddress(...). In addition, the contract also offers the function deployAndTransferOwnership(...) that performs the deployment and transfers the ownership to the owner.
function deploy(bytes32 salt, bytes memory bytecode) external onlyOwner returns (address);
function deployAndTransferOwnership(bytes32 salt, address owner, bytes memory bytecode) external onlyOwner returns (address deployedContract);
function computeAddress(bytes32 salt, bytes32 bytecodeHash) external view returns (address);src/hubThis folder has three contracts. The contract PWNHubTags.sol is just a placeholder for constants. The contract PWNHub.sol connects the PWN contracts into the protocol. The contract PWNHubAccessControl.sol is an abstract contract that implements access control modifiers for the PWN Hub.
PWNHubAccessControl.solThe abstract contract PWNHubAccessControl.sol has the following imports.
import "@pwn/hub/PWNHub.sol";
import "@pwn/hub/PWNHubTags.sol";
import "@pwn/PWNErrors.sol";The contract has only one storage variable, which is immutable. This variable is set in the constructor(...) to the address of the contract PWNHub.sol.
PWNHub immutable internal hub;
constructor(address pwnHub) {
hub = PWNHub(pwnHub);
}The contract also has two modifiers. The modifier onlyActiveLoan() checks if msg.sender has the tag PWNHubTags.ACTIVE_LOAN, while the modifier onlyWithTag(bytes32 tag) checks if msg.sender has the tag specified as an argument. Both modifiers are presented below.
modifier onlyActiveLoan() {
if (hub.hasTag(msg.sender, PWNHubTags.ACTIVE_LOAN) == false)
revert CallerMissingHubTag(PWNHubTags.ACTIVE_LOAN);
_;
}
modifier onlyWithTag(bytes32 tag) {
if (hub.hasTag(msg.sender, tag) == false)
revert CallerMissingHubTag(tag);
_;
}PWNHubTags.solThe list of tags can be found in the library PWNHubTags.sol. The tags are: ACTIVE_LOAN, SIMPLE_LOAN_TERMS_FACTORY, LOAN_REQUEST, LOAN_OFFER, as reproduced below.
library PWNHubTags {
string internal constant VERSION = "1.0";
/// @dev Address can mint LOAN tokens and create LOANs via loan factory contracts.
bytes32 internal constant ACTIVE_LOAN = keccak256("PWN_ACTIVE_LOAN");
/// @dev Address can be used as a loan terms factory for creating simple loans.
bytes32 internal constant SIMPLE_LOAN_TERMS_FACTORY = keccak256("PWN_SIMPLE_LOAN_TERMS_FACTORY");
/// @dev Address can revoke loan request nonces.
bytes32 internal constant LOAN_REQUEST = keccak256("PWN_LOAN_REQUEST");
/// @dev Address can revoke loan offer nonces.
bytes32 internal constant LOAN_OFFER = keccak256("PWN_LOAN_OFFER");
}PWNHub.solThe contract PWNHub.sol has the following imports:
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "@pwn/PWNErrors.sol";The contract has only one storage variable that maps the contract address and a tag to a boolean value indicating if the tag is true or false.
mapping (address => mapping (bytes32 => bool)) private tags;The contract has only three functions: a) setTag(...); b) setTags(...); and, c) hasTag(...). The function setTag(address _address, bytes32 tag, bool _hasTag) receives as arguments the _address, the tag, and the Boolean _hasTagvalue indicating if that given address has the tag or not. The function can only be called by the contract owner.
function setTag(address _address, bytes32 tag, bool _hasTag) public onlyOwner {}The function setTags(...) iterates over an array of addresses and tags, calling the function setTag(...).
function setTags(address[] memory _addresses, bytes32[] memory _tags, bool _hasTag) external onlyOwner {}Finally, the contract also has the function hasTag(...), which is a standard getter function.
function hasTag(address _address, bytes32 tag) external view returns (bool) {}src/loanPWNVault.solThis is implemented as an abstract contract that is the basis for transferring and managing collateral and loan assets in the PWN protocol. It contains transfer functions, hooks, and interface checks. The transfer functions rely on the MultiToken.sol implementation.
using MultiToken for MultiToken.Asset;The internal function _pull(...) transfers the assets into the vault.
function _pull(MultiToken.Asset memory asset, address origin) internal {}The function _push(...) pushes the asset from the vault to a given recipient.
function _push(MultiToken.Asset memory asset, address beneficiary) internal {}The function _pushFrom(...) transfers an asset from a lender to a borrower.
function _pushFrom(MultiToken.Asset memory asset, address origin, address beneficiary) internal {}The function _permit(...) sets the vault allowance for an asset using a signed permit.
function _permit(MultiToken.Asset memory asset, address origin, bytes memory permit) internal {}The contract also implements receive hooks for the ERC721 and ERC1155.
function onERC721Received(
address operator,
address /*from*/,
uint256 /*tokenId*/,
bytes calldata /*data*/
) override external view returns (bytes4) {}
function onERC1155Received(
address operator,
address /*from*/,
uint256 /*id*/,
uint256 /*value*/,
bytes calldata /*data*/
) override external view returns (bytes4) {}The function onERC1155BatchReceived(...) is not supported in this version of Vault and is reverted, as shown below.
function onERC1155BatchReceived(
address /*operator*/,
address /*from*/,
uint256[] calldata /*ids*/,
uint256[] calldata /*values*/,
bytes calldata /*data*/
) override external pure returns (bytes4) {
revert UnsupportedTransferFunction();
}Finally, the contract implements the function supportsInterface(...) to return the supported interfaces
function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool) {}lib/PWNFeeCalculator.solThe library has only one function responsible for computing the fee amount. The function is shown below.
function calculateFeeAmount(uint16 fee, uint256 loanAmount) internal pure returns (uint256 feeAmount, uint256 newLoanAmount) {}lib/PWNSignatureChecker.solThe library has only one function responsible for checking the signature using the standard (65 bytes) or compact (64 bytes) defined by EIP-2098.
function isValidSignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) {}token/PWNLOAN.solThe contract PWNLOAN.sol inherits from PWNHubAccessControl, IERC5646 and ERC721, and has the following imports:
import "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import "@pwn/hub/PWNHubAccessControl.sol";
import "@pwn/loan/token/IERC5646.sol";
import "@pwn/loan/token/IPWNLoanMetadataProvider.sol";
import "@pwn/PWNErrors.sol";The contract has two storage variables that track the last loan id, and the mapping from the loan id to the loan contract.
uint256 public lastLoanId;
mapping (uint256 => address) public loanContract;The contract has five functions: a) mint(...); b) burn(...); c) tokenURI(...); d) getStateFingerPrint(...); and e) supportsInterface(...). The function mint(...) and burn(...) are used to create and delete LOAN Tokens for a particular owner based on a certain loanId.
function mint(address owner) external onlyActiveLoan returns (uint256 loanId) {}
function burn(uint256 loanId) external {}The function tokenURI(...) returns the LOAN Token Metadata URI.
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {}The function getStateFingerprint(...) is used to return the current token state fingerprint defined by EIP-5646.
function getStateFingerprint(uint256 tokenId) external view virtual override returns (bytes32) {}And the final function supportsInterface(...) which checks if the provided interfaceId is valid, along with if the interfaceId is the same interface id of ERC5646.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {}terms/PWNLOANTerms.solThe library has only one structure Simple which defines the terms of a simple loan.
struct Simple {
address lender;
address borrower;
uint40 expiration;
bool lateRepaymentEnabled;
MultiToken.Asset collateral;
MultiToken.Asset asset;
uint256 loanRepayAmount;
}terms/simple/loan/PWNSimpleLoan.solThe contract PWNSimpleLoan.sol inherits from PWNVault, IERC5646 IPWNLoanMetadataProvider, and has the following imports:
import "MultiToken/MultiToken.sol";
import "@pwn/config/PWNConfig.sol";
import "@pwn/hub/PWNHub.sol";
import "@pwn/hub/PWNHubTags.sol";
import "@pwn/loan/lib/PWNFeeCalculator.sol";
import "@pwn/loan/terms/PWNLOANTerms.sol";
import "@pwn/loan/terms/simple/factory/IPWNSimpleLoanTermsFactory.sol";
import "@pwn/loan/token/IERC5646.sol";
import "@pwn/loan/token/PWNLOAN.sol";
import "@pwn/loan/PWNVault.sol";
import "@pwn/PWNErrors.sol";The contract has three immutable storage and a mapping. The mapping stores all the data of a Loan based on a loan id.
PWNHub immutable internal hub;
PWNLOAN immutable internal loanToken;
PWNConfig immutable internal config;
mapping (uint256 => LOAN) private LOANs;It also contains a structure LOAN, which defines a simple loan.
struct LOAN {
uint8 status;
address borrower;
uint40 expiration;
bool lateRepaymentEnabled;
address loanAssetAddress;
uint256 loanRepayAmount;
MultiToken.Asset collateral;
}The contract has mainly four state-changing external functions: a) createLOAN(...); b) repayLOAN(...); c) claimLOAN(...); and d) enableLOANLateRepayment(...).
The function createLOAN(...) is used to create a Loan with particular collateral and asset. loanTerms are taken from a loanTermsFactoryContract specified in the calldata. Collateral is checked for validity, and then LOAN Token is minted to the lender. Collateral is transferred to the Loan Contract, the fee is read from config, and the corresponding fee is transferred to the feeCollector, and the rest of the amount is transferred to the borrower.
function createLOAN(
address loanTermsFactoryContract,
bytes calldata loanTermsFactoryData,
bytes calldata signature,
bytes calldata loanAssetPermit,
bytes calldata collateralPermit
) external returns (uint256 loanId) {}The function repayLOAN is used by the borrower to repay the LOAN with a particular loanId. loanId is checked for existence and invalid loan status. It is ensured that the loan has not expired, and if it has expired, it is checked if later repayment is enabled. If all conditions are satisfied, the loan is repaid to the Loan Contract, and the collateral from Loan Contract is returned to the borrower.
function repayLOAN(
uint256 loanId,
bytes calldata loanAssetPermit
) external {}The function claimLOAN is used by the lender to claim the loan proceeds with a particular loanId. Only the owner of the LOAN Token with the same loanId passed as calldata can call this function. The loan status is checked for mainly three cases: (a) Existence; (b) Repaid Loan; and (c) Expired Loan. In case (a), the call reverts. In case (b), the LOAN Token is burned from the caller, and the asset, along with interest, is paid back to the caller. In case (c), the LOAN Token is burned from the caller, and the collateral is sent to the caller.
function claimLOAN(uint256 loanId) external {}The function enableLOANLateRepayment is used by the lender to allow late payment for a particular loanId. Only the owner of the LOAN Token with the same loanId passed as calldata can call this function. The call will revert if late repayment is already enabled. The loan has to be ongoing for this call to succeed.
function enableLOANLateRepayment(uint256 loanId) external {}terms/simple/factory/request/PWNSimpleLoanSimpleRequest.solThe contract PWNSimpleLoanSimpleRequest.sol inherits from PWNSimpleLoanRequest, and has the following imports:
import "MultiToken/MultiToken.sol";
import "@pwn/loan/lib/PWNSignatureChecker.sol";
import "@pwn/loan/terms/simple/factory/request/base/PWNSimpleLoanRequest.sol";
import "@pwn/loan/terms/PWNLOANTerms.sol";
import "@pwn/PWNErrors.sol";The contract has two constant and one immutable storage, which stores the version, request typehash, and domain separator.
string internal constant VERSION = "1.0";
bytes32 constant internal REQUEST_TYPEHASH = keccak256(
"Request(uint8 collateralCategory,address collateralAddress,uint256 collateralId,uint256 collateralAmount,address loanAssetAddress,uint256 loanAmount,uint256 loanYield,uint32 duration,uint40 expiration,address borrower,address lender,bool lateRepaymentEnabled,uint256 nonce)"
);
bytes32 immutable internal DOMAIN_SEPARATOR;It also contains a structure Request, which defines a simple request.
struct Request {
MultiToken.Category collateralCategory;
address collateralAddress;
uint256 collateralId;
uint256 collateralAmount;
address loanAssetAddress;
uint256 loanAmount;
uint256 loanYield;
uint32 duration;
uint40 expiration;
address borrower;
address lender;
bool lateRepaymentEnabled;
uint256 nonce;
}The contract has mainly two state-changing external functions: a) makeRequest(...); b) createLOANTerms(...). The function makeRequest() creates an on-chain request. It has a calldata request which contains all the details of the loan request as a structure parameter. The function createLOANTerms(...) creates a simple loan term from the provided info as calldata. The request data is decoded from factoryData, and the signature is checked for validity, ensuring that the request is not expired already and no revoke is initiated for the particular request. As this is a request, the lender cannot be a zero address. If every check is passed, a loanTerms is created and returned with this function call.
function makeRequest(Request calldata request) external {}
function createLOANTerms(
address caller,
bytes calldata factoryData,
bytes calldata signature
) external override onlyActiveLoan returns (PWNLOANTerms.Simple memory loanTerms) {}terms/simple/factory/request/base/PWNSimpleLoanRequest.solThe abstract contract PWNSimpleLoanRequest.sol inherits from IPWNSimpleLoanTermsFactory and PWNHubAccessControl, and has the following imports:
import "@pwn/hub/PWNHubAccessControl.sol";
import "@pwn/loan/terms/simple/factory/IPWNSimpleLoanTermsFactory.sol";
import "@pwn/nonce/PWNRevokedNonce.sol";
import "@pwn/PWNErrors.sol";The contract has one immutable storage and mapping, which stores the revoked request nonces and bool status of requests made.
PWNRevokedNonce immutable internal revokedRequestNonce;
mapping (bytes32 => bool) public requestsMade;The contract has mainly one state-changing external function revokeRequestNonce(...). The function revokeRequestNonce(...) revokes the nonce of the caller.
function revokeRequestNonce(uint256 requestNonce) external {}terms/simple/factory/offer/PWNSimpleLoanListOffer.solThe contract PWNSimpleLoanListOffer.sol inherits from PWNSimpleLoanOffer, and has the following imports:
import "MultiToken/MultiToken.sol";
import "openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import "@pwn/loan/lib/PWNSignatureChecker.sol";
import "@pwn/loan/terms/simple/factory/offer/base/PWNSimpleLoanOffer.sol";
import "@pwn/loan/terms/PWNLOANTerms.sol";
import "@pwn/PWNErrors.sol";The contract has two constant and one immutable storage, which stores the version, and offers typehash and domain separator.
string internal constant VERSION = "1.0";
bytes32 constant internal OFFER_TYPEHASH = keccak256(
"Offer(uint8 collateralCategory,address collateralAddress,bytes32 collateralIdsWhitelistMerkleRoot,uint256 collateralAmount,address loanAssetAddress,uint256 loanAmount,uint256 loanYield,uint32 duration,uint40 expiration,address borrower,address lender,bool isPersistent,bool lateRepaymentEnabled,uint256 nonce)"
);
bytes32 immutable internal DOMAIN_SEPARATOR;It also contains the structure Request, which defines a simple list offer.
struct Offer {
MultiToken.Category collateralCategory;
address collateralAddress;
bytes32 collateralIdsWhitelistMerkleRoot;
uint256 collateralAmount;
address loanAssetAddress;
uint256 loanAmount;
uint256 loanYield;
uint32 duration;
uint40 expiration;
address borrower;
address lender;
bool isPersistent;
bool lateRepaymentEnabled;
uint256 nonce;
}And another structure OfferValues, which defines Offer values.
struct OfferValues {
uint256 collateralId;
bytes32[] merkleInclusionProof;
}The contract has mainly two state-changing external functions: a) makeOffer(...); b) createLOANTerms(...). The function makeOffer(...) creates an on-chain offer. It has a calldata offer, which contains all the details of the loan offer as a structure parameter. The function createLOANTerms(...) creates a simple loan term from the provided info as calldata. The offer and offerValues data is decoded from factoryData, and the signature is checked for validity, ensuring that the offer is not expired already. No revoke is initiated for the particular offer, and in this case, it is also checked that the collateral is verified. As this is a offer, the borrower cannot be a zero address. If every check is passed, a loanTerms is created and returned with this function call.
function makeOffer(Offer calldata offer) external {}
function createLOANTerms(
address caller,
bytes calldata factoryData,
bytes calldata signature
) external override onlyActiveLoan returns (PWNLOANTerms.Simple memory loanTerms) {}terms/simple/factory/offer/PWNSimpleLoanSimpleOffer.solThe contract PWNSimpleLoanSimpleOffer.sol inherits from PWNSimpleLoanOffer, and has the following imports:
import "MultiToken/MultiToken.sol";
import "@pwn/loan/lib/PWNSignatureChecker.sol";
import "@pwn/loan/terms/simple/factory/offer/base/PWNSimpleLoanOffer.sol";
import "@pwn/loan/terms/PWNLOANTerms.sol";
import "@pwn/PWNErrors.sol";The contract has two constant and one immutable storage, which stores the version, offer typehash and domain separator.
string internal constant VERSION = "1.0";
bytes32 constant internal OFFER_TYPEHASH = keccak256(
"Offer(uint8 collateralCategory,address collateralAddress,uint256 collateralId,uint256 collateralAmount,address loanAssetAddress,uint256 loanAmount,uint256 loanYield,uint32 duration,uint40 expiration,address borrower,address lender,bool isPersistent,bool lateRepaymentEnabled,uint256 nonce)"
);
bytes32 immutable internal DOMAIN_SEPARATOR;It also contains a structure Request, which defines a simple list offer.
struct Offer {
MultiToken.Category collateralCategory;
address collateralAddress;
uint256 collateralId;
uint256 collateralAmount;
address loanAssetAddress;
uint256 loanAmount;
uint256 loanYield;
uint32 duration;
uint40 expiration;
address borrower;
address lender;
bool isPersistent;
bool lateRepaymentEnabled;
uint256 nonce;
}The contract has mainly two state-changing external functions: a) makeOffer(...); b) createLOANTerms(...). The function makeOffer(...) creates an on-chain offer. It has a calldata offer, which contains all the details of the loan offer as a struct parameter. The function createLOANTerms(...) creates a simple loan term from the provided info as calldata. The offer and offerValues data is decoded from factoryData, the signature is checked for validity, ensured that the offer is not expired already and no revoke is initiated for the particular offer. As this is a offer, the borrower cannot be a zero address. If every check is passed, a loanTerms is created and returned with this function call.
function makeOffer(Offer calldata offer) external {}
function createLOANTerms(
address caller,
bytes calldata factoryData,
bytes calldata signature
) external override onlyActiveLoan returns (PWNLOANTerms.Simple memory loanTerms) {}terms/simple/factory/offer/base/PWNSimpleLoanOffer.solThe abstract contract PWNSimpleLoanOffer.sol inherits from IPWNSimpleLoanTermsFactory and PWNHubAccessControl, and has the following imports:
import "@pwn/hub/PWNHubAccessControl.sol";
import "@pwn/loan/terms/simple/factory/IPWNSimpleLoanTermsFactory.sol";
import "@pwn/nonce/PWNRevokedNonce.sol";
import "@pwn/PWNErrors.sol";The contract has one immutable storage and mapping, which stores the revoked offer nonces and bool status of offers made.
PWNRevokedNonce immutable internal revokedOfferNonce;
mapping (bytes32 => bool) public offersMade;The contract has mainly one state-changing external function revokeOfferNonce(...). The function revokeOfferNonce(...) revokes the nonce of the caller.
function revokeOfferNonce(uint256 offerNonce) external {}src/nonceThis folder has only the contract PWNRevokedNonce.sol which inherits PWNHubAccessControl. This contract has the following imports.
import "@pwn/hub/PWNHubAccessControl.sol";
import "@pwn/PWNErrors.sol";The contract has three storage variables: a) accessTag; b) revokedNonces; c) minNonces, which stores the tag, revoked nonces and minimum nonce value for a particular address.
bytes32 immutable internal accessTag;
mapping (address => mapping (uint256 => bool)) private revokedNonces;
mapping (address => uint256) private minNonces;The contract has mainly three state-changing external functions: a)revokeNonce(...); b)revokeNonce(...) (Different parameters); c)setMinNonce(...). Both the function revokeNonce(...) is used to revoke a particular nonce of a certain owner. In the first function, it can be used by any caller to revoke the nonce of itself, and in the second function, it can be used by any caller, which has the required accessTag. The function setMinNonce(...) is used to set a minimum nonce value for that particular caller. Any nonce smaller than the minNonce is considered revoked.
function revokeNonce(uint256 nonce) external {}
function revokeNonce(address owner, uint256 nonce) external onlyWithTag(accessTag) {}
function setMinNonce(uint256 minNonce) external {}Fig. 3 shows the structural diagram of the protocol, highlighting the borrow and lend use cases. Legend
The prepared security review is based on the following assumptions:
MultiToken.sol is used within the protocol;The risk rating methodology used by Nethermind Security follows the principles established by the OWASP Foundation. The severity of each finding is determined by two factors: Likelihood and Impact.
Likelihood measures how likely the finding is to be uncovered and exploited by an attacker. This factor will be one of the following values:
When defining the likelihood of a finding, other factors are also considered. These can include but are not limited to motive, opportunity, exploit accessibility, ease of discovery, and ease of exploit.
Impact is a measure of the damage that may be caused if an attacker exploits the finding. This factor will be one of the following values:
When defining the impact of a finding, other factors are also considered. These can include but are not limited to data and state integrity, loss of availability, financial loss, and reputation damage. After defining the likelihood and impact of an issue, the severity is determined according to the table below.
| Impact / Likelihood | Low | Medium | High |
| High | Medium | High | Critical |
| Medium | Low | Medium | High |
| Low | Info / Best Practices | Low | Medium |
| Undetermined | Undetermined | Undetermined | Undetermined |
To address issues that do not fit a High, Medium or Low severity, Nethermind Security also uses three more finding severities: Informational, Best Practices, and Undetermined.
| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #8 PR #8 | High | Fixed |
Some ERC20 tokens don’t revert on failure but return false instead. Posting a request with such a token as collateral but with an incorrect asset type (ERC721 or CryptoKitties) may be used to create a loan for which no collateral is transferred. A good example of such a token is ZRX: Etherscan code.
Exploit Scenario:
ZRX as collateral, but with ERC721 type. Alice does not have any ZRX tokens;ZRX token. The ZRX.transferFrom(...) does not revert but returns false;_transferAssetFrom(...) does not check the return value for the CryptoKitties type, so the failed transfer ICryptoKitties(ZRX).transferFrom(...) will silently return;The function is shown below.
function transferFrom(address _from, address _to, uint _value) returns (bool) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}Recommendation
Check asset balance differences before and after each transfer.
Resolution
Fixed by checking asset category in the isValid function of the MultiToken library.
Relevant commits:
Update from Nethermind Security
We agree with the checks added to the function isValid(...) in commit e5078ef. However, it does not consider tokens that support ERC165 but are not ERC721, ERC1155, or CryptoKitties. In the future, such tokens may become popular and be used with assert.category = ERC20. To address this issue, we recommend verifying that the asset interface id is ERC20 if it supports the ERC165 standard. This solution would resolve the aforementioned problem while also allowing potential ERC20 assets that implement ERC165.
Update from the client after Reaudit: Fixed by checking for support of IERC20 interface id (0x36372b07) in case where ERC20 asset implements ERC165.
Relevant commits:
WETH as collateral| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #8 PR #8 | High | Fixed |
The borrower can create a request with the correct amount of the WETH token as collateral but with collateralCategory = ERC1155 to steal the lender’s funds. The types of collateral are checked with isValid(...), but the ERC1155 is not checked in that function, which effectively allows the creation of an object with an asset of category ERC1155 but with a WETH token. When the collateral is sent from the borrower to the contract PWNSimpleLoan, the ERC1155 interface is used. However, the WETH token doesn’t contain the function safeTransferFrom(...) implemented, and its fallback function will ignore any unknown function. We present the WETH fallback function below.
function() public payable {
deposit();
}
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
}Pulling collateral from the borrower will silently return with no WETH tokens transferred. Next, the loan funds from the lender will be sent to the borrower. At this point, the borrower has no incentive to return the loan since no collateral is kept in the contract.
Recommendation
Check the balances after transfers. Checking balances for each token type mitigates using incorrect types and ensures the transfer of correct amounts.
Resolution
Fixed by checking asset category in the function isValid(...) of the MultiToken library.
Relevant commits:
Update from Nethermind Security
We agree with the checks added to the function isValid(...) in commit e5078ef. However, it does not consider tokens that support ERC165 but are not ERC721, ERC1155, or CryptoKitties. In the future, such tokens may become popular and be used with assert.category = ERC20. To address this issue, we recommend verifying that the asset interface id is ERC20 if it supports the ERC165 standard. This solution would resolve the problem above while allowing potential ERC20 assets that implement ERC165.
Update from the client after Reaudit: Fixed by checking for support of IERC20 interface id (0x36372b07) in case where ERC20 asset implements ERC165.
Relevant commits:
| File | Fix commit | Type | Status |
pwn/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #8 PR #8 | Medium | Fixed |
During the creation, repayment, or claiming of a loan, the MultiToken library handles token transfers through the _pull, _push, and _pushFrom functions. For ERC721 token transfers, the MultiToken library will use transferFrom(...) during a token "pull" since moving tokens to itself implicitly implies that it has ERC721 support and therefore does not need to check for onERC721Received. During a token "push" the safeTransferFrom functionality is used since the recipient may not support ERC721 tokens.
function() public payable {
deposit();
}
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
}A borrower could create an order with WETH as collateral and specify it as an ERC721 asset type. Upon a lender accepting the loan, the WETH would successfully transfer to the vault, since it uses a "pull" which uses transferFrom. However, if the borrower decides not to repay the loan, when the lender attempts to claim the collateral, a safeTransferFrom is used, which will not transfer tokens. In this case, both parties will lose out on their collateral. However, the borrower will have kept the collateral, so the borrower’s losses are less than the lender’s. For example, with collateral of $1000 and a borrowed amount of $800, the attack would cost the borrower $200, i.e., $1000 - $800), to inflict an $800 loss (the borrowed amount) onto the lender.
Recommendation
Check balances after transfers. Checking balances for each token type will mitigate using incorrect types and will ensure the transfer of correct amounts.
Resolution
Fixed by checking asset category in the isValid function of the MultiToken library. Relevant commits:
Update from Nethermind Security
We agree with the checks added to the function isValid(...) in commit e5078ef. However, it does not consider tokens that support ERC165 but are not ERC721, ERC1155, or CryptoKitties. In the future, such tokens may become popular and be used with assert.category = ERC20. To address this issue, we recommend verifying that the asset interface id is ERC20 if it supports the ERC165 standard. This solution would resolve the aforementioned problem while also allowing potential ERC20 assets that implement ERC165.
Update from the client after Reaudit: Fixed by checking for support of IERC20 interface id (0x36372b07) in case where ERC20 asset implements ERC165.
Relevant commits:
| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #8 PR #74 | Medium | Fixed |
The loan can be created for any pair of tokens. Some tokens (e.g., STA, PAX) deduce fees during a transfer. If such tokens are used as collateral, the collateral amount registered in the object loan would be greater than the actual amount of tokens in the vault, which would fail while trying to withdraw the collateral. There is a second scenario where two users use the same fee-on-transfer Token as collateral, and the first one who repays the loan has a better chance of getting the entire collateral back. In contrast, the second user will not be able to recover the collateral.
Recommendation
Consider checking balances before and after transfers to ensure the amount of the transferred tokens is correct. This solution would, however, make fee-on-transfer tokens unusable in this protocol.
Resolution
Fixed by checking balances before and after a transfer.
Relevant commits:
| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #74 | Medium | Fixed |
In PWNSimpleLoan, lenders can enable late repayment to allow borrowers to repay after the loan has expired. However, this feature can also be used by lenders to trick borrowers into giving up their collateral.
Exploit Scenario:
enableLOANLateRepayment(...). Bob saw this and thought that Alice was being friendly and that he could repay the loan a little bit late;claimLOAN(...) to get all the collateral. Since the collateral value was higher than the loan, Alice made a profit;Recommendation
Extend the duration of the loan to a fixed value in case the lender enables late repayment and does not allow the lender to claim the collateral before the new expiration.
Resolution
Fixed by removing enableLOANLateRepayment functionality and implementing extendLOANExpirationDate conditions:
block.timestamp;block.timestamp + 30 days to protect the lender;Relevant commits:
Update from Nethermind Security
In commit 598f84a, the comment regarding loanRepayAmount was mistakenly deleted instead of the comment about lateRepaymentEnabled, in the contract PWNSimpleLoan.
| File | Fix commit | Type | Status |
MultiToken/src/MultiToken.sol | PR #8 PR #74 | Medium | Fixed |
The function _transferAssetFrom(...) checks the return value from the ERC20 token transfer. The code snippet is reproduced below.
if (asset.category == Category.ERC20) {
if (source == address(this))
require(IERC20(asset.assetAddress).transfer(dest, asset.amount), "MultiToken: ERC20 transfer failed");
else
require(IERC20(asset.assetAddress).transferFrom(source, dest, asset.amount), "MultiToken: ERC20 transferFrom failed");
}That makes a problem for transferring tokens that do not return a success value. Some tokens as USDT may not be usable in the protocol, since the require statement would fail when no boolean value is returned, even if the transfer would be successful. Others as BNB, may make lenders lose their funds, below we present an exploit scenario.
Exploit Scenario:
BNB.transferFrom(...) returns bool);BNB.transfer(...) does not return a bool value, and the require statement in _transferAssetFrom(...) will always fail, effectively locking BNB in the vault;Recommendation
Consider using the SafeERC20 library to allow transfers of ERC20 tokens that do not return on a successful transfer.
Resolution
Fixed by using OZ SafeERC20 library and checking loan asset validity by the isValid function.
Relevant commits:
CryptoKitties token is locked when using it as ERC721 type collateral| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #8 PR #8 | Medium | Fixed |
When creating a loan, the collateral token is not checked to match its category. Since CryptoKitties and ERC721 share the same function transferFrom(...), if the collateral token is CryptoKitties but the user signs it as ERC721 category, it will successfully transfer in. However, when transferring out, ERC721 category uses the function safeTransferFrom(...), which does not exist in CryptoKitties. As a result, this CryptoKitties collateral is locked in PWNVault. Below we present part of the function _transferAssetFrom(...), which is responsible for transferring ERC721 assets:
function _transferAssetFrom(Asset memory asset, address source, address dest, bool isSafe) private {
...
} else if (asset.category == Category.ERC721) {
if (!isSafe)
IERC721(asset.assetAddress).transferFrom(source, dest, asset.id);
else
IERC721(asset.assetAddress).safeTransferFrom(source, dest, asset.id, "");
...
}Recommendation
We recommend to use the ERC165 interface to verify the type of asset, as both CryptoKitties and ERC721 support different interfaces.
Resolution
Fixed by checking asset category in the isValid function of the MultiToken library. Relevant commits:
Update from Nethermind Security
We agree with the checks added to the function isValid(...) in commit e5078ef. However, it does not consider tokens that support ERC165 but are not ERC721, ERC1155, or CryptoKitties. In the future, such tokens may become popular and be used with assert.category = ERC20. To address this issue, we recommend verifying that the asset interface id is ERC20 if it supports the ERC165 standard. This solution would resolve the problem above, while also allowing potential ERC20 assets that implement ERC165.
Update from the client after Reaudit: Fixed by checking for support of IERC20 interface id (0x36372b07) in case where ERC20 asset implements ERC165.
Relevant commits:
calculateFeeAmount(...) has unnecessary loss of precision| File | Fix commit | Type | Status |
pwn_contracts/src/loan/lib/PWNFeeCalculator.sol | PR #74 | Low | Fixed |
The function calculateFeeAmount(...) is used to compute the fee amount given the loan amount and fees value in basis points. Currently in the codebase, if loanAmount >= 1e4, to avoid overflow in an edge-case, it does the division before the multiplication and accepts the precision loss. However, the overflow only happens when loanAmount*fee overflows, i.e., loanAmount >= 1e73 in case fee = 1e4, which is much less likely to happen compared to loanAmount >= 1e4 in the current codebase.
function calculateFeeAmount(uint16 fee, uint256 loanAmount) internal pure returns (uint256 feeAmount, uint256 newLoanAmount) {
if (loanAmount < 1e4)
feeAmount = loanAmount * uint256(fee) / 1e4;
else
feeAmount = loanAmount / 1e4 * uint256(fee);
newLoanAmount = loanAmount - feeAmount;
}Recommendation
Consider changing the check to reduce loss of precision. For example, (loanAmount * fee) / fee == loanAmount. With this check, in case loanAmount * fee overflows, it cannot get the same loanAmount if divided by fee. Or consider only using the first formula since no token is not malicious but has 1e73 tokens in the circulating supply.
function calculateFeeAmount(uint16 fee, uint256 loanAmount) internal pure returns (uint256 feeAmount, uint256 newLoanAmount) {
unchecked {
if ((loanAmount * fee) / fee == loanAmount)
feeAmount = loanAmount * uint256(fee) / 1e4;
else
feeAmount = loanAmount / 1e4 * uint256(fee);
}
newLoanAmount = loanAmount - feeAmount;
}Resolution
Fixed by changing the check according to recommendations.
Relevant commits:
| File | Fix commit | Type | Status |
pwn_contracts/src/config/PWNConfig.sol | PR #74 | Low | Mitigated |
PWN protocol charges fees when users create loans on the platform. However, a malicious/lost private key owner can arbitrarily change the fee to any value without a timelock for users to react. Consider the scenario when a user creates a large loan with 0.1% fees. The owner can front-run to change fees to 100% right before the user’s transaction is executed and steals all the assets.
function setFee(uint16 _fee) external onlyOwner {
_setFee(_fee);
}
function _setFee(uint16 _fee) private {
uint16 oldFee = fee;
fee = _fee;
emit FeeUpdated(oldFee, _fee);
}Recommendation
Add an upper threshold for fees that the owner can update. You can also consider a time lock so users can have enough time to react to owner actions.
Resolution
PWNConfig will be deployed as a proxy, so any hardcoded value can be updated anytime. Nevertheless, we set the max value to 10% in combination with TimelockController set as a PWNConfig owner to make it harder for a malicious owner to execute such an attack.
Relevant commits:
| File | Fix commit | Type | Status |
pwn_contracts/src/hub/PWNHub.solpwn_contracts/src/config/PWNConfig.solpwn_contracts/src/deployer/PWNDeployer.sol | PR #74 PR #74 | Low | Fixed |
The contracts PWNHub, PWNConfig, and PWNDeployer inherit from OpenZeppelin’s Ownable contract, which provides a onestep ownership transfer. Transferring ownership in a single step is error-prone and can severely harm the protocol if a mistake happens. Additionally, those contracts inherit the function renounceOwnership(...). If this function were called, those essential contracts would be unusable.
Recommendation
We recommend implementing a two-step process for transferring ownership, such as the propose-accept scheme. Check the Ownable2Step.sol contract from OpenZeppelin. Consider also disabling the function renounceOwnership(...) to ensure it’s never called.
Resolution
Fixed by inheriting from Ownable2Step in PWNHub and PWNConfig. Decided to keep simple Ownable for PWNDeployer and keep the renounceOwnership function active.
Relevant commits:
offer.duration can be set to zeroThe loanTerms.expiration can be set to the current timestamp if the offer.duration is zero. This will allow the lender to force claim the collateral after fulfilling the request. The code snippet is reproduced below.
...
expiration: uint40(block.timestamp) + offer.duration,
...Recommendation
Ensure that offer.duration exceeds zero. The lowest value could be around one block time.
Resolution
Set min loan duration to 10 min.
Relevant commits:
address(0x0) in function setFeeCollector(...)| File | Fix commit | Type | Status |
pwn_contracts/src/config/PWNConfig.sol | PR #74 | Info | Fixed |
The function setFeeCollector(...) is designed to set a new address for the fee collector. However, the function does not check the new address for address(0x0), which can lead to asset loss. The function is reproduced below.
function setFeeCollector(address _feeCollector) external onlyOwner {
_setFeeCollector(_feeCollector);
}
function _setFeeCollector(address _feeCollector) private {
/////////////////////////////////////////////////////////////
// @audit Not checking "_feeCollector" for "address(0x0)".
/////////////////////////////////////////////////////////////
address oldFeeCollector = feeCollector;
feeCollector = _feeCollector;
emit FeeCollectorUpdated(oldFeeCollector, _feeCollector);
}Recommendation
Although the function is onlyOwner, checking the _feeCollector for address(0x0) can prevent typos and fund losses.
Resolution
Check for the zero address before setting the new fee collector address.
Relevant commits:
createLoan(...) to fail when transferring fees| File | Fix commit | Type | Status |
pwn_contracts/src/loan/terms/simple/loan/PWNSimpleLoan.sol | PR #74 | Info | Fixed |
Some tokens (e.g., LEND) revert when transferring a zero-value amount. If feeAmount is rounded to zero for a small loan, it can cause createLoan(...) to fail, meaning users cannot create loans with some tokens.
// Transfer fee amount to fee collector
///////////////////////////////////////////////////////////
// @audit Transferring a zero amount can fail for some tokens
///////////////////////////////////////////////////////////
loanTerms.asset.amount = feeAmount;
_pushFrom(loanTerms.asset, loanTerms.lender, config.feeCollector());Recommendation
Only perform transfers when the amount is larger than zero.
Resolution
Fixed by only transferring the fee when the amount is >0.
Relevant commits:
| File | Fix commit | Type | Status |
MultiToken/src/MultiToken.sol | — | Best Practices | Acknowledged |
The contract uses unlocked pragma ˆ0.8.0. A better approach is to stick to a single Solidity version, ensuring the protocol works in that context. The solidity compiler frequently has new versions, and using an old version prevents access to new Solidity security checks. Also, notice that some versions are more stable than others.
Recommendation
Lock the pragma to version 0.8.16 and use this version for deploying the contract. For more information, please check this reference.
Resolution
Acknowledged. Nevertheless, the MultiToken lib is used in more projects which do not share the same pragma version. We’ve decided to keep the unlocked pragma.
Software documentation refers to the written or visual information that describes the functionality, architecture, design, and implementation of software. It provides a comprehensive overview of the software system and helps users, developers, and stakeholders understand how the software works, how to use it, and how to maintain it. Software documentation can take different forms, such as user manuals, system manuals, technical specifications, requirements documents, design documents, and code comments. Software documentation is critical in software development, enabling effective communication between developers, testers, users, and other stakeholders. It helps to ensure that everyone involved in the development process has a shared understanding of the software system and its functionality. Moreover, software documentation can improve software maintenance by providing a clear and complete understanding of the software system, making it easier for developers to maintain, modify, and update the software over time. Smart contracts can use various types of software documentation. Some of the most common types include:
These types of documentation are essential for smart contract development and maintenance. They help ensure that the contract is properly designed, implemented, and tested, and they provide a reference for developers who need to modify or maintain the contract in the future.
The PWN team provided developer documents to assist the audit process, describing MultiToken library, the PWN Vault and PWN Loan contracts and a diagram describing the protocol flow. These documents covered the most common terms used in the source code, explanations for the core business logic, and functions flow. By reading the whole developer documentation, we could get a proper understanding of how PWN Vault and PWN Loan contracts should operate. The provided documentation is a complete source of resources for developers and auditors, and we are satisfied with it. The codebase has sufficient inline comments, helping the audit team to understand the function flow and to detect some issues.
Along this investigation, we noticed some areas in the code where the implementation differs from the specification and/or inline comments. Consider updating either the implementation or the documentation to match each other based on the correct business logic.
ERC721 does not match implementationThe function isValid(...) in the contract library MultiToken assures that the amount of the ERC721 token must be 0. However, in the developer documentation it is stated that the collateralAmount for ERC721 asset must be 1.
onERC1155BatchReceived(...) does not match implementationThe documentation in contract PWNVault mentions that in order for the batch transfer to be accepted, the onERC1155BatchReceived(...) should return its own function selector. But it reverts directly with a custom error message.
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated. To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address /*operator*/,
address /*from*/,
uint256[] calldata /*ids*/,
uint256[] calldata /*values*/,
bytes calldata /*data*/
) override external pure returns (bytes4) {
revert UnsupportedTransferFunction();
}Current view: top level Hit Total Coverage Test: lcov.info.pruned Lines: 229 248 92.3 % Date: 2023-03-01 19:26:13 Functions: 55 56 98.2 %
config 100.0 % 17 / 17 100.0 % 7 / 7 - 0 / 0 deployer 100.0 % 4 / 4 100.0 % 3 / 3 - 0 / 0 hub 100.0 % 9 / 9 100.0 % 3 / 3 - 0 / 0 loan 100.0 % 16 / 16 100.0 % 8 / 8 - 0 / 0 loan/lib 13.6 % 3 / 22 50.0 % 1 / 2 - 0 / 0 loan/terms/simple/factory/offer 100.0 % 48 / 48 100.0 % 8 / 8 - 0 / 0 loan/terms/simple/factory/offer/base 100.0 % 5 / 5 100.0 % 2 / 2 - 0 / 0 loan/terms/simple/factory/request 100.0 % 21 / 21 100.0 % 4 / 4 - 0 / 0 loan/terms/simple/factory/request/base 100.0 % 5 / 5 100.0 % 2 / 2 - 0 / 0 loan/terms/simple/loan 100.0 % 73 / 73 100.0 % 8 / 8 - 0 / 0 loan/token 100.0 % 16 / 16 100.0 % 5 / 5 - 0 / 0 nonce 100.0 % 12 / 12 100.0 % 4 / 4 - 0 / 0
| 223Tests passed | 0Failed |
The complete test output is in the full report.
As auditors, we recommend that any changes or updates made to the audited codebase undergo a re-audit or security review to address potential vulnerabilities or risks introduced by the modifications. By conducting a re-audit or security review of the modified codebase, you can significantly enhance the overall security of your system and reduce the likelihood of exploitation. However, we do not possess the authority or right to impose obligations or restrictions on our clients regarding codebase updates, modifications, or subsequent audits. Accordingly, the decision to seek a re-audit or security review lies solely with you.
This report is based on the scope of materials and documentation provided by you to Nethermind in order that Nethermind could conduct the security review outlined in 1. Executive Summary and 2. Audited Files. The results set out in this report may not be complete nor inclusive of all vulnerabilities. Nethermind has provided the review and this report on an as-is, where-is, and as-available basis. You agree that your access and/or use, including but not limited to any associated services, products, protocols, platforms, content, and materials, will be at your sole risk. Blockchain technology remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond the programming language, or other programming aspects that could present security risks. This report does not indicate the endorsement of any particular project or team, nor guarantee its security. No third party should rely on this report in any way, including for the purpose of making any decisions to buy or sell a product, service or any other asset. To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this report, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Nethermind does not warrant, endorse, guarantee, or assume responsibility for any product or service advertised or offered by a third party through the product, any open source or third-party software, code, libraries, materials, or information linked to, called by, referenced by or accessible through the report, its content, and the related services and products, any hyperlinked websites, any websites or mobile applications appearing on any advertising, and Nethermind will not be a party to or in any way be responsible for monitoring any transaction between you and any third-party providers of products or services. As with the purchase or use of a product or service through any medium or in any environment, you should use your best judgment and exercise caution where appropriate. FOR AVOIDANCE OF DOUBT, THE REPORT, ITS CONTENT, ACCESS, AND/OR USAGE THEREOF, INCLUDING ANY ASSOCIATED SERVICES OR MATERIALS, SHALL NOT BE CONSIDERED OR RELIED UPON AS ANY FORM OF FINANCIAL, INVESTMENT, TAX, LEGAL, REGULATORY, OR OTHER ADVICE.
The Leading Engineers of Blockchain Infrastructure