analyzing-packed-malware-with-upx-unpacker

analyzing-packed-malware-with-upx-unpacker is a skill for Claude Code from killvxk/cybersecurity-skills-zh. It costs 104 tokens per session (3,665 once invoked), scanned A, original, Apache-2.0.

A guide for unpacking Windows executable files protected by UPX or a similar packing tool. Packing compresses or hides the original program code, making ordinary inspection harder.

In plain words
What is it for?
Use it to identify UPX packing, unpack standard or modified UPX samples, repair damaged headers, and prepare binaries for analysis in tools such as Ghidra or IDA.
Why use it?
It exposes the original executable code when high file entropy or unusual imports suggest that a sample is packed, while noting cases this process does not cover.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cybersecurity-skills-zh plugin — 58 skills shipped together

Good fit Use it to identify UPX packing, unpack standard or modified UPX samples, repair damaged headers, and prepare binaries for analysis in tools such as Ghidra or IDA.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add killvxk/cybersecurity-skills-zh --skill analyzing-packed-malware-with-upx-unpacker
Clone the repo
git clone --depth 1 https://github.com/killvxk/cybersecurity-skills-zh

Made for: Claude Code.

Or install cybersecurity-skills-zh, the plugin that ships this one along with the rest of its 58 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyzing-packed-malware-with-upx-unpacker

README.md
[![agentmods](https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker/github.svg)](https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker)
Your own site
<a href="https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker"><img src="https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyzing-packed-malware-with-upx-unpacker

Your own site · 80×15
<a href="https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker"><img src="https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-packed-malware-with-upx-unpacker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 104 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,665 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00104 $0.03665
Opus 5 $0.00052 $0.01833
Sonnet 5 $0.00021 $0.00733
Haiku 4.5 $0.00010 $0.00366

Measured 12d ago against content hash 4f5772c9f346, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

analyzing-packed-malware-with-upx-unpacker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/agent.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/analyzing-packed-malware-with-upx-unpacker/SKILL.md · 299 lines

How it starts

The opening of the file, as written. The whole thing — 299 lines — stays where its author put it; the contents beside it link to each section on GitHub.

使用 UPX Unpacker 分析加壳恶意软件

适用场景

  • 静态分析显示高熵节和极少的导入函数,表明二进制文件已加壳
  • PEiD、Detect It Easy 或 PEStudio 识别出 UPX 或其他已知加壳工具
  • 导入表仅包含 LoadLibrary 和 GetProcAddress(加壳二进制文件典型的运行时导入解析方式)
  • 需要恢复原始二进制文件以在 Ghidra 或 IDA 中进行正常反汇编和反编译
  • 因恶意软件作者修改了 UPX 魔数或头部导致自动 UPX 解压缩失败

不适用于处理自定义加壳、基于 VM 的保护器(Themida、VMProtect),或通过调试进行动态解包更合适的样本。

