Skip to content

Fee Setter Without Upper Bound

SAFE-0135 Access Control Checked automatically by the scanner
1

What goes wrong

A fee/tax parameter can be set by an admin with no maximum. The owner can raise the fee to 100% right before users transact, capturing the entire amount — a classic honeypot / rug configuration.

2

The vulnerable pattern

proof of concept — how it is exploited
// setFee(10000) // 100%
// user swaps/sells -> entire output goes to the fee wallet.
3

How to fix it

the pattern that is safe
uint256 public constant MAX_FEE_BPS = 500; // 5%
function setFee(uint256 bps) external onlyOwner {
    require(bps <= MAX_FEE_BPS, "fee too high");
    feeBps = bps;
}
Hard-cap fees in code; a runtime max is not enough.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0135 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs