[BUG]: Any staker with 1 wei can set the price because submitValue has no bound on the value
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- solidity
- Ambito
- blockchain
Direzione di ricerca
Start at submitValue in src/Oracle.sol:103 and trace how the weighted average is recomputed in readValue alongside the stake-decay (halfLife) logic. Add test/DustPrice.t.sol from the report and run forge test --match-path test/DustPrice.t.sol -vv to see both failures. Done means both tests pass, the price stays at 30e18, and the maintainers have agreed on a bound, since the paper puts no limit on submitted values and the fix is a design choice.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description
Anyone with a tiny stake can set the price to whatever they want.
The price is an average of all submitted values weighted by stake and submitValue (src/Oracle.sol:103) puts no limit on the value. So someone with just 1 wei of stake can send a huge number like 1e60 and drag the average to about 1e36 in one call.
Quiet feeds are even easier. With a 60s half life the old stake fades away after about an hour without submits and then whoever submits next basically becomes the price no matter how small their stake is.
Blacklisting doesn't stop it either because only the read functions check the blacklist. The paper also uses the blacklist only for reading so I'm not sure that part should change.
Since the paper puts no limit on submitted values I think the fix is a design choice for the maintainers.
Real example on Sepolia. Feed A at 0xff2b1fca4aF0c9BCb576178e6989AA92819a0294 reads 30e18 with 0.105 WETH staked and hasn't been updated since 2026-08-30. On a local fork of Sepolia 1 wei of WETH set it to exactly 1e60 and the Composed Oracle at 0x3554D1feF9c95976634C2B9518790F146a6aa56A that reads Feed A started reverting on readValue. Other contracts that read an Orb feed can break the same way like the Gluon Orb test reactor or a Karma or Fate pool.
Steps to Reproduce
- Use a quiet feed like Feed A or a new one with a small honest stake.
- Stake 1 wei of the weight token and wait out
DEPOSIT_LOCKING_PERIOD. - Call
submitValuewith a huge value. readValue()now returns about that value.
Logs and Screenshots
Test I used: test/DustPrice.t.sol run with forge test --match-path test/DustPrice.t.sol -vv
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Test, console2} from "lib/forge-std/src/Test.sol";
import {ERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import {Oracle} from "../src/Oracle.sol";
contract Tok is ERC20 {
constructor() ERC20("W", "W") {}
function mint(address to, uint256 a) external {
_mint(to, a);
}
}
contract DustPriceTest is Test {
address honest = makeAddr("honest");
address attacker = makeAddr("attacker");
// Honest stakes `honestStake` and submits 30e18. The attacker stakes 1 wei.
function _feed(uint256 honestStake) internal returns (Oracle o) {
Tok t = new Tok();
// halfLife 60s, q 50000, both locks 60s, rewardBps 100, gamma 0, sampleSize 5 (like the Sepolia feed)
o = new Oracle(address(this), "Feed A", "d", address(t), 60, 50_000, 60, 60, 100, 0, 5);
t.mint(honest, honestStake);
t.mint(attacker, 1);
vm.startPrank(honest);
t.approve(address(o), honestStake);
o.depositTokens(honestStake);
vm.stopPrank();
vm.startPrank(attacker);
t.approve(address(o), 1);
o.depositTokens(1);
vm.stopPrank();
vm.warp(vm.getBlockTimestamp() + 61);
vm.prank(honest);
o.submitValue(30e18);
}
// Active feed: honest has 1e24 and just submitted.
function test_oneWeiMovesAnActiveFeed() public {
Oracle o = _feed(1e24);
vm.warp(vm.getBlockTimestamp() + 1);
vm.prank(attacker);
try o.submitValue(1e60) {} catch {} // a fix may reject the value
console2.log("active feed after 1 wei submits 1e60:", o.readValue());
assertLt(o.readValue(), 31e18, "1 wei should not move the price");
}
// Quiet feed: 0.105 tokens staked like Feed A and no submit for 82 days.
function test_oneWeiSetsAQuietFeed() public {
Oracle o = _feed(105e15);
vm.warp(vm.getBlockTimestamp() + 82 days);
vm.prank(attacker);
try o.submitValue(1e60) {} catch {} // a fix may reject the value
console2.log("quiet feed after 1 wei submits 1e60:", o.readValue());
assertLt(o.readValue(), 31e18, "1 wei should not move the price");
}
}
Output on main 86df9c0:
Ran 2 tests for test/DustPrice.t.sol:DustPriceTest
[FAIL: 1 wei should not move the price: 1008399971764800820585576846733316763 >= 31000000000000000000] test_oneWeiMovesAnActiveFeed() (gas: 2229332)
Logs:
active feed after 1 wei submits 1e60: 1008399971764800820585576846733316763
[FAIL: 1 wei should not move the price: 1000000000000000000000000000000000000000000000000000000000000 >= 31000000000000000000] test_oneWeiSetsAQuietFeed() (gas: 2226546)
Logs:
quiet feed after 1 wei submits 1e60: 1000000000000000000000000000000000000000000000000000000000000
Suite result: FAILED. 0 passed; 2 failed; 0 skipped; finished in 12.83ms (11.16ms CPU time)
Both tests pass once a fix keeps the price at 30e18.
Environment Details
macOS with forge 1.8.7 (same as CI) and solc 0.8.33 with via_ir. Upstream main at 86df9c0. The live numbers come from cast and a local fork of Sepolia. No real transaction was sent.
Impact
High - Major feature is broken
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Lingua principale
- Solidity
- Stelle
- 3
- Fork
- 6
- Merge medio
- 14h 14m
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di StabilityNexus/OrbOracle-Solidity
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
-
[BUG]: Oracle with rewardBps above 1e5 can never accept a funded price submissionForse già presa @kansalakshat l’ha presa 10 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
StabilityNexus/OrbOracle-Solidity#27 · 1 commento ·
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/100
-
[BUG]: Old prices stay in the feed after someone resubmits (decay is not multiplicative)Forse già presa @Deepak-negi11 l’ha presa 15 giorni fa. Apertabug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
StabilityNexus/OrbOracle-Solidity#25 · 1 commento ·
Tutte le issue di StabilityNexus/OrbOracle-Solidity
Issue simili
-
eth_get_proof reports another account's fields for an absent accountForse già presa @Indian-boult l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
eth_blobBaseFee should return the blob base fee of the next blockForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ethereum/go-ethereum#36196 ·
I maintainer di solito rispondono entro 3 giorni
-
bug Contract security
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
DogStark/PetChain-Contracts#1644 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
solana-foundation/solana-web3.js#4081 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno