What should a BNB Chain smart contract audit cover?

A BNB Chain smart contract audit should compare forked code line by line with the upstream it came from, test every price the code reads against a trade made with flash-loaned funds, and check timing logic against blocks that share one whole-second timestamp. QuillShield audits the Solidity code of a Foundry project that targets BNB Smart Chain, forked contracts included, and reviews each later pull request against that audit.

Last updated . 6 minute read. By the QuillAudits Team.

What is different about auditing on BNB Chain?

BNB Smart Chain runs Solidity much as Ethereum does. The differences a reviewer meets are in timing, where two blocks can fall within one second, and in the Jenner hard fork, which changes what a block holds and adds a new token standard.

  • Two blocks can share one `block.timestamp`. The BNB Chain post on millisecond block timestamps (2 November 2026) explains that a contract reading block.timestamp sees whole seconds, so two blocks 600 milliseconds apart report the same second. Per-block rate limits, auctions and anything that expects a new timestamp in each block need a second look.
  • Millisecond time comes from a precompile, not `block.timestamp`. BEP-706 adds a precompile at 0x70 that returns the executing block's timestamp in milliseconds, and the Jenner upgrade guide schedules the hard fork for BSC mainnet on 8 December 2026. The BNB Chain post warns that mixing seconds and milliseconds can make an expiry far too short or far too long, and that a successful call alone does not prove the feature is available.
  • Part of every block is reserved for payments. Jenner's BEP-703 Payment Lane reserves 5% of each block's gas capacity for qualifying payment transactions by default, and governance can raise that to a 10% maximum. General transactions cannot use unused payment capacity (Jenner guide).
  • CAS20 tokens carry policies and seizure roles. BEP-702 CAS20 keeps BEP-20 selectors and events but adds native transfer policies, allowlists and blocklists, pausing, and separate mint, burn and seizure roles, with availability to follow in a separate announcement (Jenner guide). A vault or market that accepts a CAS20 stablecoin needs a plan for a refused transfer.

BNB Chain's own security guidance, published on its blog in June 2023 and written by Salus Security, adds review points of its own: a single price source can be easily manipulated using flash loans, token and native-coin transfers are interactions that belong behind checks-effects-interactions or a reentrancy guard, and privileged parameter changes should emit events and sit behind an emergency pause.

What does a forked contract bug look like?

In a fork, the dangerous change can be a single constant. This pair shows the pattern behind the Uranium Finance loss described below: the fee scale moved from 1,000 to 10,000 in one place and stayed at 1,000 in the check that guards the pool, as Immunefi's analysis explains.

Vulnerable: a forked pair changes the fee scale in one place only (illustrative, not audited code) ForkedPairCheckVulnerable.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract ForkedPairCheckVulnerable {
    function kHolds(
        uint256 balance0,
        uint256 balance1,
        uint256 amount0In,
        uint256 amount1In,
        uint256 reserve0,
        uint256 reserve1
    ) public pure returns (bool) {
        uint256 balance0Adjusted = balance0 * 10_000 - amount0In * 25;
        uint256 balance1Adjusted = balance1 * 10_000 - amount1In * 25;
        // The left side is scaled by 10,000 squared and the right side by 1,000 squared,
        // so the check still passes after a swap that takes most of the pool.
        return balance0Adjusted * balance1Adjusted >= reserve0 * reserve1 * 1_000 ** 2;
    }
}

Fixed: one constant scales both sides of the check (illustrative, not audited code) ForkedPairCheckFixed.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract ForkedPairCheckFixed {
    uint256 internal constant SCALE = 10_000;
    uint256 internal constant FEE = 25; // 0.25% on a 10,000 scale

    function kHolds(
        uint256 balance0,
        uint256 balance1,
        uint256 amount0In,
        uint256 amount1In,
        uint256 reserve0,
        uint256 reserve1
    ) public pure returns (bool) {
        uint256 balance0Adjusted = balance0 * SCALE - amount0In * FEE;
        uint256 balance1Adjusted = balance1 * SCALE - amount1In * FEE;
        return balance0Adjusted * balance1Adjusted >= reserve0 * reserve1 * SCALE ** 2;
    }
}

What should a reviewer check in a BNB Chain fork?

  • Diff every forked contract against the exact upstream commit, and write down why each changed constant, fee and rounding direction changed.
  • When a constant changes, find every place the old value was used, invariant checks included, and test the invariant directly.
  • Test every price the code reads against a trade made with flash-loaned funds in the same transaction.
  • Check that privileged functions emit events and that the protocol has an emergency pause, with a named holder.
  • Find logic that expects a new block.timestamp in each block, and decide whether it needs the 0x70 precompile or a design that tolerates shared seconds.
  • Every call to the 0x70 precompile checks that the call succeeded and returned 32 bytes, and names its unit, so seconds and milliseconds never mix.
  • Contracts that hold CAS20 tokens handle a transfer refused by policy, a paused token and a seizure.
  • In a forked lending market, check that each function added to the fork runs the original health check.

