Security (EVM-08): No HTTPS validation on BSC_RPC_URLS or TERRA_LCD_URL #10
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#10
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
Medium. MITM risk if HTTP URL accidentally configured.
Description
oracle-service/src/config.rsConfig::from_envacceptsBSC_RPC_URLSandTERRA_LCD_URLas arbitrary strings. No scheme validation.Nothing rejects
http://URLs.Why this matters
An HTTP RPC is trivially man-in-the-middleable by any network-adjacent attacker. They can:
exchangeRateStoredresponses from BSC (rate manipulation, pairs with EVM-01/EVM-03)StateResponsefrom Terra LCD (policy bypass — service thinks last update was hours ago when it wasn't, or current rate is different)With the CL8Y bridge incident this month (VPS cryptominer via exposed postgres) demonstrating the reality of infrastructure compromise, defensive config validation is worth the one-line check.
Recommendation
Add scheme validation in
Config::from_env:Optionally allow
http://localhost/http://127.0.0.1for local development, gated behind aDEV_ALLOW_HTTP=1env flag.Related
mentioned in issue #5
Resolution
This is addressed on
main(commit673ac745, part of the oracle-service hardening that landed with mnemonic-safeDebugforConfig).What changed
Config::from_envparses eachBSC_RPC_URLSentry andTERRA_LCD_URLwith theurlcrate and requires schemehttps.DEV_ALLOW_HTTPto1,true, oryesto allowhttp://only for hostslocalhost,127.0.0.1, or::1(avoids MITM in production while keeping Anvil/local LCD workflows).Files
oracle-service/src/config.rs—validate_https_url,dev_allow_httporacle-service/Cargo.toml—urldependencyWorkspace tests:
cargo test -p ust1-oracle-servicepasses.If anything is still missing for your deployment docs or CI env samples, say what to update.
@Brouie Could you verify that the HTTPS /
DEV_ALLOW_HTTPbehavior inoracle-service/src/config.rsmatches what you had in mind for EVM-08 (#10)? If anything should be tightened or documented differently for operators, let us know.Resolved on main: oracle-service/src/config.rs validates BSC_RPC_URLS and TERRA_LCD_URL with Url::parse + validate_https_url; DEV_ALLOW_HTTP allows http:// only for localhost / 127.0.0.1 / ::1. Supersedes topic branch fix/issue-10-https-validation (same intent; current main has additional oracle hardening).
assigned to @Brouie
@brouie Please verify the HTTPS validation on
maininoracle-service/src/config.rs(validate_https_url,DEV_ALLOW_HTTPfor loopback). I had closed this as implemented; leaving the issue open until you confirm it meets EVM-08.@PlasticDigits verified fix in the same config.rs overhaul (affects both BSC_RPC_URLS and TERRA_LCD_URL).
validate_https_urlinoracle-service/src/config.rs:DEV_ALLOW_HTTP=1env flag gates HTTP exceptionlocalhost,127.0.0.1,::1) even when DEV_ALLOW_HTTP is seturl::Urlparse validation catches malformed URLs before scheme checkExactly matches the recommendation, including the DEV_ALLOW_HTTP loopback escape hatch. Closing.