Security (EVM-03): VENUS_VTOKEN_ADDRESS accepted without allowlist or validation #9
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@PlasticDigits finding from security review on #5.
Severity
Low-to-Medium. Deployment footgun; malicious or wrong token silently accepted.
Description
oracle-service/src/bsc.rsread_exchange_rate_stored:Only validates hex format. The address is not checked against the canonical Venus vFDUSD deployment on BSC mainnet.
Why this matters
If
VENUS_VTOKEN_ADDRESSis misconfigured (typo, copy-paste from wrong env, compromise of the deploy manifest), the service readsexchangeRateStoredfrom a different vToken — e.g. vBUSD, vUSDC, or an attacker-deployed contract that implements the same signature.A different-underlying vToken returns a rate scaled to a different underlying decimal, violating INV-MATH-001 silently (EVM-04 finding). An attacker-deployed contract can return any rate they want.
Recommendation
Hardcode the canonical Venus vFDUSD address as a compile-time constant, or maintain an allowlist with environment-specific entries (mainnet vs testnet). Compare at startup and error if mismatch:
Additionally consider bytecode hash verification on startup — the canonical Venus vToken implementation has a known deployed bytecode; any deviation is suspicious.
Related
mentioned in issue #5
mentioned in commit
c42ca853f4Fix (merged to
main)What changed
oracle-servicenow validatesVENUS_VTOKEN_ADDRESSat startup inConfig::from_env().0xC4eF4229FEc74Ccfe17B2bdeF7715fAC740BA0ba(case-insensitive; parsed with AlloyAddress).exchangeRateStoredon the wrong contract.Tests
oracle-service/src/config.rscover canonical (checksummed + lowercase) acceptance and rejection of a different token address.Not in scope (per recommendation)
Commit:
c42ca85on branchfix/glab-9-venus-vtoken-canonical, merged via fast-forward intomainand pushed toorigin.mentioned in issue #12
@PlasticDigits verified fix on
c42ca85.CANONICAL_VENUS_VFDUSD_BSC_MAINNET = 0xC4eF4229FEc74Ccfe17B2bdeF7715fAC740BA0bahardcoded as compile-time constantvalidate_venus_vtoken_addressparses both got/want asAddressfor checksum-insensitive equalityConfig::from_env— startup fails fast with clear error showing expected vs gotMisconfiguration or intentional swap to another vToken now impossible without code change + redeploy. Correct tradeoff — Venus contract upgrades are rare, the defense is worth the friction.