Skip to content

meltedinhex/analyst-ai-pack / skills/defeating-string-and-api-obfuscation

defeating-string-and-api-obfuscation

Verified

Recovers obfuscated strings and resolves dynamically loaded APIs in malware: reversing XOR/stack-string/encoding schemes and mapping API-hash lookups back to function names. Activates for requests to deobfuscate strings, decode stack strings, or resolve API hashing in a binary.

FileKindSize
LICENSEother340 B
SKILL.mdskill md3.2 KB
references/api-reference.mdmarkdown1.4 KB
scripts/analyst.pyscript3.6 KB

references/api-reference.md

View on GitHub
# API Reference: Defeating String and API Obfuscation

## Overview

`scripts/analyst.py` provides two deobfuscation utilities: brute-forcing single-byte XOR to
surface readable strings, and resolving API-name hashes (ROR13/ROR7/djb2) back to function
names. Both read input only and never execute the sample.

## Dependencies

| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | regex, hashing arithmetic |

## External tools

| Tool | Purpose |
|------|---------|
| FLOSS | Automated stack-string and decoded-string recovery via emulation |
| Ghidra / IDA | Read the decode routine and reapply recovered names |

## Core functions

### `xor_strings(data, min_hits)`
Brute-forces single-byte XOR keys and returns keys that yield several interesting readable
strings (URLs, DLL/API names, paths).

### `resolve_hash(algo, target, names)`
Returns candidate API names whose hash (ROR13/ROR7/djb2) equals the target constant.

### `hash_ror13` / `hash_ror7` / `hash_djb2`
Implementations of the common API-hashing algorithms.

## Usage

```bash
python scripts/analyst.py xor-strings sample.bin
python scripts/analyst.py api-hash --algo ror13 --hash 0x726774C
```

## Sources

- FLOSS (FLARE Obfuscated String Solver) — https://github.com/mandiant/flare-floss
- ROR13 API-hashing technique (widely used in shellcode/loaders)
- djb2 string hash (Daniel J. Bernstein)
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 implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall