Skip to content
Smart contracts Write-up Beginner

Gas Level Vulnerability: Floating pragma version

The report describes a gas-level vulnerability where a smart contract uses a floating pragma version, allowing deployment with different compiler versions. This could introduce incompatibilities and potential security vulnerabilities, leading to loss of funds or failed transactions.

medium.com

Published on medium.com

Today, I will tell you about a Gas Level Vulnerability found during many audits

JEETPAL, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

This inconsistency may lead to loss of funds, failed transactions, or exploited opportunities for attackers targeting these discrepancies.

What the attacker needed

None

The fix

The contract should be fixed by using a fixed pragma version (e.g., pragma solidity 0.8.20;) instead of a floating one.

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 write-up has not been written yet. The Original tab links to the source.

Smart contracts are written in a language like Solidity, and a 'pragma' line tells the compiler which version to use. If it says '^0.8.19', it means any version from 0.8.19 up to but not including 0.9.0 can be used. Different compiler versions might behave slightly differently, which could cause bugs or security issues.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.