Skip to content

SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/detecting-fileless-malware-techniques

detecting-fileless-malware-techniques

Unverified

Detects and analyzes fileless malware that operates entirely in memory using PowerShell, WMI, .NET reflection, registry-resident payloads, and living-off-the-land binaries (LOLBins) without writing traditional executable files to disk. Use for requests involving fileless threat detection, in-memory malware investigation, LOLBin abuse analysis, or WMI persistence examination.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md16.4 KB
references/api-reference.mdmarkdown2.5 KB
references/yara-fileless-powershell.yarother478 B
scripts/agent.pyscript8.5 KB

references/api-reference.md

View on GitHub
# Fileless Malware Detection API Reference

## Windows Event IDs for Fileless Detection

| Event ID | Log | Description |
|----------|-----|-------------|
| 4104 | PowerShell Operational | Script Block Logging (full script content) |
| 4103 | PowerShell Operational | Module Logging |
| 1 | Sysmon | Process Creation with command line |
| 8 | Sysmon | CreateRemoteThread (injection) |
| 10 | Sysmon | ProcessAccess (injection prep) |
| 19/20/21 | Sysmon | WMI Event Filter/Consumer/Binding |
| 7045 | System | New service installed |

## python-evtx - Parse Windows Event Logs

```python
import Evtx.Evtx as evtx

with evtx.Evtx("Security.evtx") as log:
    for record in log.records():
        xml = record.xml()
        if "<EventID>4104</EventID>" in xml:
            print(record.timestamp(), xml[:500])
```

## Volatility 3 Commands

```bash
# Detect injected code (RWX memory, PE headers in non-image VADs)
vol3 -f memory.dmp windows.malfind

# List processes
vol3 -f memory.dmp windows.pslist

# Scan for hidden processes
vol3 -f memory.dmp windows.psscan

# List loaded DLLs
vol3 -f memory.dmp windows.dlllist --pid 1234

# Extract injected code
vol3 -f memory.dmp windows.malfind --dump --pid 1234
```

## LOLBins Detection Patterns (Sysmon)

```xml
<!-- Sysmon config for LOLBin monitoring -->
<RuleGroup groupRelation="or">
  <ProcessCreate onmatch="include">
    <Image condition="end with">mshta.exe</Image>
    <Image condition="end with">regsvr32.exe</Image>
    <Image condition="end with">certutil.exe</Image>
    <Image condition="end with">wmic.exe</Image>
    <Image condition="end with">cmstp.exe</Image>
    <Image condition="end with">msbuild.exe</Image>
  </ProcessCreate>
</RuleGroup>
```

## Suspicious PowerShell Indicators

Detection patterns to search for in Script Block Logging (Event ID 4104) and memory strings. See `yara-fileless-powershell.yar` in this directory for a Volatility YARA rule covering the same indicators.

```
-enc / -EncodedCommand    → Base64-encoded command
IEX / Invoke-Expression   → Dynamic code execution
Net.WebClient             → Download cradle
DownloadString()          → Remote script fetch
Reflection.Assembly       → Reflective .NET loading
VirtualAlloc              → Shellcode allocation
FromBase64String          → Payload decoding
```

## WMI Persistence Check

```powershell
# List WMI event subscriptions
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
Get-WMIObject -Namespace root\Subscription -Class __EventConsumer
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding
```
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 193kUpdated Claude CodeCodexVerifiedInstall