Avoid the use of floating pragma to ensure same compiler version used for testing is also used for deployment
The Solidity contracts declare a floating compiler pragma, so any compiler version from 0.8.23 upwards can be used. This means the compiler used for deployment may differ from the one used in testing, or a newer, less tested compiler could be used.
- Disclosed after under an hour
69420 sc insight avoid the use of floating pragma to ensure same compiler version used for testing is also used for deployment
Submitted on Mar 14th 2026 at 20:44:55 UTC by @kaysoft for Audit Comp | Folks Finance: Staking Contracts
- Report ID: #69420
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/Folks-Finance/folks-staking-contracts/blob/main/src/Staking.sol
Description
Brief/Intro
The Staking.sol, IMigrator.sol and IStakingV1 all use unspecific solidity pragma ^0.8.23.
This may result in a situation where the pragma version used for test is different from the one used for deployment because the ^0.8.23 means any compiler from 0.8.23 and above.
Vulnerability Details
The smart contracts use floating compiler version and this may result in using a different version of compiler during deployment. It can also allow the use of latest compiler version that have unfixed issues to be used.
File: Staking.sol
pragma solidity ^0.8.23;
Impact Details
Complier used during deployment may be different from the one used during testing which may lead to other security issues.
Newer compiler versions that have not been battle tested may be used to compile the code during deployment since the compiler version is not fixed.
Recommendation
Instead of pragma solidity ^0.8.23;, use pragma solidity 0.8.23
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The pragma uses a caret range instead of an exact version, so the compiler version is not pinned.
Impact
The compiler used at deployment may differ from the one used in testing, and a newer, less battle-tested compiler could be used, which may lead to other security issues.
What the attacker needed
None
The fix
The pragma should be pinned to an exact compiler version instead of a caret range.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Solidity is the language smart contracts are written in, and a compiler turns that code into the program that runs on the blockchain. The pragma line at the top of a file tells the compiler which version is allowed. Writing a caret before the version means 'this version or any newer one', so different people can compile the same code with different compilers.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.