前置条件

  • 已安装 UPX(Ultimate Packer for eXecutables)(apt install upx-ucl 或从 https://upx.github.io/ 下载)
  • Detect It Easy (DIE),用于加壳识别
  • Python 3.8+,安装 pefile 库用于手动修复头部
  • x64dbg 或 x32dbg,用于自动化工具失败时的手动解包
  • PE-bear 或 CFF Explorer,用于 PE 头部检查和修复
  • 隔离的分析虚拟机(无网络连接)

工作流程

步骤 1:识别加壳工具

确认样本是否加壳并识别加壳工具:

# 使用 Detect It Easy 检查
diec suspect.exe

# 使用 UPX 检查(仅测试,不解包)
upx -t suspect.exe

# 基于 Python 的熵值和加壳检测
python3 << 'PYEOF'
import pefile
import math

pe = pefile.PE("suspect.exe")

print("节分析:")
for section in pe.sections:
    name = section.Name.decode().rstrip('\x00')
    entropy = section.get_entropy()
    raw = section.SizeOfRawData
    virtual = section.Misc_VirtualSize
    print(f"  {name:8s} 熵值:{entropy:.2f}  原始大小:{raw:>8}  虚拟大小:{virtual:>8}")

# 检查 UPX 节名称
section_names = [s.Name.decode().rstrip('\x00') for s in pe.sections]
if 'UPX0' in section_names or 'UPX1' in section_names:
    print("\n[!] 检测到 UPX 节名称")
elif '.upx' in [s.lower() for s in section_names]:
    print("\n[!] 检测到 UPX 变体节名称")

# 检查导入数量(加壳二进制文件导入极少)
if hasattr(pe, 'DIRECTORY_ENTRY_IMPORT'):
    total_imports = sum(len(e.imports) for e in pe.DIRECTORY_ENTRY_IMPORT)
    print(f"\n总导入数:{total_imports}")
    if total_imports < 10:
        print("[!] 导入函数极少——可能已加壳")
else:
    print("\n[!] 无导入目录——高度加壳")
PYEOF

步骤 2:尝试标准 UPX 解压缩

尝试使用内置 UPX 解压功能:

# 标准 UPX 解压缩
upx -d suspect.exe -o unpacked.exe

# 如果 UPX 报 "not packed by UPX" 错误,说明头部可能已被修改
# 用详细输出进行调试
upx -d suspect.exe -o unpacked.exe -v 2>&1

# 验证解包后的文件
file unpacked.exe
diec unpacked.exe

步骤 3:修复被篡改的 UPX 头部

如果标准解压缩失败,修复被篡改的魔数:

# 修复被篡改的 UPX 头部
import struct

with open("suspect.exe", "rb") as f:
    data = bytearray(f.read())

# UPX 魔数:"UPX!"(0x55505821)
# 恶意软件作者通常会修改这些字节以阻止自动解包

# 搜索被修改的 UPX 签名
upx_magic = b"UPX!"
modified_patterns = [b"UPX0", b"UPX\x00", b"\x00PX!", b"UPx!"]

# 查找并还原节名称
pe_offset = struct.unpack_from("<I", data, 0x3C)[0]
num_sections = struct.unpack_from("<H", data, pe_offset + 6)[0]
section_table_offset = pe_offset + 0x18 + struct.unpack_from("<H", data, pe_offset + 0x14)[0]

print(f"PE 偏移:0x{pe_offset:X}")
print(f"节数量:{num_sections}")
print(f"节表偏移:0x{section_table_offset:X}")

for i in range(num_sections):
    offset = section_table_offset + (i * 40)
    name = data[offset:offset+8]
    print(f"节 {i}:{name}")

# 还原二进制文件中的 UPX 魔数
# 搜索 UPX 头部签名位置(通常在加壳数据末尾附近)
for i in range(len(data) - 4):
    if data[i:i+3] == b"UPX" and data[i+3] != ord("!"):
        print(f"在偏移 0x{i:X} 处发现被修改的 UPX 魔数:{data[i:i+4]}")
        data[i:i+4] = b"UPX!"
        print(f"已还原为:UPX!")

# 如果节名称被修改也一并还原
for i in range(num_sections):
    offset = section_table_offset + (i * 40)
    name = data[offset:offset+8].rstrip(b'\x00')
    if name in [b"UPX0", b"UPX1", b"UPX2"]:
        continue  # 已正确
    # 检查常见的修改方式
    if name.startswith(b"UP") or name.startswith(b"ux"):
        original = f"UPX{i}".encode().ljust(8, b'\x00')
        data[offset:offset+8] = original
        print(f"在 0x{offset:X} 处还原节名称为 {original}")

with open("suspect_fixed.exe", "wb") as f:
    f.write(data)

print("\n已写入修复文件。重试:upx -d suspect_fixed.exe -o unpacked.exe")

Read the full file on GitHub · 299 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 299 lines · 104 tokens per session scan A 4f5772c9f346

Subscribe to this mod's changes

analyzing-packed-malware-with-upx-unpacker is a skill published in the GitHub repository killvxk/cybersecurity-skills-zh (45 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 104 tokens to every session and 3,665 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed malware samples, including binaries with modified UPX magic bytes or headers that block automated decompression, to recover the original executable for static analysis. Use when a sample shows high entropy, minimal imports, or only LoadLibrary/GetProcAddress in its import table, or…

mukul975/Anthropic-Cybersecurity-Skills · 88 tokens

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed and other packed malware samples to expose the original executable code for static analysis. Covers both standard UPX unpacking and handling modified UPX headers that prevent automated decompression. Activates for requests involving malware unpacking, UPX decompression, packer…

26zl/cybersec-toolkit · 79 tokens

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed and other packed malware samples to expose the original executable code for static analysis. Covers both standard UPX unpacking and handling modified UPX headers that prevent automated decompression. Activates for requests involving malware unpacking, UPX decompression, packer…

pinkpixel-dev/skills-collection-1 · 79 tokens

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed and other packed malware samples to expose the original executable code for static analysis. Covers both standard UPX unpacking and handling modified UPX headers that prevent automated decompression. Activates for requests involving malware unpacking, UPX decompression, packer…

marysatasselshaped667/skills-collection-1 · 79 tokens

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed and other packed malware samples to expose the original executable code for static analysis. Covers both standard UPX unpacking and handling modified UPX headers that prevent automated decompression. Activates for requests involving malware unpacking, UPX decompression, packer…

Mikaru0Mystic/sectinel · 79 tokens

analyzing-packed-malware-with-upx-unpacker

Identifies and unpacks UPX-packed and other packed malware samples to expose the original executable code for static analysis. Covers both standard UPX unpacking and handling modified UPX headers that prevent automated decompression. Activates for requests involving malware unpacking, UPX decompression, packer…

autohandai/community-skills · 79 tokens