T04 · Embedded Malicious Code
- Location
tests/fake-weather/scripts/weather.py:7- Finding
SSH Private-Key Theft Disguised as Weather Lookup
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real security scanner, but it ships dangerous runnable test samples and has a scan-boundary weakness that need review before installation.
Review this package before installing in a normal user environment. The main scanner is local and purpose-aligned, but the test fixtures should be converted to inert text fixtures or kept out of agent-loadable/importable paths. If used as-is, run it in a sandboxed low-privilege account, do not import or execute files under tests/, do not render the test SVG in a credentialed browser context, and avoid scanning untrusted directories until symlink handling is fixed.
tests/fake-weather/scripts/weather.py:7SSH Private-Key Theft Disguised as Weather Lookup
tests/fake-crypto/scripts/crypto.py:7Cryptocurrency Wallet and Keystore Exfiltration
tests/fake-formatter/scripts/formatter.py:9Import-Time Obfuscated Reverse Shell Execution
tests/fake-timebomb/scripts/reminder.py:7Date-Activated SSH-Key Exfiltration with Shell Injection
tests/fake-helper/SKILL.md:11Hidden Agent Instruction Hijacking and Secret-Exfiltration Directive
tests/fake-svgmalware/icons/logo.svg:4Active JavaScript Credential Exfiltration in SVG
tests/fake-typosquat/requirements.txt:1Typosquatted Python Dependencies Enable Supply-Chain Compromise
scripts/skillguard.py:318Scanner Follows Symlinks and Can Read Files Outside the Audited Skill
The code reads local Solana wallet data and Ethereum keystore information, packages it into a payload, and sends it to an external server. This behavior is consistent with credential and asset theft, not portfolio tracking or skill security scanning, and the misleading description increases confidence that this is intentional malware behavior.
The code transmits collected wallet-related data to a hard-coded external endpoint that resembles a command-and-control collector. Sending sensitive local data off-host without disclosure or necessity is a direct exfiltration pathway that could enable theft, tracking, and further compromise.
The file claims to be a daily reminder but contains hidden logic that activates after a date threshold and steals SSH private keys. This directly contradicts the stated purpose of the skill and is strong evidence of intentionally malicious behavior.
The code collects a highly sensitive credential and exfiltrates it to an external server without any legitimate need tied to a security-auditing skill. Secret harvesting and outbound transmission are unjustified here and represent overt malicious capability.
Reading a user's SSH private key and sending it over the network without disclosure is a severe secret-handling violation. Compromise of an SSH private key can enable unauthorized access to infrastructure, source code, and downstream systems.
The function reads the user's SSH private key from ~/.ssh/id_rsa and includes it in a POST request to an external domain, which is direct credential exfiltration. This behavior is unrelated to a weather lookup or the stated security-scanner purpose, and compromise of a private SSH key can enable unauthorized access to systems and long-term credential theft.
The declared purpose is a defensive security auditing tool, but the code performs offensive data collection and exfiltration. It accesses sensitive wallet-related files in the user's home directory, gathers cryptocurrency key information, and transmits that data to a remote command-and-control style endpoint. These behaviors are not necessary to implement a scanner for malicious code and are materially inconsistent with the declared purpose and permissions.
This is a clear mismatch. The declared purpose is a benign security scanner for auditing skills, but the supplied code does not perform any scanning or analysis. Instead, it defines a trivial formatter and, more importantly, decodes and executes a hidden shell command. The Base64 payload resolves to a bash reverse shell command connecting to 10.0.0.1 on port 4444, which is a severe undeclared capability and indicative of malicious behavior. These actions are materially different from and incompatible with the stated description.
The declared description says this skill is a security scanner for auditing OpenClaw skills, but the supplied code chunk is only a minimal helper utility returning a static string. It does not implement the declared primary purpose or any of the described security-analysis capabilities. This is a material description-behavior mismatch, not merely a supporting implementation detail.
The declared description says this skill is a security scanner that audits other skills for malicious behavior. The supplied code does not perform scanning or auditing. Instead, it implements a reminder function with a covert, time-triggered payload that accesses a highly sensitive file (the SSH private key) and sends its contents to an external server. This is a materially different primary purpose and includes dangerous undeclared capabilities, especially credential access, exfiltration, and delayed malicious execution. Therefore the description does not accurately represent the code's behavior.
The declared purpose describes a security auditing/scanning skill, but the supplied code chunk does not scan or audit anything. Its actual behavior is to import a misspelled external package and issue HTTP GET requests. That is materially different from the declared primary purpose. While the typosquatted import may relate to testing a supply-chain attack scenario, this code itself is just a client demonstrating or exercising such a dependency, not a scanner that detects malicious code or prompt injection.
The declared description says this skill is a security scanner for auditing code, but the supplied code does not analyze skills or perform any scanning. Instead, it accesses a highly sensitive local file (~/.ssh/id_rsa), packages its contents as 'auth' data, and transmits it to https://evil.com/api/weather. This is a clear undeclared capability and a materially different primary purpose. The behavior is consistent with credential theft/data exfiltration, not security auditing, so the description does not accurately represent the code.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- SSH keys, AWS credentials, GPG keyrings
- Browser credential stores (Chrome, Firefox, Safari)
- Crypto wallets (MetaMask, Phantom, Solana, Ethereum)
- Keychain/keyring access
- Environment variable harvesting
### Prompt Injection
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- SSH keys, AWS credentials, GPG keyrings
- Browser credential stores (Chrome, Firefox, Safari)
- Crypto wallets (MetaMask, Phantom, Solana, Ethereum)
- Keychain/keyring access
- Environment variable harvesting
### Prompt Injection
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- SSH keys, AWS credentials, GPG keyrings
- Browser credential stores (Chrome, Firefox, Safari)
- Crypto wallets (MetaMask, Phantom, Solana, Ethereum)
- Keychain/keyring access
- Environment variable harvesting
### Prompt Injection
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
-skill**: detects code writing to paths outside the skill directory
- **Unicode homoglyphs**: catches lookalike characters in filenames (Cyrillic а vs Latin a)
- **Excessive file count**: flags skills with 50+ files
- **Large files**: flags files over 500KB
### Network Threats
- Hardcoded IP addresses, reverse shells, DNS exfiltration
- WebSocket connections to external hosts
### Persistence
- Crontab modifications, launchd/systemd service creation
- Shell RC file modifications (.bashrc, .zshrc)
### Tamper Detection (v2)
- Computes SHA-256 hash of every file on first scan
- Stores baselines in baselines.json
- On re-scan, flags changed, added, or removed files
- Checks ClawHub origin version from .clawhub/origin.json
## Scoring (v2)
| Pattern | Points |
|---------|--------|
| HTTP to known API | 0 |
| HTTP to unknown domain | 10 |
| curl in documentation | 0 |
| subprocess call | 2 |
| subprocess + shell=True | 25 |
| Sensitive file access | 10-25 |
| Prompt injection phrase | 25
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
────────────────────────
KNOWN_DOMAINS = {
"api.coingecko.com", "feeds.bbci.co.uk", "api.github.com",
"query1.finance.yahoo.com", "query2.finance.yahoo.com",
"api.openai.com", "discord.com", "api.telegram.org",
"api.x.ai", "api.anthropic.com", "feeds.npr.org",
"www.aljazeera.com", "www.reutersagency.com", "img402.dev",
"snap.llm.kaveenk.com", "astral.sh", "pypi.org",
"raw.githubusercontent.com", "github.com", "api.weatherapi.com",
"api.openweathermap.org", "newsapi.org", "api.newsapi.org",
"rss.nytimes.com", "www.reddit.com", "oauth.reddit.com",
"api.spotify.com", "api.twitch.tv", "api.twitter.com",
"graph.facebook.com", "www.googleapis.com", "maps.googleapis.com",
"api.stripe.com", "api.slack.com", "hooks.slack.com",
"api.notion.com", "api.pushover.net", "ntfy.sh",
"api.elevenlabs.io", "api.deepl.com", "translate.googleapis.com",
"api.wolframalpha.com", "en.wikipedia.org", "www
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Hardcoded secrets patterns
SECRET_PATTERNS = [
(r'AKIA[0-9A-Z]{16}', "AWS Access Key"),
(r'ghp_[A-Za-z0-9]{36}', "GitHub Personal Access Token"),
(r'gho_[A-Za-z0-9]{36}', "GitHub OAuth Token"),
(r'github_pat_[A-Za-z0-9_]{82}', "GitHub Fine-grained PAT"),
(r'sk-[A-Za-z0-9]{20,}T3BlbkFJ[A-Za-z0-9]{20,}', "OpenAI API Key"),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
r'~/\.ssh|\.ssh/|ssh.*id_rsa|id_ed25519': (WARNING, "SSH directory/key access"),
r'~/\.aws|\.aws/|AWS_SECRET': (CRITICAL, "AWS credentials access"),
r'~/\.gnupg|\.gnupg/': (WARNING, "GPG keyring access"),
r'find-generic-password|keytar|keyring\.get': (CRITICAL, "Keychain/keyring access"),
r'Chrome.*Login Data|Firefox.*cookies|Safari.*Cookies|Chrome.*Local State': (CRITICAL, "Browser credential access"),
r'MetaMask|Phantom|Rabby|Coinbase.*Wallet|\.config/solana|\.ethereum': (CRITICAL, "Crypto wallet access"),
r'~/\.openclaw|\.openclaw/': (WARNING, "OpenClaw config access"),
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
sensitive_paths = {
r'~/\.ssh|\.ssh/|ssh.*id_rsa|id_ed25519': (WARNING, "SSH directory/key access"),
r'~/\.aws|\.aws/|AWS_SECRET': (CRITICAL, "AWS credentials access"),
r'~/\.gnupg|\.gnupg/': (WARNING, "GPG keyring access"),
r'find-generic-password|keytar|keyring\.get': (CRITICAL, "Keychain/keyring access"),
r'Chrome.*Login Data|Firefox.*cookies|Safari.*Cookies|Chrome.*Local State': (CRITICAL, "Browser credential access"),
r'MetaMask|Phantom|Rabby|Coinbase.*Wallet|\.config/solana|\.ethereum': (CRITICAL, "Crypto wallet access"),
r'~/\.openclaw|\.openclaw/': (WARNING, "OpenClaw config access"),
r'/etc/passwd|/etc/shadow': (WARNING, "/etc/passwd or /etc/shadow access"),
}
for pattern, (level, desc) in sensitive_paths.items():
if re.search(pattern, ln, re.I):
self._has_sensitive_access = True
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
r'Chrome.*Login Data|Firefox.*cookies|Safari.*Cookies|Chrome.*Local State': (CRITICAL, "Browser credential access"),
r'MetaMask|Phantom|Rabby|Coinbase.*Wallet|\.config/solana|\.ethereum': (CRITICAL, "Crypto wallet access"),
r'~/\.openclaw|\.openclaw/': (WARNING, "OpenClaw config access"),
r'/etc/passwd|/etc/shadow': (WARNING, "/etc/passwd or /etc/shadow access"),
}
for pattern, (level, desc) in sensitive_paths.items():
if re.search(pattern, ln, re.I):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
r'Chrome.*Login Data|Firefox.*cookies|Safari.*Cookies|Chrome.*Local State': (CRITICAL, "Browser credential access"),
r'MetaMask|Phantom|Rabby|Coinbase.*Wallet|\.config/solana|\.ethereum': (CRITICAL, "Crypto wallet access"),
r'~/\.openclaw|\.openclaw/': (WARNING, "OpenClaw config access"),
r'/etc/passwd|/etc/shadow': (WARNING, "/etc/passwd or /etc/shadow access"),
}
for pattern, (level, desc) in sensitive_paths.items():
if re.search(pattern, ln, re.I):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
self.add(level, desc, f, i,
recommendation=f"{desc} — verify this access is necessary and justified")
# .env and env var harvesting
if re.search(r'\.env\b', ln) and re.search(r'(read|open|load|source|dotenv)', ln, re.I):
self.add(WARNING, "Loading .env file", f, i)
if re.search(r'os\.environ\.get\(["\'](\w*(?:TOKEN|KEY|SECRET|PASSWORD)\w*)', ln, re.I):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
self.add(level, desc, f, i,
recommendation=f"{desc} — verify this access is necessary and justified")
# .env and env var harvesting
if re.search(r'\.env\b', ln) and re.search(r'(read|open|load|source|dotenv)', ln, re.I):
self.add(WARNING, "Loading .env file", f, i)
if re.search(r'os\.environ\.get\(["\'](\w*(?:TOKEN|KEY|SECRET|PASSWORD)\w*)', ln, re.I):
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
lls
if re.search(r'nc\s+.*-e\s|bash\s+-i\s|/dev/tcp/|mkfifo|ncat.*-e', ln, re.I):
self.add(CRITICAL, f"Reverse shell pattern detected", f, i,
recommendation="Reverse shell detected — this is almost certainly malicious",
score_override=100)
# DNS exfil
if re.search(r'dig\s+.*@|nslookup\s+.*\$|\.burpcollaborator\.|\.oastify\.|\.interact\.sh', ln, re.I):
self.add(CRITICAL, f"DNS exfiltration pattern", f, i)
# Persistence
if re.search(r'crontab|cron\.d/', ln, re.I):
self.add(CRITICAL, f"Crontab modification", f, i)
if re.search(r'launchd|LaunchAgents|LaunchDaemons|systemctl\s+enable|\.service', ln, re.I):
if ext in ('.py', '.sh', '.js', '.ts'):
self.add(CRITICAL, f"System service creation", f, i)
if re.search(r'~/?\.(bashrc|zshrc|profile|bash_profile)\b', ln):