security(indexer/ops): attest chain identity across LCD and treasury RPC failover #1392

Closed
opened 2026-10-04 12:38:07 +00:00 by PlasticDigits · 2 comments
Owner

Summary and severity

Medium integrity; conditional treasury exposure. Configured endpoint trust currently lacks independent network validation, allowing wrong-chain data to enter discovery/analytics and financial preflight.

Internal review references: KIMIK3 TRU-01, OPS-05/07; chains K/S/T. Investigated against source revision 748579ab718026efad54afcef4b2a5186fe82662 on 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

LcdClient provides bounded responses, endpoint failover and namespaces but does not attest returned network identity against an expected chain ID. Contract addresses/code IDs/hashes and block data are then trusted from configured endpoints. Treasury scripts supply columbus-5 as a signing parameter but do not independently check the responding LCD/RPC network; their default RPCs differ. A signing chain-id argument is not remote-node attestation.

A misconfigured/wrong-chain node can poison discovery/analytics; a hostile same-chain node remains a distinct residual even after chain-ID validation. No endpoint compromise or cross-chain transaction was reproduced.

Why a new implementation is needed

Configured endpoint trust currently lacks independent network validation, allowing wrong-chain data to enter discovery/analytics and financial preflight.

Constraints and guardrails

  • Keep LocalTerra explicitly separate and usable through an expected local chain configuration; never accept an unverified network on timeout.
  • Preserve TLS, address/hash pins, spend/quote limits and DRY_RUN behavior. Chain identity does not make a malicious same-chain endpoint honest.
  • Do not broaden signing custody or print keys/API credentials.

Relevant files

  • Require an expected chain ID and attest each endpoint on startup, failover and relevant reconnect; quarantine mismatches before reading price/discovery data.
  • Validate LCD/RPC network, current block freshness and immutable protocol identities before a treasury tick, using a shared configurable endpoint policy.
  • Include attested chain identity in cache/health metadata and document remaining RPC trust assumptions; use independent corroboration for financial-critical reads where feasible.

Acceptance criteria

  • Wrong-chain/unavailable identity endpoints cannot populate caches or prepare treasury transactions.
  • Failover checks every endpoint; health/cache namespace reflects expected and observed network identity.
  • All relevant treasury scripts use the shared preflight and reject mismatched LCD/RPC chain views.
  • Valid Columbus-5 and explicit LocalTerra setups retain working reads and dry runs.

Test plan: supported and failure paths

  • Mock correct/wrong/missing/malformed network IDs, startup failure, failover, endpoint recovery, stale height and mixed endpoint sets.
  • Test explicit endpoint overrides, restart/reconnect and cache separation across two chains with identical addresses/code numbers.
  • Run LCD/startup unit tests and shell/mock treasury regressions; perform read-only live network attestation when available.

Test plan: attack, hack and abuse vectors

  • Return credible code/config JSON from a wrong chain, rotate a fallback to another network and replay a stale same-chain header.
  • Spoof config/price after a successful handshake and document which independent checks detect it; do not claim complete RPC authenticity.
  • Assert no sign/broadcast helper runs after any trust-preflight failure, including retry and dry-run branches.

Verification criteria

  • Absence of network attestation was checked in the LCD client and named scripts; configured signing chain ID is already present.
  • Require endpoint-by-endpoint attestation/failover receipts and zero-transaction failure tests; live tests remain read-only.
    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.

Complements #526/#697 custody inventory without duplicating custody transfers. Different providers are not themselves vulnerabilities; silent trust without validation is the gap.

1391: oracle-integrity, 1388: route-trust. Each report owns its stated acceptance scope.

