Skip to content

meltedinhex/analyst-ai-pack / skills/analyzing-webshells

analyzing-webshells

Verified

Analyzes suspected webshells (PHP, ASPX/ASP, JSP) by detecting dynamic-execution sinks, input-to-sink data flow, and common encoder/obfuscation chains, then decoding obvious layers to reveal the command interface. Activates for requests to analyze a webshell, identify a PHP/ASPX/JSP backdoor, or deobfuscate server-side malicious scripts.

FileKindSize
LICENSEother340 B
SKILL.mdskill md2.8 KB
references/api-reference.mdmarkdown1.4 KB
scripts/analyst.pyscript3.4 KB

references/api-reference.md

View on GitHub
# API Reference: Analyzing Webshells

## Overview

`scripts/analyst.py` scans a server-side script (PHP/ASPX/JSP) for dynamic-execution sinks,
request-input-to-sink data flow, and encoder chains, and best-effort decodes base64/raw-deflate
layers that wrap webshell logic. It reads the file statically, executes nothing, and defangs URLs.

## Dependencies

| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | base64, zlib, regex, JSON, file IO |

## Core functions

### `scan(path)`
Returns language, execution sinks, input sources, an input-to-sink flow flag, encoder chains,
decoded layers, defanged URLs, and a webshell likelihood flag.

### `_decode_layers(text)`
Decodes base64 (and raw-deflate) blobs and keeps those whose plaintext contains execution sinks.

## Detection logic

- **Sinks**: PHP `eval`/`system`/`passthru`/`preg_replace /e`; ASPX `eval`/`Process.Start`;
  JSP `Runtime.exec`/`ProcessBuilder`.
- **Input flow**: a sink plus `$_GET`/`$_POST`/`Request`/`getParameter` raises confidence.
- **Encoders**: `base64_decode`, `gzinflate`, `str_rot13`, `FromBase64String`, `\x` hex.

## Usage

```bash
python scripts/analyst.py scan shell.php
```

## Sources

- MITRE ATT&CK T1505.003 Web Shell — https://attack.mitre.org/techniques/T1505/003/
- Server-side execution sink and encoder-chain patterns from public webshell research
- PHP/ASP/JSP language execution APIs from their official documentation
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall