security(router): bound reverse-query work and isolate exact-output capacity #1389
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#1389
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–High public availability. Public reverse queries can amplify pair simulation work far beyond the intended small budget and share scarce exact-output capacity, degrading legitimate quote availability.
Internal review references: SBHIGH-03/09/13; KIMIK3 EO-1; chain B. 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
reverse_greedy_offerrepeatedly calls full pairHybridSimulationduring a 128-step expansion, a confirmation, then Uint128-width bisection. This is finite but lacks a small shared call budget, memoization or pool seed; a request can perform hundreds of nested simulations across MAX_HOPS=4. Pair declared-hybrid reverse has a 32-call ceiling but still exhausts it for feasible large targets. Browser reverse queries reach LCD directly, bypassing indexer HTTP controls. Exact-output HTTP work uses four global permits and a finite timeout, with no per-client capacity share. Observe also subtracts user-supplied seconds_ago from block time without checked subtraction.Quote-path outages can impair availability; sandwich extraction additionally needs victim transactions and weakened user protections. No forced fallback or MEV profit was reproduced.
Why a new implementation is needed
Public reverse queries can amplify pair simulation work far beyond the intended small budget and share scarce exact-output capacity, degrading legitimate quote availability.
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
New router amplification/capacity repair; #257 and closed #1376 address earlier pair/receive sizing, while #1386 separately tracks production pair rollout.
Related remediation reports
1399: book-liveness, 1394: discovery-cache. 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: Bound router reverse-query simulations and isolate public exact-output request capacity. The rollout and dependency PRs do not change these query limits. This issue stays open for that substantive work, not merely a verification hold.
PR #1407 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.
The reverse-path fixture now reverses hop order as well as asset directions. The real default-3M funded reverse-query failure (3,043,317 gas) is retained as concrete repair #1422; the passing isolated chain fixture used a finite 15M limit.
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.