## Summary and severity Medium integrity; conditional treasury exposure. Configured endpoint trust currently lacks independent network validation, allowing wrong-chain data to enter discovery/analytics and financial preflight. Internal review references: KIMIK3 TRU-01, OPS-05/07; chains K/S/T. Investigated against source revision `748579ab718026efad54afcef4b2a5186fe82662` on 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 LcdClient provides bounded responses, endpoint failover and namespaces but does not attest returned network identity against an expected chain ID. Contract addresses/code IDs/hashes and block data are then trusted from configured endpoints. Treasury scripts supply columbus-5 as a signing parameter but do not independently check the responding LCD/RPC network; their default RPCs differ. A signing chain-id argument is not remote-node attestation. A misconfigured/wrong-chain node can poison discovery/analytics; a hostile same-chain node remains a distinct residual even after chain-ID validation. No endpoint compromise or cross-chain transaction was reproduced. ## Why a new implementation is needed Configured endpoint trust currently lacks independent network validation, allowing wrong-chain data to enter discovery/analytics and financial preflight. ## Constraints and guardrails - Keep LocalTerra explicitly separate and usable through an expected local chain configuration; never accept an unverified network on timeout. - Preserve TLS, address/hash pins, spend/quote limits and DRY_RUN behavior. Chain identity does not make a malicious same-chain endpoint honest. - Do not broaden signing custody or print keys/API credentials. ## Relevant files - [indexer/src/lcd/mod.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/lcd/mod.rs) - [indexer/src/config.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/config.rs) - [indexer/src/startup.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/startup.rs) - [scripts/lib/terrad-host.sh](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/scripts/lib/terrad-host.sh) - [scripts/mint-swap-custc-ust1.sh](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/scripts/mint-swap-custc-ust1.sh) - [scripts/mint-swap-burn-ust1-clunc.sh](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/scripts/mint-swap-burn-ust1-clunc.sh) - [scripts/rebalance-mint-ust1-lp.sh](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/scripts/rebalance-mint-ust1-lp.sh) ## Recommended direction - Require an expected chain ID and attest each endpoint on startup, failover and relevant reconnect; quarantine mismatches before reading price/discovery data. - Validate LCD/RPC network, current block freshness and immutable protocol identities before a treasury tick, using a shared configurable endpoint policy. - Include attested chain identity in cache/health metadata and document remaining RPC trust assumptions; use independent corroboration for financial-critical reads where feasible. ## Acceptance criteria - [ ] Wrong-chain/unavailable identity endpoints cannot populate caches or prepare treasury transactions. - [ ] Failover checks every endpoint; health/cache namespace reflects expected and observed network identity. - [ ] All relevant treasury scripts use the shared preflight and reject mismatched LCD/RPC chain views. - [ ] Valid Columbus-5 and explicit LocalTerra setups retain working reads and dry runs. ## Test plan: supported and failure paths - Mock correct/wrong/missing/malformed network IDs, startup failure, failover, endpoint recovery, stale height and mixed endpoint sets. - Test explicit endpoint overrides, restart/reconnect and cache separation across two chains with identical addresses/code numbers. - Run LCD/startup unit tests and shell/mock treasury regressions; perform read-only live network attestation when available. ## Test plan: attack, hack and abuse vectors - Return credible code/config JSON from a wrong chain, rotate a fallback to another network and replay a stale same-chain header. - Spoof config/price after a successful handshake and document which independent checks detect it; do not claim complete RPC authenticity. - Assert no sign/broadcast helper runs after any trust-preflight failure, including retry and dry-run branches. ## Verification criteria - Absence of network attestation was checked in the LCD client and named scripts; configured signing chain ID is already present. - Require endpoint-by-endpoint attestation/failover receipts and zero-transaction failure tests; live tests remain read-only. 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 Complements #526/#697 custody inventory without duplicating custody transfers. Different providers are not themselves vulnerabilities; silent trust without validation is the gap. ## Related remediation reports [1391: oracle-integrity](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1391), [1388: route-trust](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1388). Each report owns its stated acceptance scope.
Author
Owner

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: Attest the chain served by general LCD clients and treasury failover RPCs. The new rollout transport checks its own chain identity; the general client/treasury work remains. This issue stays open for that substantive work, not merely a verification hold.

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: Attest the chain served by general LCD clients and treasury failover RPCs. The new rollout transport checks its own chain identity; the general client/treasury work remains. This issue stays open for that substantive work, not merely a verification hold.
Author
Owner

PR #1413 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.

Integrated discovery admission now bounds identity probes before uncached work. Default API mocks explicitly attest the chain, frozen state restores on assertions, replay resets remount node identity, and cached quotes retain bounded fresh identity checks. Production guards were retained; full source/API 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.

PR #1413 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](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/merge-2026-10-06/README.md). Integrated discovery admission now bounds identity probes before uncached work. Default API mocks explicitly attest the chain, frozen state restores on assertions, replay resets remount node identity, and cached quotes retain bounded fresh identity checks. Production guards were retained; full source/API 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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/cl8y-dex-terraclassic#1392
No description provided.