You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[CRITICAL] set_config can re-point market to malicious contracts — total fund theft #173
prediction_market/src/lib.rsset_config (lines ~375-420) allows the governor to replace the token, referral, leaderboard, and XLM Sac contract addresses without any validation. There is no allowlist check, no code-hash pinning, and no event emission for config changes.
Impact
A compromised or malicious governor can redirect all place_bet XLM deposits to a malicious token contract that absorbs funds and never credits outcomes.
A malicious referral registry can intercept 100% of referral fees.
A malicious leaderboard can inflate rewards to arbitrary addresses.
No off-chain monitoring is possible — no event is emitted when the config changes.
Fix
Pin WASM hashes for all dependency contracts and verify on set_config.
Require a timelock (7+ days) between config request and approval.
Emit a ConfigChanged event with old/new addresses.
Maintain an allowlist of approved dependency deployments.
I'd like to work on resolving this issue. Here is my proposed plan of approach to secure set_config against arbitrary contract replacement risks:
Plan of Approach
WASM Hash Pinning & Allowlist Validation:
Update set_config in prediction_market/src/lib.rs (~lines 375-420) to validate new target contract addresses against an allowlist of approved WASM executable code-hashes.
Verify that any updated target contract address matches expected WASM bytecode before allowing state updates.
Implement Timelocked Configuration Updates:
Introduce a two-step timelock mechanism (request_config_change and execute_config_change) with a mandatory delay window (e.g., 7 days).
Ensure pending configuration changes are stored temporarily and cannot take effect until the timelock expires, giving off-chain monitors time to react.
Emit ConfigChanged Event:
Define and emit a structured ConfigChanged event containing old/new contract addresses, parameter identifiers, and execution timestamps to enable off-chain indexing and security alerts.
Testing & Security Assertions:
Write unit tests verifying that unauthorized WASM code-hashes are immediately rejected during set_config.
Add integration tests validating timelock delay enforcement and confirming ConfigChanged event emissions upon execution.
I can implement these security enhancements and test cases promptly.
Activity
samjay8 commentedon Aug 23, 2026
Hi team,
I'd like to work on resolving this issue. Here is my proposed plan of approach to secure
set_configagainst arbitrary contract replacement risks:Plan of Approach
WASM Hash Pinning & Allowlist Validation:
set_configinprediction_market/src/lib.rs(~lines 375-420) to validate new target contract addresses against an allowlist of approved WASM executable code-hashes.Implement Timelocked Configuration Updates:
request_config_changeandexecute_config_change) with a mandatory delay window (e.g., 7 days).Emit
ConfigChangedEvent:ConfigChangedevent containing old/new contract addresses, parameter identifiers, and execution timestamps to enable off-chain indexing and security alerts.Testing & Security Assertions:
set_config.ConfigChangedevent emissions upon execution.I can implement these security enhancements and test cases promptly.
grantfox-oss commentedon Aug 23, 2026
🦊 GrantFox — @samjay8 has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #173)Good luck! Track your progress on GrantFox.
fix: add ConfigChanged event and increase timelock to 7 days (issue S…
Merge pull request #193 from samjay8/fix/issue-173
grantfox-oss commentedon Aug 30, 2026
🎉 This issue has been marked as completed on GrantFox!
@samjay8's PR #193 was approved and merged by @Muyideen-js.
🏆 @samjay8: You earned 40 FoxPoints for this contribution! Your current tier: Builder (2,140 total points). Track your full progress on GrantFox.
👏 Great work, @samjay8! Keep contributing to SPulse-Org.
Merge branch 'main' into fix/issue-24-leaderboard-merge-corruption