security(oracle): reject invalid or stale prices and contain manipulable hub spot marks #1391
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/cl8y-dex-terraclassic#1391
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?
Summary and severity
Medium data integrity; High only when unsafe downstream financial use is proven. Invalid/stale CEX data and manipulable pool marks can corrupt public USD data and, where consumed financially, steer economic decisions without violating settlement math.
Internal review references: KIMIK3 ORB-01/05/06; SBHIGH chain G; chains P/S. Investigated against source revision
748579ab718026efad54afcef4b2a5186fe82662on 2026-10-04. These are engineering findings, not third-party audit certification. Only technical findings and synthetic test cases are included; no conversation, user identity, credentials or real-user activity is published.Current codebase and evidence
CEX parsers accept parse::() without a finite-positive check; successful sources are averaged arithmetically. Overflow/nonfinite conversion through f64_to_bd silently defaults to zero. get_latest_average_price returns the newest historical average without an age bound. Hub pricing uses current reserves and ranks candidates by TVL valued at the candidate's own implied token price, with a $100 floor.
Correction to the audit attack example: factory uniqueness prevents a second UST1/cUSTC pool, and current UST1 resolution accepts only canonical cUSTC as its priced leg. The real UST1 risk is manipulation of the existing reserve ratio. USTR may select between eligible cUSTC and UST1 pools, allowing candidate switching and propagation of a manipulated UST1 mark. Settlement does not read these USD marks. The inspected buyback scripts primarily use CEX USTC/LUNC/FDUSD values; a specific hub-mark-driven treasury path must be demonstrated before claiming that part of the chain.
Why a new implementation is needed
Invalid/stale CEX data and manipulable pool marks can corrupt public USD data and, where consumed financially, steer economic decisions without violating settlement math.
Constraints and guardrails
Relevant files
Recommended direction
Acceptance criteria
Test plan: supported and failure paths
Test plan: attack, hack and abuse vectors
Verification criteria
Record revision, UTC time, exact commands, outcomes and evidence scope. Complete runnable checks first. Unavailable signing, deployment, device or infrastructure checks must be explicitly recorded as unverified; they do not block filing or implementation. An executed failure remains FAIL. Never claim deployment acceptance from unit tests or read-only probes. Public receipts must use synthetic identities and omit secrets.
Related work and duplicate check
Closed #556 introduced hub marks; closed #1216 records discussion rather than a implemented safety monitor. This is a source hardening successor, not a reopening of the earlier price-scale fixes.
Related remediation reports
1392: chain-trust, 1395: parser-integrity. Each report owns its stated acceptance scope.
Merge sweep 2026-10-05: the two existing October 4 audit reports are being preserved on main with the sanity receipt. They document findings; committing them does not implement remediation.
Remaining implementation: Reject invalid/stale oracle marks and contain manipulable hub spot prices. No oracle remediation is included in this merge. This issue stays open for that substantive work, not merely a verification hold.
PR #1412 and the final integration PR #1423 are merged into main. Source acceptance: 944 contract tests + strict all-target Clippy, 858 indexer tests across 29 suites, and 3,093 frontend tests + lint/build. Fresh pinned optimizer verification passed. Full receipt.
Treasury fixtures now exercise chain attestation and oracle validation independently; malformed/stale marks still block preparation. API/oracle/liquidity/database and financial-script regressions pass.
CI was skipped by explicit operator instruction. Native wrap-stack and production execution remain explicitly unverified. Deployment/history/release work is transferred to #1421 and existing #1384/#1385/#1386; the default query-gas repair is #1422. The source issue is complete and carries no verification-only hold; closure does not claim production deployment.
PlasticDigits referenced this issue2026-10-10 11:10:08 +00:00