What went wrong at Uranium Finance?

Protocol Uranium Finance
Date 28 April 2021
Chain BNB Chain
Loss over $50M across 26 pairs
What happened Uranium Finance was an AMM on BNB Chain built from Uniswap V2. It changed the magic value in the swap fee calculation from Uniswap's 1,000 to 10,000, but the constant product check that follows still used 1,000. The check passed for swaps that took far more than the pool should give, and an attacker took tokens from 26 pairs.
Sources Immunefi

The fork kept the Uniswap V2 design and changed one number in it, so the whole risk sat in the diff. A diff against the upstream commit shows the mismatch in two lines, and the guide to reviewing changes since your last audit covers this kind of change.

Which BNB Chain protocols carry fork risk?

The fork pattern above applies to AMMs like Uranium and to forked lending markets, and both read prices that flash loans can move. The table maps each type to its first check.

Protocol type What to check first on BNB Chain
Forked AMM Every changed constant against the invariant check, and fee math on both sides
Forked lending market Health checks on every path, and prices that a flash-loaned trade can move
Yield vault or farm Share and reward math under a large deposit and withdrawal in one transaction
Bridge or cross-chain app Message validation, replay protection and who can pause it
Payments or stablecoin app Payment Lane eligibility after Jenner, and CAS20 transfer policies

Which vulnerabilities matter most on BNB Chain?

  • Flash loan attacks: BNB Chain's own guidance names flash loans as the way single price sources get manipulated.
  • Oracle price manipulation: a price read from one pool's reserves moves with one trade.
  • Rounding and precision errors: Uranium's loss came from two scaling factors that no longer matched.
  • Timestamp dependence: two BSC blocks 600 milliseconds apart report the same block.timestamp, and a millisecond value from 0x70 mixed with seconds breaks expiries.
  • Access control: privileged parameter changes need events, a pause and a clear holder, and CAS20 adds issuer seizure roles a vault has to plan around.

How do you run QuillShield on a BNB Chain fork?

  1. Set the BNB Smart Chain contracts up as a Foundry project. QuillShield supports Solidity in Foundry projects today.
  2. Import from GitHub or GitLab.com, a git URL, a Foundry .zip of up to 50 MiB, a folder or a single .sol file.
  3. In the audit context, name the upstream protocol and commit each forked contract came from, list every constant, fee and rounding change you made, and say where the code relies on block.timestamp.
  4. Approve the quote after you see the exact price. New accounts get $50 in credit, good for up to half of an order.
  5. When the audit completes, read each finding's exact lines, impact, recommended fix and proof of concept result. A separate reviewer agent tried to disprove it first.
  6. On GitHub or GitLab.com, keep the pull request checks on so the next fork update is reviewed against the security graph.

Full audits start at $49 and are priced from the lines of Solidity in scope, so a fork is priced on the code you ship (pricing).

QuillShield doesn't replace a manual audit. You can request a manual audit from QuillAudits, and the Solidity page covers what QuillShield checks in the language.

Run a full audit of your forked BNB Chain contracts. Sign-up is free.

FAQ

Why does a fork need its own audit on BNB Chain?

Because the risk sits in what changed. Uranium Finance changed one fee constant in a Uniswap V2 design and lost over $50M across 26 pairs (Immunefi).

Does the Jenner hard fork change block.timestamp on BSC?

No. block.timestamp stays in whole seconds, and contracts that need milliseconds must call the BEP-706 precompile at 0x70 explicitly. Jenner is scheduled for BSC mainnet on 8 December 2026 (Jenner guide).

What does BNB Chain recommend for project security?

Its June 2023 guidance warns against single price sources that flash loans can move, and recommends checks-effects-interactions or reentrancy guards, events on privileged changes and an emergency pause (BNB Chain blog).

Does QuillShield support BNB Smart Chain contracts?

QuillShield audits Solidity in Foundry projects, which covers contracts written for BNB Smart Chain. You see the exact price before anything is charged.

Sources

QuillShield is building the security layer between AI and money, so you can keep shipping between audits.

Sign-up is free, and new accounts get $50 in credit, good for up to half of an order.

  1. 1Sign up and import a repo
  2. 2See the exact price before anything is charged
  3. 3Approve it, and the audit starts