SuiSec is an OpenClaw extension that performs intent analysis on every Sui transaction before execution. By leveraging sui client call --dry-run and sui client ptb --dry-run, SuiSec compares the simulated transaction results against the user's declared intent to detect malicious contract behavior and prevent asset theft.
As powerful AI agents like OpenClaw bring unprecedented convenience to blockchain interactions, they also introduce the risk of executing malicious contracts. SuiSec acts as a security gatekeeper, ensuring that every transaction matches the user's intent before signing.
Key Features:
- π Automated intent analysis using Sui's dry-run functionality
- π¨ Detects hidden SUI drains and object hijacking
- β Basic malicious contract filtering for OpenClaw transactions
- π§ͺ Tested with testnet malicious contracts (
safe_buy,hidden_steal,profile_theft)
The core intent analysis logic is implemented in main.py, with agent integration guidelines in SKILL.md. When OpenClaw processes a Sui transaction:
- Pre-execution audit: SuiSec intercepts the command and injects
--dry-runflags - Intent comparison: Parses balance changes and object changes from simulation
- Threat detection: Identifies price mismatches and ownership hijacking
- Decision: Returns exit code
0(safe) or1(malicious) to block or allow execution
-
Install from ClawHub
Goto https://clawhub.ai/skills search suisec or just jump into https://clawhub.ai/k66inthesky/suisec
npx clawhub install suisecor
openclaw skills install k66inthesky/suisec -
Locol Install
# Clone the repository git clone https://github.com/yourusername/suisec.git cd suisec # Run setup (installs Sui CLI if needed) ./setup.sh
-
Example Prompt1 for OpenClaw
I want to buy the FakeNFT from this contract: 0x76a28891c190e3065ee0c9f7377ea64b10a1a7a3073ee4fcb8354911d51bfdf7. The price is 0.01 SUI. Run the SuiSec audit firstβif the result is SAFE, just go ahead and execute the transaction for me. -
Example Prompt2 for OpenClaw
I found another NFT on sale at the same contract address. It's also 0.01 SUI, but this one uses the hidden_steal function. Audit it first, and only execute if it's safe.
Execution Logic:
| Output | Exit Code | Action |
|---|---|---|
SAFE TO SIGN |
0 |
β Transaction matches intent - proceed |
BLOCKING MALICIOUS TRANSACTION |
1 |
π Threats detected - do not execute |
A minimal test suite is included for convenience:
./test_suisec.shNote: The test script uses testnet contracts and may require updates. Please modify the contract addresses in the script to match your testnet deployment.
The test suite covers three scenarios:
- β Safe Purchase - Legitimate NFT buy with correct pricing
- π¨ Hidden Steal - Contract secretly drains extra SUI
- π¨ Profile Theft - Contract hijacks user objects
| Threat Type | Detection Method |
|---|---|
| PRICE_MISMATCH | Multiple non-system addresses receive SUI; extras flagged as hidden drains |
| HIJACK | Objects diverted to addresses other than sender or intended recipient |
π SuiSec BLOCKING MALICIOUS TRANSACTION
Threats detected:
- [PRICE_MISMATCH] Hidden drain: 0x...deadbeef received 0.1000 SUI
- [HIJACK] Object 0x7ebf... (UserProfile) diverted to 0x...deadbeef
β DO NOT SIGN β This transaction will steal your assets.
SuiSec is designed as an OpenClaw skill. See SKILL.md for full integration guidelines. In brief:
- OpenClaw intercepts Sui transaction requests
- Runs
python3 main.py <expected_cost> '<command>'before execution - Checks exit code: proceed on
0, block on1 - Displays threat analysis if malicious behavior detected
Supported detection:
- β Hidden SUI drains to unexpected addresses
- β Object ownership hijacking
- β Basic asset flow mismatches
Not yet detected:
- β Advanced proxy call patterns
- β Time-delayed malicious logic
- β Complex multi-step exploits
Powerful AI agents like OpenClaw bring incredible convenience to Web3, but they also carry the hidden risk of executing malicious contracts on our behalf. I find Sui's dry-run functionality fascinatingβit provides a window into what a transaction would do before committing on-chain.
I plan to continue exploring what intent analysis can achieve in detecting and preventing malicious contract interactions. Updates will be shared here on this GitHub repository and on ClawHub. If you have ideas or suggestions for improving SuiSec, please feel free to open an issue or contribute.
Lastly, I'm k66, and also a co-founder of SuiAudit. I invite you to follow SuiAudit's development as we work to make the Sui ecosystem safer for everyone.
| Tool / Interface | Model Version | Primary Use Case |
|---|---|---|
| Claude Code CLI | Claude 3.5 Sonnet / Opus 4.6 (Internal) | Main Development: Core logic, Move 2024 contract architecture, and systematic debugging. |
| GitHub Copilot CLI | GitHub Copilot (Codex) | Development Aid: Quick CLI command generation and minor boilerplate code snippets. |
| Gemini | Gemini 3 Pro | Planning: Project ideation, technical roadmap planning, and Sui ecosystem research. |
| OpenClaw | Experimental Models | Experimentation: Used for logic flow exploration and code optimization testing. |
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - see LICENSE file for details
Disclaimer: SuiSec is an experimental security tool. While it provides basic protection against common attack patterns, it cannot guarantee complete security. Always exercise caution when interacting with unverified smart contracts.
