xtofuub/openrecon-ios / skills/_upstream/anthropic-cybersecurity-skills/skills/deobfuscating-javascript-malware
deobfuscating-javascript-malware
UnverifiedDeobfuscates malicious JavaScript code used in web-based attacks, phishing pages, and dropper scripts by reversing encoding layers, eval chains, string manipulation, and control flow obfuscation to reveal the original malicious logic. Activates for requests involving JavaScript malware analysis, script deobfuscation, web skimmer analysis, or obfuscated dropper investigation.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 11.0 KB |
| SKILL.md | skill md | 12.7 KB |
| references/api-reference.md | markdown | 2.0 KB |
| scripts/agent.py | script | 7.1 KB |
references/api-reference.md
View on GitHub# JavaScript Malware Deobfuscation API Reference
## jsbeautifier (Python)
```python
import jsbeautifier
opts = jsbeautifier.default_options()
opts.indent_size = 2
opts.wrap_line_length = 120
result = jsbeautifier.beautify(obfuscated_code, opts)
```
## jsbeautifier CLI
```bash
# Beautify a file
js-beautify malicious.js -o output.js
# npx alternative
npx js-beautify script.js -o script_pretty.js
```
## Common Decoding Patterns (Python)
```python
import re, base64, urllib.parse
# Hex strings: \x68\x65\x6c\x6c\x6f -> hello
decoded = bytes.fromhex("68656c6c6f").decode("ascii")
# Unicode escapes: \u0068\u0065 -> he
decoded = chr(0x0068) + chr(0x0065)
# Base64 (atob equivalent)
decoded = base64.b64decode("aGVsbG8=").decode("utf-8")
# URL encoding (unescape equivalent)
decoded = urllib.parse.unquote("%68%65%6c%6c%6f")
# String.fromCharCode
decoded = "".join(chr(c) for c in [104, 101, 108, 108, 111])
```
## Node.js VM Sandbox
```javascript
const vm = require('vm');
const sandbox = {
eval: function(code) {
console.log("EVAL INTERCEPTED:", code.substring(0, 500));
return code;
},
document: { write: function(h) { console.log("DOC.WRITE:", h); } },
atob: function(s) { return Buffer.from(s, 'base64').toString(); },
window: { location: { href: "" } },
};
const context = vm.createContext(sandbox);
vm.runInContext(code, context, { timeout: 5000 });
```
## CyberChef Operations
| Operation | Use Case |
|-----------|----------|
| From Hex | Decode `\xNN` sequences |
| From Base64 | Decode `atob()` payloads |
| URL Decode | Decode `unescape()` strings |
| JavaScript Beautify | Format minified code |
| From CharCode | Decode `fromCharCode` arrays |
| XOR | Decode XOR-encrypted strings |
| Generic Code Beautify | Format mixed content |
## IOC Extraction Regex
```python
# URLs
re.findall(r'https?://[^\s"\'<>)]+', code)
# IP addresses
re.findall(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', code)
# Domains
re.findall(r'(?:[a-zA-Z0-9-]+\.)+(?:com|net|org|io|xyz)\b', code)
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |