whitzard-claw 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -0
- package/bin/whitzard-tui.js +73 -0
- package/bin/whitzard-webui.js +67 -0
- package/dist/tui/tui.js +38733 -0
- package/dist/webui/index.html +1235 -0
- package/dist/webui/server.js +876 -0
- package/ioc/c2-ips.txt +25 -0
- package/ioc/file-hashes.txt +13 -0
- package/ioc/malicious-domains.txt +46 -0
- package/ioc/malicious-hashes.txt +5 -0
- package/ioc/malicious-publishers.txt +34 -0
- package/ioc/malicious-skill-patterns.txt +87 -0
- package/package.json +50 -0
- package/scripts/check/access_control.sh +183 -0
- package/scripts/check/credential_storage.sh +222 -0
- package/scripts/check/execution_sandbox.sh +502 -0
- package/scripts/check/memory_poisoning.sh +334 -0
- package/scripts/check/network_exposure.sh +479 -0
- package/scripts/check/resource_cost.sh +182 -0
- package/scripts/check/supply_chain.sh +553 -0
- package/scripts/repair/access_control/_common.sh +249 -0
- package/scripts/repair/access_control/check_1.sh +28 -0
- package/scripts/repair/access_control/check_2.sh +27 -0
- package/scripts/repair/access_control/check_3.sh +23 -0
- package/scripts/repair/access_control/check_4.sh +23 -0
- package/scripts/repair/access_control/check_5.sh +20 -0
- package/scripts/repair/credential_storage/_common.sh +277 -0
- package/scripts/repair/credential_storage/check_1.sh +47 -0
- package/scripts/repair/credential_storage/check_2.sh +35 -0
- package/scripts/repair/credential_storage/check_3.sh +53 -0
- package/scripts/repair/credential_storage/logs/security-scan.log +15 -0
- package/scripts/repair/execution_sandbox/_common.sh +302 -0
- package/scripts/repair/execution_sandbox/check_1.sh +67 -0
- package/scripts/repair/execution_sandbox/check_10.sh +23 -0
- package/scripts/repair/execution_sandbox/check_11.sh +34 -0
- package/scripts/repair/execution_sandbox/check_12.sh +38 -0
- package/scripts/repair/execution_sandbox/check_13.sh +29 -0
- package/scripts/repair/execution_sandbox/check_2.sh +46 -0
- package/scripts/repair/execution_sandbox/check_3.sh +37 -0
- package/scripts/repair/execution_sandbox/check_4.sh +23 -0
- package/scripts/repair/execution_sandbox/check_5.sh +28 -0
- package/scripts/repair/execution_sandbox/check_6.sh +17 -0
- package/scripts/repair/execution_sandbox/check_7.sh +17 -0
- package/scripts/repair/execution_sandbox/check_8.sh +17 -0
- package/scripts/repair/execution_sandbox/check_9.sh +17 -0
- package/scripts/repair/execution_sandbox/logs/security-scan.log +10 -0
- package/scripts/repair/memory_poisoning/_common.sh +336 -0
- package/scripts/repair/memory_poisoning/check_1.sh +51 -0
- package/scripts/repair/memory_poisoning/check_2.sh +26 -0
- package/scripts/repair/memory_poisoning/check_3.sh +24 -0
- package/scripts/repair/memory_poisoning/check_4.sh +27 -0
- package/scripts/repair/memory_poisoning/check_5.sh +20 -0
- package/scripts/repair/network_exposure/_common.sh +330 -0
- package/scripts/repair/network_exposure/check_1.sh +86 -0
- package/scripts/repair/network_exposure/check_10.sh +16 -0
- package/scripts/repair/network_exposure/check_11.sh +31 -0
- package/scripts/repair/network_exposure/check_12.sh +24 -0
- package/scripts/repair/network_exposure/check_2.sh +26 -0
- package/scripts/repair/network_exposure/check_3.sh +43 -0
- package/scripts/repair/network_exposure/check_4.sh +23 -0
- package/scripts/repair/network_exposure/check_5.sh +16 -0
- package/scripts/repair/network_exposure/check_6.sh +98 -0
- package/scripts/repair/network_exposure/check_7.sh +35 -0
- package/scripts/repair/network_exposure/check_8.sh +19 -0
- package/scripts/repair/network_exposure/check_9.sh +19 -0
- package/scripts/repair/resource_cost/_common.sh +303 -0
- package/scripts/repair/resource_cost/check_1.sh +16 -0
- package/scripts/repair/resource_cost/check_2.sh +16 -0
- package/scripts/repair/resource_cost/check_3.sh +23 -0
- package/scripts/repair/supply_chain/_common.sh +222 -0
- package/scripts/repair/supply_chain/check_1.sh +95 -0
- package/scripts/repair/supply_chain/check_10.sh +60 -0
- package/scripts/repair/supply_chain/check_11.sh +63 -0
- package/scripts/repair/supply_chain/check_12.sh +36 -0
- package/scripts/repair/supply_chain/check_13.sh +44 -0
- package/scripts/repair/supply_chain/check_14.sh +33 -0
- package/scripts/repair/supply_chain/check_15.sh +33 -0
- package/scripts/repair/supply_chain/check_16.sh +34 -0
- package/scripts/repair/supply_chain/check_17.sh +61 -0
- package/scripts/repair/supply_chain/check_18.sh +62 -0
- package/scripts/repair/supply_chain/check_2.sh +93 -0
- package/scripts/repair/supply_chain/check_3.sh +78 -0
- package/scripts/repair/supply_chain/check_4.sh +72 -0
- package/scripts/repair/supply_chain/check_5.sh +73 -0
- package/scripts/repair/supply_chain/check_6.sh +81 -0
- package/scripts/repair/supply_chain/check_7.sh +52 -0
- package/scripts/repair/supply_chain/check_8.sh +71 -0
- package/scripts/repair/supply_chain/check_9.sh +78 -0
- package/scripts/repair/supply_chain/logs/security-scan.log +77 -0
- package/scripts/scan.sh +228 -0
- package/webui/index.html +1235 -0
package/scripts/scan.sh
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Exit codes: 0=SECURE, 1=WARNINGS, 2=COMPROMISED
|
|
3
|
+
|
|
4
|
+
set -uo pipefail
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
8
|
+
IOC_DIR="$PROJECT_DIR/ioc"
|
|
9
|
+
SELF_DIR_NAME="$(basename "$PROJECT_DIR")"
|
|
10
|
+
|
|
11
|
+
# Default OpenClaw paths - Use environment variable or default to user's home
|
|
12
|
+
OPENCLAW_DIR="${OPENCLAW_HOME:-$HOME/.openclaw}"
|
|
13
|
+
SKILLS_DIR="$OPENCLAW_DIR/workspace/skills"
|
|
14
|
+
WORKSPACE_DIR="$OPENCLAW_DIR/workspace"
|
|
15
|
+
LOG_DIR="$PROJECT_DIR/logs"
|
|
16
|
+
LOG_FILE="$LOG_DIR/security-scan.log"
|
|
17
|
+
TIMESTAMP="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
18
|
+
|
|
19
|
+
# Set PATH for Linux systems (adjust as needed for your environment)
|
|
20
|
+
export PATH="$HOME/.local/bin:/usr/local/bin:/usr/bin:$PATH"
|
|
21
|
+
|
|
22
|
+
# Overall counters
|
|
23
|
+
CRITICAL=0
|
|
24
|
+
WARNINGS=0
|
|
25
|
+
CLEAN=0
|
|
26
|
+
|
|
27
|
+
# Per-category counters
|
|
28
|
+
CATEGORY_NAME=""
|
|
29
|
+
CATEGORY_TOTAL_CHECKS=0
|
|
30
|
+
CATEGORY_CRITICAL=0
|
|
31
|
+
CATEGORY_WARNINGS=0
|
|
32
|
+
CATEGORY_CLEAN=0
|
|
33
|
+
|
|
34
|
+
mkdir -p "$LOG_DIR"
|
|
35
|
+
|
|
36
|
+
log() {
|
|
37
|
+
echo "$1" | tee -a "$LOG_FILE"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
header() {
|
|
41
|
+
# Usage: header <new_index> <message>
|
|
42
|
+
log ""
|
|
43
|
+
log "[$1/$CATEGORY_TOTAL_CHECKS] $2"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
result_clean() {
|
|
47
|
+
log "CLEAN: $1"
|
|
48
|
+
CLEAN=$((CLEAN + 1))
|
|
49
|
+
CATEGORY_CLEAN=$((CATEGORY_CLEAN + 1))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
result_warn() {
|
|
53
|
+
log "WARNING: $1"
|
|
54
|
+
WARNINGS=$((WARNINGS + 1))
|
|
55
|
+
CATEGORY_WARNINGS=$((CATEGORY_WARNINGS + 1))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
result_critical() {
|
|
59
|
+
log "CRITICAL: $1"
|
|
60
|
+
CRITICAL=$((CRITICAL + 1))
|
|
61
|
+
CATEGORY_CRITICAL=$((CATEGORY_CRITICAL + 1))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
category_start() {
|
|
65
|
+
# Usage: category_start <name> <total_checks>
|
|
66
|
+
CATEGORY_NAME="$1"
|
|
67
|
+
CATEGORY_TOTAL_CHECKS="$2"
|
|
68
|
+
CATEGORY_CRITICAL=0
|
|
69
|
+
CATEGORY_WARNINGS=0
|
|
70
|
+
CATEGORY_CLEAN=0
|
|
71
|
+
|
|
72
|
+
log ""
|
|
73
|
+
log "----------------------------------------"
|
|
74
|
+
log "CATEGORY START: $CATEGORY_NAME ($CATEGORY_TOTAL_CHECKS checks)"
|
|
75
|
+
log "----------------------------------------"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
category_end() {
|
|
79
|
+
log ""
|
|
80
|
+
log "CATEGORY SUMMARY: $CATEGORY_NAME"
|
|
81
|
+
log " critical: $CATEGORY_CRITICAL"
|
|
82
|
+
log " warning : $CATEGORY_WARNINGS"
|
|
83
|
+
log " clean : $CATEGORY_CLEAN"
|
|
84
|
+
log "----------------------------------------"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Use timeout if available (macOS may only have gtimeout via coreutils)
|
|
88
|
+
TIMEOUT_BIN=""
|
|
89
|
+
if command -v timeout >/dev/null 2>&1; then
|
|
90
|
+
TIMEOUT_BIN="timeout"
|
|
91
|
+
elif command -v gtimeout >/dev/null 2>&1; then
|
|
92
|
+
TIMEOUT_BIN="gtimeout"
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
run_with_timeout() {
|
|
96
|
+
local secs="$1"
|
|
97
|
+
shift
|
|
98
|
+
|
|
99
|
+
if [ -n "$TIMEOUT_BIN" ]; then
|
|
100
|
+
"$TIMEOUT_BIN" "$secs" "$@"
|
|
101
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
102
|
+
python3 - "$secs" "$@" <<'PY'
|
|
103
|
+
import subprocess
|
|
104
|
+
import sys
|
|
105
|
+
|
|
106
|
+
def main():
|
|
107
|
+
try:
|
|
108
|
+
secs = float(sys.argv[1])
|
|
109
|
+
except Exception:
|
|
110
|
+
secs = 0
|
|
111
|
+
|
|
112
|
+
cmd = sys.argv[2:]
|
|
113
|
+
if not cmd:
|
|
114
|
+
sys.exit(1)
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
proc = subprocess.Popen(cmd)
|
|
118
|
+
try:
|
|
119
|
+
proc.wait(timeout=secs if secs > 0 else None)
|
|
120
|
+
except subprocess.TimeoutExpired:
|
|
121
|
+
proc.kill()
|
|
122
|
+
proc.wait()
|
|
123
|
+
sys.exit(124)
|
|
124
|
+
sys.exit(proc.returncode if proc.returncode is not None else 0)
|
|
125
|
+
except FileNotFoundError:
|
|
126
|
+
sys.exit(127)
|
|
127
|
+
|
|
128
|
+
if __name__ == "__main__":
|
|
129
|
+
main()
|
|
130
|
+
PY
|
|
131
|
+
else
|
|
132
|
+
"$@"
|
|
133
|
+
fi
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
# Load IOC data
|
|
137
|
+
load_ips() {
|
|
138
|
+
if [ -f "$IOC_DIR/c2-ips.txt" ]; then
|
|
139
|
+
grep -v '^#' "$IOC_DIR/c2-ips.txt" | grep -v '^$' | cut -d'|' -f1
|
|
140
|
+
else
|
|
141
|
+
echo "91.92.242"
|
|
142
|
+
fi
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
load_domains() {
|
|
146
|
+
if [ -f "$IOC_DIR/malicious-domains.txt" ]; then
|
|
147
|
+
grep -v '^#' "$IOC_DIR/malicious-domains.txt" | grep -v '^$' | cut -d'|' -f1
|
|
148
|
+
else
|
|
149
|
+
echo "webhook.site"
|
|
150
|
+
fi
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
log "========================================"
|
|
154
|
+
log "OPENCLAW SECURITY SCAN - $TIMESTAMP"
|
|
155
|
+
log "========================================"
|
|
156
|
+
log "PROJECT_DIR : $PROJECT_DIR"
|
|
157
|
+
log "OPENCLAW_DIR : $OPENCLAW_DIR"
|
|
158
|
+
log "SKILLS_DIR : $SKILLS_DIR"
|
|
159
|
+
log "WORKSPACE_DIR: $WORKSPACE_DIR"
|
|
160
|
+
log "LOG_FILE : $LOG_FILE"
|
|
161
|
+
|
|
162
|
+
# ============================================================
|
|
163
|
+
# CATEGORY 1: NETWORK GATEWAY
|
|
164
|
+
# ============================================================
|
|
165
|
+
category_start "NETWORK_EXPOSURE" 12
|
|
166
|
+
source "$SCRIPT_DIR/check/network_exposure.sh"
|
|
167
|
+
category_end
|
|
168
|
+
|
|
169
|
+
# ============================================================
|
|
170
|
+
# CATEGORY 2: ACCESS CONTROL
|
|
171
|
+
# ============================================================
|
|
172
|
+
category_start "ACCESS_CONTROL" 5
|
|
173
|
+
source "$SCRIPT_DIR/check/access_control.sh"
|
|
174
|
+
category_end
|
|
175
|
+
|
|
176
|
+
# ============================================================
|
|
177
|
+
# CATEGORY 3: EXECUTION SANDBOX
|
|
178
|
+
# ============================================================
|
|
179
|
+
category_start "EXECUTION_SANDBOX" 13
|
|
180
|
+
source "$SCRIPT_DIR/check/execution_sandbox.sh"
|
|
181
|
+
category_end
|
|
182
|
+
|
|
183
|
+
# ============================================================
|
|
184
|
+
# CATEGORY 4: CREDENTIAL STORAGE
|
|
185
|
+
# ============================================================
|
|
186
|
+
category_start "CREDENTIAL_STORAGE" 3
|
|
187
|
+
source "$SCRIPT_DIR/check/credential_storage.sh"
|
|
188
|
+
category_end
|
|
189
|
+
|
|
190
|
+
# ============================================================
|
|
191
|
+
# CATEGORY 5: MEMORY POISONING
|
|
192
|
+
# ============================================================
|
|
193
|
+
category_start "MEMORY_POISONING" 5
|
|
194
|
+
source "$SCRIPT_DIR/check/memory_poisoning.sh"
|
|
195
|
+
category_end
|
|
196
|
+
|
|
197
|
+
# ============================================================
|
|
198
|
+
# CATEGORY 6: SUPPLY CHAIN
|
|
199
|
+
# ============================================================
|
|
200
|
+
category_start "SUPPLY_CHAIN" 18
|
|
201
|
+
source "$SCRIPT_DIR/check/supply_chain.sh"
|
|
202
|
+
category_end
|
|
203
|
+
|
|
204
|
+
# ============================================================
|
|
205
|
+
# CATEGORY 7: RESOURCE COST
|
|
206
|
+
# ============================================================
|
|
207
|
+
category_start "RESOURCE_COST" 3
|
|
208
|
+
source "$SCRIPT_DIR/check/resource_cost.sh"
|
|
209
|
+
category_end
|
|
210
|
+
|
|
211
|
+
# ============================================================
|
|
212
|
+
# FINAL SUMMARY
|
|
213
|
+
# ============================================================
|
|
214
|
+
log ""
|
|
215
|
+
log "========================================"
|
|
216
|
+
log "SCAN COMPLETE: $CRITICAL critical, $WARNINGS warnings, $CLEAN clean"
|
|
217
|
+
log "========================================"
|
|
218
|
+
|
|
219
|
+
if [ "$CRITICAL" -gt 0 ]; then
|
|
220
|
+
log "STATUS: COMPROMISED - Immediate action required"
|
|
221
|
+
exit 2
|
|
222
|
+
elif [ "$WARNINGS" -gt 0 ]; then
|
|
223
|
+
log "STATUS: ATTENTION - Review warnings"
|
|
224
|
+
exit 1
|
|
225
|
+
else
|
|
226
|
+
log "STATUS: SECURE"
|
|
227
|
+
exit 0
|
|
228
|
+
fi
|