Captain Tsubasa -RIVALS- - Audit

CertiKFiles named in the report

CertiK reviewed CAPTAIN TSUBASA -RIVALS- (Captain Tsubasa -RIVALS- - Audit) on 9 Mar 2023: 5 findings, 0 critical; 1 marked fixed, 2 acknowledged, 2 open.

No open critical findings
Open the reportOpen CAPTAIN TSUBASA -RIVALS-’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings5

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium001
Low020
MediumPotential Failure on Size CalculationFixed

In the contract `NFT.sol`, the function `tokenIdsOfOwner()` is designed to return the chosen NFT ids by providing the start index and the amount/size of tokens that wants to query. However, there is a corner case that might lead to a potential revert on the function call with specific `startIdx` and `size`. The issue lies in the `else` branch, where in the case that `startIdx + size - 1 == length`, the `last` parameter will be updated to `startIdx + size`, which equals `length + 1`. Therefore, the calculation of the `remain` value will fail due to an underflow. ```solidity=72 } else { if (startIdx + size - 1 > length) { size = length - startIdx; } last = startIdx + size; remain = length - last; } ``` ### Proof of Concept The following PoC first mint 6 tokens and call `tokenIdsOfOwner` to find tokens from starting from index 1. ```solidity pragma solidity ^0.8.0; import { Test } from "forge-std/Test.sol"; import {NFT} from "../src/NFT.sol"; contract NFTTest is Test { function mkaddr(string memory name) public returns (address) { address addr = address(uint160(uint256(keccak256(abi.encodePacked(name))))); vm.label(addr, name); return addr; } address public admin; function testRevert() public { NFT nft = new NFT("nft", "nft", "nft"); admin = mkaddr("admin"); for (uint i = 0; i < 6; i = i + 1 ) { nft.safeMint(address(admin), i); } nft.tokenIdsOfOwner(address(admin), 1, 6); } } ``` **Result** As the result below, the test reverts caused by the underflow on `remain = length - last;`. ```solidity Test result: FAILED. 0 passed; 1 failed; finished in 2.94ms Failing tests: Encountered 1 failing test in test/NFTTest.sol:NFTTest [FAIL. Reason: Arithmetic over/underflow] testRevert() (gas: 2792157) ```

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (3)

  • NFT.sol
  • UTT.sol
  • GT.sol

Part of CAPTAIN TSUBASA -RIVALS-’s security record

CAPTAIN TSUBASA -RIVALS-
Audits1 audit by 1 firmLast audit Mar 2023, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open CAPTAIN TSUBASA -RIVALS-’s security record

Security firm

CertiK

1,044 projects reviewed · 1,375 reports · latest May 2025

See CertiK’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us