mohuclaw 1.0.1
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/LICENSE +21 -0
- package/README.md +64 -0
- package/bin/mohu-tui.js +73 -0
- package/bin/mohu-webui.js +67 -0
- package/dist/tui/tui.js +38733 -0
- package/dist/webui/index.html +1551 -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 +46 -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 +1551 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 3 (origin 3): Reverse Shells & Backdoors
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_3.sh
|
|
11
|
+
|
|
12
|
+
SHELL_PATTERN='nc -e|/dev/tcp/|mkfifo.*nc|bash -i >|socat.*exec|python.*socket.*connect|nohup.*bash.*tcp|perl.*socket.*INET|ruby.*TCPSocket|php.*fsockopen|lua.*socket\.tcp|xattr -[cr]|com\.apple\.quarantine'
|
|
13
|
+
FOUND_SKILLS=()
|
|
14
|
+
|
|
15
|
+
if [ -d "$SKILLS_DIR" ]; then
|
|
16
|
+
while IFS= read -r file; do
|
|
17
|
+
skill_name="$(basename "$(dirname "$file")")"
|
|
18
|
+
# Deduplicate
|
|
19
|
+
if [[ ! " ${FOUND_SKILLS[*]} " =~ " ${skill_name} " ]]; then
|
|
20
|
+
FOUND_SKILLS+=("$skill_name")
|
|
21
|
+
fi
|
|
22
|
+
done < <(grep -rlinE --exclude-dir="$SELF_DIR_NAME" "$SHELL_PATTERN" "$SKILLS_DIR" 2>/dev/null || true)
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Auto-fix
|
|
26
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
27
|
+
TARGET_SKILL="${SKILL_NAME}"
|
|
28
|
+
log "AUTO-FIX: Removing skill '$TARGET_SKILL'..."
|
|
29
|
+
|
|
30
|
+
SKILL_PATH="$SKILLS_DIR/$TARGET_SKILL"
|
|
31
|
+
LOCK_FILE="$WORKSPACE_DIR/.clawhub/lock.json"
|
|
32
|
+
|
|
33
|
+
# 删除 skill 目录
|
|
34
|
+
if rm -rf "$SKILL_PATH"; then
|
|
35
|
+
log "SUCCESS: Skill directory '$SKILL_PATH' removed."
|
|
36
|
+
else
|
|
37
|
+
log "ERROR: Failed to remove '$SKILL_PATH'"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# 从 lock.json 移除条目
|
|
42
|
+
if [ -f "$LOCK_FILE" ] && command -v python3 >/dev/null 2>&1; then
|
|
43
|
+
python3 -c "
|
|
44
|
+
import json, sys
|
|
45
|
+
with open('$LOCK_FILE') as f:
|
|
46
|
+
data = json.load(f)
|
|
47
|
+
data['skills'] = {k: v for k, v in data['skills'].items() if k != '$TARGET_SKILL'}
|
|
48
|
+
with open('$LOCK_FILE', 'w') as f:
|
|
49
|
+
json.dump(data, f, indent=2)
|
|
50
|
+
" && log "SUCCESS: Removed '$TARGET_SKILL' from lock.json"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
log "SUCCESS: Skill '$TARGET_SKILL' has been removed."
|
|
54
|
+
exit 0
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Guidance
|
|
58
|
+
cat << EOF
|
|
59
|
+
RECOMMENDED ACTIONS:
|
|
60
|
+
1. Remove the suspicious skills immediately:
|
|
61
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo " rm -rf ~/.openclaw/workspace/skills/$skill"; done)
|
|
62
|
+
|
|
63
|
+
2. Check for active suspicious connections:
|
|
64
|
+
netstat -an | grep ESTABLISHED
|
|
65
|
+
lsof -i -n -P | grep ESTABLISHED
|
|
66
|
+
|
|
67
|
+
3. Kill any suspicious connections
|
|
68
|
+
kill -9 <PID>
|
|
69
|
+
|
|
70
|
+
4. Review system for persistence mechanisms:
|
|
71
|
+
systemctl list-units --type=service --user
|
|
72
|
+
crontab -l
|
|
73
|
+
|
|
74
|
+
auto-fix
|
|
75
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo "$skill"; done)
|
|
76
|
+
EOF
|
|
77
|
+
|
|
78
|
+
exit 0
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 4 (origin 4): Credential Exfiltration Endpoints
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_4.sh
|
|
11
|
+
|
|
12
|
+
DOMAIN_PATTERN="$(load_domains | tr '\n' '|' | sed 's/|$//' | sed 's/\./\\./g')"
|
|
13
|
+
FOUND_SKILLS=()
|
|
14
|
+
|
|
15
|
+
if [ -d "$SKILLS_DIR" ]; then
|
|
16
|
+
while IFS= read -r file; do
|
|
17
|
+
skill_name="$(basename "$(dirname "$file")")"
|
|
18
|
+
# Deduplicate
|
|
19
|
+
if [[ ! " ${FOUND_SKILLS[*]} " =~ " ${skill_name} " ]]; then
|
|
20
|
+
FOUND_SKILLS+=("$skill_name")
|
|
21
|
+
fi
|
|
22
|
+
done < <(grep -rlinE --exclude-dir="$SELF_DIR_NAME" "$DOMAIN_PATTERN" "$SKILLS_DIR" 2>/dev/null || true)
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Auto-fix
|
|
26
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
27
|
+
TARGET_SKILL="${SKILL_NAME}"
|
|
28
|
+
log "AUTO-FIX: Removing skill '$TARGET_SKILL'..."
|
|
29
|
+
|
|
30
|
+
SKILL_PATH="$SKILLS_DIR/$TARGET_SKILL"
|
|
31
|
+
LOCK_FILE="$WORKSPACE_DIR/.clawhub/lock.json"
|
|
32
|
+
|
|
33
|
+
# 删除 skill 目录
|
|
34
|
+
if rm -rf "$SKILL_PATH"; then
|
|
35
|
+
log "SUCCESS: Skill directory '$SKILL_PATH' removed."
|
|
36
|
+
else
|
|
37
|
+
log "ERROR: Failed to remove '$SKILL_PATH'"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# 从 lock.json 移除条目
|
|
42
|
+
if [ -f "$LOCK_FILE" ] && command -v python3 >/dev/null 2>&1; then
|
|
43
|
+
python3 -c "
|
|
44
|
+
import json, sys
|
|
45
|
+
with open('$LOCK_FILE') as f:
|
|
46
|
+
data = json.load(f)
|
|
47
|
+
data['skills'] = {k: v for k, v in data['skills'].items() if k != '$TARGET_SKILL'}
|
|
48
|
+
with open('$LOCK_FILE', 'w') as f:
|
|
49
|
+
json.dump(data, f, indent=2)
|
|
50
|
+
" && log "SUCCESS: Removed '$TARGET_SKILL' from lock.json"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
log "SUCCESS: Skill '$TARGET_SKILL' has been removed."
|
|
54
|
+
exit 0
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Guidance
|
|
58
|
+
cat << EOF
|
|
59
|
+
RECOMMENDED ACTIONS:
|
|
60
|
+
1. Remove the suspicious skills immediately:
|
|
61
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo " rm -rf ~/.openclaw/workspace/skills/$skill"; done)
|
|
62
|
+
|
|
63
|
+
2. Review network activity:
|
|
64
|
+
lsof -i -n -P
|
|
65
|
+
|
|
66
|
+
3. Check for unauthorized data transfers in logs
|
|
67
|
+
|
|
68
|
+
auto-fix
|
|
69
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo "$skill"; done)
|
|
70
|
+
EOF
|
|
71
|
+
|
|
72
|
+
exit 0
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 5 (origin 15): Known Malicious Publisher Detection
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_5.sh
|
|
11
|
+
|
|
12
|
+
FOUND_SKILLS=()
|
|
13
|
+
if [ -f "$IOC_DIR/malicious-publishers.txt" ] && [ -d "$SKILLS_DIR" ]; then
|
|
14
|
+
PUBLISHERS="$(grep -v '^#' "$IOC_DIR/malicious-publishers.txt" | grep -v '^$' | cut -d'|' -f1)"
|
|
15
|
+
while IFS= read -r pub; do
|
|
16
|
+
[ -z "$pub" ] && continue
|
|
17
|
+
while IFS= read -r file; do
|
|
18
|
+
skill_name="$(basename "$(dirname "$file")")"
|
|
19
|
+
if [[ ! " ${FOUND_SKILLS[*]} " =~ " ${skill_name} " ]]; then
|
|
20
|
+
FOUND_SKILLS+=("$skill_name")
|
|
21
|
+
fi
|
|
22
|
+
done < <(grep -rlF --exclude-dir="$SELF_DIR_NAME" "$pub" "$SKILLS_DIR" 2>/dev/null || true)
|
|
23
|
+
done <<EOF
|
|
24
|
+
$PUBLISHERS
|
|
25
|
+
EOF
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Auto-fix
|
|
29
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
30
|
+
TARGET_SKILL="${SKILL_NAME}"
|
|
31
|
+
log "AUTO-FIX: Removing skill '$TARGET_SKILL'..."
|
|
32
|
+
|
|
33
|
+
SKILL_PATH="$SKILLS_DIR/$TARGET_SKILL"
|
|
34
|
+
LOCK_FILE="$WORKSPACE_DIR/.clawhub/lock.json"
|
|
35
|
+
|
|
36
|
+
# 删除 skill 目录
|
|
37
|
+
if rm -rf "$SKILL_PATH"; then
|
|
38
|
+
log "SUCCESS: Skill directory '$SKILL_PATH' removed."
|
|
39
|
+
else
|
|
40
|
+
log "ERROR: Failed to remove '$SKILL_PATH'"
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# 从 lock.json 移除条目
|
|
45
|
+
if [ -f "$LOCK_FILE" ] && command -v python3 >/dev/null 2>&1; then
|
|
46
|
+
python3 -c "
|
|
47
|
+
import json, sys
|
|
48
|
+
with open('$LOCK_FILE') as f:
|
|
49
|
+
data = json.load(f)
|
|
50
|
+
data['skills'] = {k: v for k, v in data['skills'].items() if k != '$TARGET_SKILL'}
|
|
51
|
+
with open('$LOCK_FILE', 'w') as f:
|
|
52
|
+
json.dump(data, f, indent=2)
|
|
53
|
+
" && log "SUCCESS: Removed '$TARGET_SKILL' from lock.json"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
log "SUCCESS: Skill '$TARGET_SKILL' has been removed."
|
|
57
|
+
exit 0
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Guidance
|
|
61
|
+
cat << EOF
|
|
62
|
+
RECOMMENDED ACTIONS:
|
|
63
|
+
1. These publishers are known to distribute malicious skills
|
|
64
|
+
2. Remove all skills from these publishers immediately:
|
|
65
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo " rm -rf ~/.openclaw/workspace/skills/$skill"; done)
|
|
66
|
+
|
|
67
|
+
Immediate removal of skills from blacklisted publishers required
|
|
68
|
+
|
|
69
|
+
auto-fix
|
|
70
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo "$skill"; done)
|
|
71
|
+
EOF
|
|
72
|
+
|
|
73
|
+
exit 0
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 6 (origin 23): Plugin/Extension Security
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_6.sh
|
|
11
|
+
|
|
12
|
+
EXT_DIR="$OPENCLAW_DIR/extensions"
|
|
13
|
+
DOMAIN_PATTERN="$(load_domains | tr '\n' '|' | sed 's/|$//' | sed 's/\./\\./g')"
|
|
14
|
+
|
|
15
|
+
FOUND_EXTS=() # critical: malicious domain references → auto-fix target
|
|
16
|
+
WARN_EXTS=() # warning: code-execution/network patterns → manual review only
|
|
17
|
+
|
|
18
|
+
if [ -d "$EXT_DIR" ]; then
|
|
19
|
+
EXT_COUNT="$(find "$EXT_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')"
|
|
20
|
+
|
|
21
|
+
if [ "$EXT_COUNT" -gt 0 ]; then
|
|
22
|
+
while IFS= read -r ext; do
|
|
23
|
+
[ -z "$ext" ] && continue
|
|
24
|
+
EXT_NAME="$(basename "$ext")"
|
|
25
|
+
|
|
26
|
+
# WARNING: code-execution / network patterns
|
|
27
|
+
EXT_SUS="$(grep -rlE 'eval\(|exec\(|child_process|\.exec\(|net\.connect|http\.request|fetch\(' "$ext" 2>/dev/null | head -3 || true)"
|
|
28
|
+
if [ -n "$EXT_SUS" ]; then
|
|
29
|
+
if [[ ! " ${WARN_EXTS[*]} " =~ " ${EXT_NAME} " ]]; then
|
|
30
|
+
WARN_EXTS+=("$EXT_NAME")
|
|
31
|
+
fi
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# CRITICAL: known malicious domain references
|
|
35
|
+
if [ -n "$DOMAIN_PATTERN" ]; then
|
|
36
|
+
EXT_MAL="$(grep -rlE "$DOMAIN_PATTERN" "$ext" 2>/dev/null || true)"
|
|
37
|
+
if [ -n "$EXT_MAL" ]; then
|
|
38
|
+
if [[ ! " ${FOUND_EXTS[*]} " =~ " ${EXT_NAME} " ]]; then
|
|
39
|
+
FOUND_EXTS+=("$EXT_NAME")
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
done < <(find "$EXT_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Auto-fix
|
|
48
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
49
|
+
TARGET_EXT="${SKILL_NAME}"
|
|
50
|
+
log "AUTO-FIX: Removing extension '$TARGET_EXT'..."
|
|
51
|
+
|
|
52
|
+
EXT_PATH="$EXT_DIR/$TARGET_EXT"
|
|
53
|
+
|
|
54
|
+
if rm -rf "$EXT_PATH"; then
|
|
55
|
+
log "SUCCESS: Extension '$TARGET_EXT' has been removed."
|
|
56
|
+
exit 0
|
|
57
|
+
else
|
|
58
|
+
log "ERROR: Failed to remove '$EXT_PATH'. Please remove it manually:"
|
|
59
|
+
log " rm -rf $EXT_PATH"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# 提前生成 rm 命令列表
|
|
65
|
+
RM_CMDS=""
|
|
66
|
+
for ext in "${FOUND_EXTS[@]}"; do
|
|
67
|
+
RM_CMDS="${RM_CMDS} rm -rf $EXT_DIR/$ext\n"
|
|
68
|
+
done
|
|
69
|
+
|
|
70
|
+
# Guidance
|
|
71
|
+
cat <<EOF
|
|
72
|
+
RECOMMENDED ACTIONS:
|
|
73
|
+
1. Remove unauthorized extensions immediately:
|
|
74
|
+
$(printf "%b" "$RM_CMDS")
|
|
75
|
+
2. Only install extensions from verified sources
|
|
76
|
+
|
|
77
|
+
auto-fix
|
|
78
|
+
$(for ext in "${FOUND_EXTS[@]}"; do echo "$ext"; done)
|
|
79
|
+
EOF
|
|
80
|
+
|
|
81
|
+
exit 0
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 7 (origin 30): VS Code Extension Trojan Detection
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_7.sh
|
|
11
|
+
|
|
12
|
+
# Auto-fix
|
|
13
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
14
|
+
log "AUTO-FIX: Removing suspicious VS Code extensions..."
|
|
15
|
+
|
|
16
|
+
FAILED=0
|
|
17
|
+
for pattern in "*clawdbot*" "*openclaw*" "*moltbot*"; do
|
|
18
|
+
for ext_path in "$OPENCLAW_DIR/.vscode/extensions/"$pattern; do
|
|
19
|
+
[ -e "$ext_path" ] || continue
|
|
20
|
+
if rm -rf "$ext_path"; then
|
|
21
|
+
log "SUCCESS: Removed '$ext_path'"
|
|
22
|
+
else
|
|
23
|
+
log "ERROR: Failed to remove '$ext_path'"
|
|
24
|
+
FAILED=$((FAILED + 1))
|
|
25
|
+
fi
|
|
26
|
+
done
|
|
27
|
+
done
|
|
28
|
+
|
|
29
|
+
if [ "$FAILED" -eq 0 ]; then
|
|
30
|
+
cat << EOF
|
|
31
|
+
SUCCESS: VS Code extensions have been removed.
|
|
32
|
+
EOF
|
|
33
|
+
exit 0
|
|
34
|
+
else
|
|
35
|
+
log "ERROR: Some extensions could not be removed."
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Guidance
|
|
41
|
+
cat << EOF
|
|
42
|
+
RECOMMENDED ACTIONS:
|
|
43
|
+
1. Remove the suspicious extensions immediately:
|
|
44
|
+
rm -rf ~/.vscode/extensions/*clawdbot*
|
|
45
|
+
rm -rf ~/.vscode/extensions/*openclaw*
|
|
46
|
+
rm -rf ~/.vscode/extensions/*moltbot*
|
|
47
|
+
|
|
48
|
+
auto-fix
|
|
49
|
+
VS Code extensions
|
|
50
|
+
EOF
|
|
51
|
+
|
|
52
|
+
exit 0
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 8 (origin 16): Sensitive Environment Leakage
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_8.sh
|
|
11
|
+
|
|
12
|
+
FOUND_SKILLS=()
|
|
13
|
+
if [ -d "$SKILLS_DIR" ]; then
|
|
14
|
+
while IFS= read -r file; do
|
|
15
|
+
skill_name="$(basename "$(dirname "$file")")"
|
|
16
|
+
# Deduplicate
|
|
17
|
+
if [[ ! " ${FOUND_SKILLS[*]} " =~ " ${skill_name} " ]]; then
|
|
18
|
+
FOUND_SKILLS+=("$skill_name")
|
|
19
|
+
fi
|
|
20
|
+
done < <(grep -rlinE --exclude-dir="$SELF_DIR_NAME" "sk-[a-zA-Z0-9]{20,}|OPENAI_API_KEY\s*=\s*['\"][^$]|ANTHROPIC_API_KEY\s*=\s*['\"][^$]|moltbook.*token\s*=\s*['\"]" "$SKILLS_DIR" 2>/dev/null || true)
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Auto-fix
|
|
24
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
25
|
+
TARGET_SKILL="${SKILL_NAME}"
|
|
26
|
+
log "AUTO-FIX: Removing skill '$TARGET_SKILL'..."
|
|
27
|
+
|
|
28
|
+
SKILL_PATH="$SKILLS_DIR/$TARGET_SKILL"
|
|
29
|
+
LOCK_FILE="$WORKSPACE_DIR/.clawhub/lock.json"
|
|
30
|
+
|
|
31
|
+
# 删除 skill 目录
|
|
32
|
+
if rm -rf "$SKILL_PATH"; then
|
|
33
|
+
log "SUCCESS: Skill directory '$SKILL_PATH' removed."
|
|
34
|
+
else
|
|
35
|
+
log "ERROR: Failed to remove '$SKILL_PATH'"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# 从 lock.json 移除条目
|
|
40
|
+
if [ -f "$LOCK_FILE" ] && command -v python3 >/dev/null 2>&1; then
|
|
41
|
+
python3 -c "
|
|
42
|
+
import json, sys
|
|
43
|
+
with open('$LOCK_FILE') as f:
|
|
44
|
+
data = json.load(f)
|
|
45
|
+
data['skills'] = {k: v for k, v in data['skills'].items() if k != '$TARGET_SKILL'}
|
|
46
|
+
with open('$LOCK_FILE', 'w') as f:
|
|
47
|
+
json.dump(data, f, indent=2)
|
|
48
|
+
" && log "SUCCESS: Removed '$TARGET_SKILL' from lock.json"
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
log "SUCCESS: Skill '$TARGET_SKILL' has been removed."
|
|
52
|
+
exit 0
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Guidance
|
|
56
|
+
cat << EOF
|
|
57
|
+
RECOMMENDED ACTIONS:
|
|
58
|
+
1. Review each skill listed above
|
|
59
|
+
|
|
60
|
+
2. Determine if they legitimately need access to sensitive files
|
|
61
|
+
|
|
62
|
+
3. For skills with hardcoded keys, ROTATE those credentials immediately
|
|
63
|
+
|
|
64
|
+
4. If confirmed malicious or unnecessary, remove the skill:
|
|
65
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo " rm -rf ~/.openclaw/workspace/skills/$skill"; done)
|
|
66
|
+
|
|
67
|
+
auto-fix
|
|
68
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo "$skill"; done)
|
|
69
|
+
EOF
|
|
70
|
+
|
|
71
|
+
exit 0
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CHECK 9 (origin 10): Skill Poisoning / Memory File Modification
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
source "$SCRIPT_DIR/_common.sh"
|
|
6
|
+
|
|
7
|
+
# Environment vars (set by caller / _common.sh sourced before this):
|
|
8
|
+
# SKILL_NAME — if set (auto-fix mode), the skill to remove
|
|
9
|
+
# AUTO_FIX — if "1", automatically remove the offending skill
|
|
10
|
+
# Example: AUTO_FIX=1 SKILL_NAME="your-skill-name" ./check_9.sh
|
|
11
|
+
|
|
12
|
+
FOUND_SKILLS=()
|
|
13
|
+
if [ -d "$SKILLS_DIR" ]; then
|
|
14
|
+
while IFS= read -r f; do
|
|
15
|
+
[ -z "$f" ] && continue
|
|
16
|
+
skill_name="$(basename "$(dirname "$f")")"
|
|
17
|
+
if [[ ! " ${FOUND_SKILLS[*]} " =~ " ${skill_name} " ]]; then
|
|
18
|
+
FOUND_SKILLS+=("$skill_name")
|
|
19
|
+
fi
|
|
20
|
+
done < <(
|
|
21
|
+
grep -rliE --exclude-dir="$SELF_DIR_NAME" 'SOUL\.md|MEMORY\.md|IDENTITY\.md' "$SKILLS_DIR" 2>/dev/null | while IFS= read -r f; do
|
|
22
|
+
if grep -qiE 'write.*SOUL|write.*MEMORY|write.*IDENTITY|modify.*SOUL|modify.*MEMORY|modify.*IDENTITY|echo.*>>.*SOUL|echo.*>>.*MEMORY|echo.*>>.*IDENTITY|cat.*>.*SOUL|cat.*>.*MEMORY|cat.*>.*IDENTITY|append.*SOUL|append.*MEMORY|append.*IDENTITY' "$f" 2>/dev/null; then
|
|
23
|
+
echo "$f"
|
|
24
|
+
fi
|
|
25
|
+
done
|
|
26
|
+
)
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Auto-fix
|
|
30
|
+
if [ "${AUTO_FIX:-0}" = "1" ]; then
|
|
31
|
+
TARGET_SKILL="${SKILL_NAME}"
|
|
32
|
+
log "AUTO-FIX: Removing skill '$TARGET_SKILL'..."
|
|
33
|
+
|
|
34
|
+
SKILL_PATH="$SKILLS_DIR/$TARGET_SKILL"
|
|
35
|
+
LOCK_FILE="$WORKSPACE_DIR/.clawhub/lock.json"
|
|
36
|
+
|
|
37
|
+
# 删除 skill 目录
|
|
38
|
+
if rm -rf "$SKILL_PATH"; then
|
|
39
|
+
log "SUCCESS: Skill directory '$SKILL_PATH' removed."
|
|
40
|
+
else
|
|
41
|
+
log "ERROR: Failed to remove '$SKILL_PATH'"
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# 从 lock.json 移除条目
|
|
46
|
+
if [ -f "$LOCK_FILE" ] && command -v python3 >/dev/null 2>&1; then
|
|
47
|
+
python3 -c "
|
|
48
|
+
import json, sys
|
|
49
|
+
with open('$LOCK_FILE') as f:
|
|
50
|
+
data = json.load(f)
|
|
51
|
+
data['skills'] = {k: v for k, v in data['skills'].items() if k != '$TARGET_SKILL'}
|
|
52
|
+
with open('$LOCK_FILE', 'w') as f:
|
|
53
|
+
json.dump(data, f, indent=2)
|
|
54
|
+
" && log "SUCCESS: Removed '$TARGET_SKILL' from lock.json"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
log "SUCCESS: Skill '$TARGET_SKILL' has been removed."
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Guidance
|
|
62
|
+
cat << EOF
|
|
63
|
+
RECOMMENDED ACTIONS:
|
|
64
|
+
1. Remove any skills that attempt to modify these files
|
|
65
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo " rm -rf ~/.openclaw/workspace/skills/$skill"; done)
|
|
66
|
+
|
|
67
|
+
2. Review the files and edit the affected files to remove poisoned content:
|
|
68
|
+
cat ~/.openclaw/workspace/SOUL.md
|
|
69
|
+
cat ~/.openclaw/workspace/MEMORY.md
|
|
70
|
+
cat ~/.openclaw/workspace/IDENTITY.md
|
|
71
|
+
|
|
72
|
+
3. If you have backups, consider restoring from a clean state
|
|
73
|
+
|
|
74
|
+
auto-fix
|
|
75
|
+
$(for skill in "${FOUND_SKILLS[@]}"; do echo "$skill"; done)
|
|
76
|
+
EOF
|
|
77
|
+
|
|
78
|
+
exit 0
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
2
|
+
error: unknown command 'skill'
|
|
3
|
+
(Did you mean skills?)
|
|
4
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
5
|
+
openclaw skill rm github-test
|
|
6
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
7
|
+
error: unknown command 'skill'
|
|
8
|
+
(Did you mean skills?)
|
|
9
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
10
|
+
openclaw skill rm github-test
|
|
11
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
12
|
+
error: unknown command 'skill'
|
|
13
|
+
(Did you mean skills?)
|
|
14
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
15
|
+
openclaw skill remove github-test
|
|
16
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
17
|
+
error: unknown command 'skill'
|
|
18
|
+
(Did you mean skills?)
|
|
19
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
20
|
+
openclaw skill remove github-test
|
|
21
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
22
|
+
Error: Not installed: github-test
|
|
23
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
24
|
+
openclaw skill remove github-test
|
|
25
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
26
|
+
Error: Pass --yes (no input)
|
|
27
|
+
ERROR: Failed to remove skill 'github-test'. Please remove it manually:
|
|
28
|
+
openclaw skill remove github-test
|
|
29
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
30
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/github-test' removed.
|
|
31
|
+
SUCCESS: Removed 'github-test' from lock.json
|
|
32
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
33
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/github-test' removed.
|
|
34
|
+
SUCCESS: Removed 'github-test' from lock.json
|
|
35
|
+
AUTO-FIX: Removing skill 'github-test'...
|
|
36
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/github-test' removed.
|
|
37
|
+
SUCCESS: Removed 'github-test' from lock.json
|
|
38
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
39
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
40
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
41
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
42
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
43
|
+
malicious-hashes.txt not found under /home/janx/seclaw/openclaw-security-monitor/scripts/repair/ioc
|
|
44
|
+
AUTO-FIX: Removing skill 'notion-test'...
|
|
45
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion-test' removed.
|
|
46
|
+
SUCCESS: Removed 'notion-test' from lock.json
|
|
47
|
+
SUCCESS: Skill 'notion-test' has been removed.
|
|
48
|
+
AUTO-FIX: Removing skill 'notion copy'...
|
|
49
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion copy' removed.
|
|
50
|
+
SUCCESS: Removed 'notion copy' from lock.json
|
|
51
|
+
SUCCESS: Skill 'notion copy' has been removed.
|
|
52
|
+
AUTO-FIX: Removing skill 'notion copy 2'...
|
|
53
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion copy 2' removed.
|
|
54
|
+
SUCCESS: Removed 'notion copy 2' from lock.json
|
|
55
|
+
SUCCESS: Skill 'notion copy 2' has been removed.
|
|
56
|
+
AUTO-FIX: Removing skill 'notion copy 3'...
|
|
57
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion copy 3' removed.
|
|
58
|
+
SUCCESS: Removed 'notion copy 3' from lock.json
|
|
59
|
+
SUCCESS: Skill 'notion copy 3' has been removed.
|
|
60
|
+
Installed extensions: 3
|
|
61
|
+
AUTO-FIX: Removing extension 'qqbot copy'...
|
|
62
|
+
SUCCESS: Extension 'qqbot copy' has been removed.
|
|
63
|
+
AUTO-FIX: Removing suspicious VS Code extensions...
|
|
64
|
+
AUTO-FIX: Removing suspicious VS Code extensions...
|
|
65
|
+
AUTO-FIX: Removing suspicious VS Code extensions...
|
|
66
|
+
SUCCESS: Removed '/home/janx/test/openclaw-djy/.vscode/extensions/openclaw'
|
|
67
|
+
AUTO-FIX: Removing suspicious VS Code extensions...
|
|
68
|
+
SUCCESS: Removed '/home/janx/test/openclaw-djy/.vscode/extensions/clawdbot'
|
|
69
|
+
SUCCESS: Removed '/home/janx/test/openclaw-djy/.vscode/extensions/openclaw'
|
|
70
|
+
AUTO-FIX: Removing skill 'notion copy 4'...
|
|
71
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion copy 4' removed.
|
|
72
|
+
SUCCESS: Removed 'notion copy 4' from lock.json
|
|
73
|
+
SUCCESS: Skill 'notion copy 4' has been removed.
|
|
74
|
+
AUTO-FIX: Removing skill 'notion copy 5'...
|
|
75
|
+
SUCCESS: Skill directory '/home/janx/test/openclaw-djy/workspace/skills/notion copy 5' removed.
|
|
76
|
+
SUCCESS: Removed 'notion copy 5' from lock.json
|
|
77
|
+
SUCCESS: Skill 'notion copy 5' has been removed.
|