performing-steganography-detection
使用隐写分析(Steganalysis)工具检测和提取嵌入在图像、音频及其他媒体文件中的隐藏数据,揭露隐蔽通信渠道。
Best use case
performing-steganography-detection is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
使用隐写分析(Steganalysis)工具检测和提取嵌入在图像、音频及其他媒体文件中的隐藏数据,揭露隐蔽通信渠道。
Teams using performing-steganography-detection should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performing-steganography-detection/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performing-steganography-detection Compares
| Feature / Agent | performing-steganography-detection | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
使用隐写分析(Steganalysis)工具检测和提取嵌入在图像、音频及其他媒体文件中的隐藏数据,揭露隐蔽通信渠道。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 执行隐写术检测
## 适用场景
- 当怀疑图像、音频或视频文件中存在隐蔽数据隐藏时
- 在涉及通过媒体文件进行可疑数据外泄的调查中
- 分析间谍活动或内部威胁(Insider Threat)调查中的文件
- 当标准文件分析在媒体文件属性中发现异常时
- 检测使用隐写技术的通信渠道
## 前置条件
- StegDetect、zsteg、stegsolve、binwalk 用于分析
- steghide、OpenStego 用于提取尝试
- ExifTool 用于元数据分析
- Python 及 Pillow、numpy 用于自定义分析
- 了解常见隐写技术(LSB、DCT、扩频)
- 用于比较和统计分析的样本文件
## 工作流程
### 步骤 1:初始文件评估和元数据分析
```bash
# 安装隐写检测工具
sudo apt-get install steghide stegsnow
pip install zsteg
pip install stegoveritas
gem install zsteg # 基于 Ruby 的 PNG/BMP 工具
# 检查文件元数据是否存在异常
exiftool /cases/case-2024-001/media/suspect_image.jpg | tee /cases/case-2024-001/analysis/metadata.txt
# 检查异常文件大小(是否大于分辨率/格式预期)
identify -verbose /cases/case-2024-001/media/suspect_image.jpg | head -30
# 验证文件类型是否与扩展名匹配
file /cases/case-2024-001/media/suspect_image.jpg
# 确认 JPEG 签名与实际内容匹配
# 检查文件尾部后附加的数据
python3 << 'PYEOF'
import os
filepath = '/cases/case-2024-001/media/suspect_image.jpg'
filesize = os.path.getsize(filepath)
with open(filepath, 'rb') as f:
data = f.read()
# JPEG 文件以 FF D9 结尾
jpeg_end = data.rfind(b'\xff\xd9')
if jpeg_end > 0:
trailing_bytes = filesize - jpeg_end - 2
if trailing_bytes > 0:
print(f"警告:JPEG 结束标记后有 {trailing_bytes} 字节数据!")
print(f" 文件大小:{filesize} 字节")
print(f" JPEG 数据:{jpeg_end + 2} 字节")
print(f" 隐藏数据:{trailing_bytes} 字节")
# 提取尾部数据
with open('/cases/case-2024-001/analysis/trailing_data.bin', 'wb') as out:
out.write(data[jpeg_end + 2:])
else:
print("JPEG 结束标记后未检测到尾部数据")
# 检查嵌入的 ZIP/RAR 压缩包
zip_offset = data.find(b'PK\x03\x04')
rar_offset = data.find(b'Rar!\x1a\x07')
if zip_offset > 0:
print(f"在偏移量 {zip_offset} 处发现 ZIP 压缩包")
if rar_offset > 0:
print(f"在偏移量 {rar_offset} 处发现 RAR 压缩包")
PYEOF
```
### 步骤 2:运行自动化隐写分析工具
```bash
# 使用 binwalk 检测嵌入文件和数据
binwalk /cases/case-2024-001/media/suspect_image.jpg | tee /cases/case-2024-001/analysis/binwalk_scan.txt
# 提取嵌入文件
binwalk --extract --directory /cases/case-2024-001/analysis/binwalk_extracted/ \
/cases/case-2024-001/media/suspect_image.jpg
# 使用 zsteg 进行 PNG 和 BMP 分析(LSB 检测)
zsteg /cases/case-2024-001/media/suspect_image.png | tee /cases/case-2024-001/analysis/zsteg_results.txt
# zsteg 全面检查
zsteg -a /cases/case-2024-001/media/suspect_image.png
# 使用 stegoveritas 进行综合分析
stegoveritas /cases/case-2024-001/media/suspect_image.jpg \
-out /cases/case-2024-001/analysis/stegoveritas/
# stegoveritas 执行:
# - 元数据提取
# - LSB 分析(多个位平面)
# - 颜色映射分析
# - 尾部数据检测
# - 嵌入文件提取
# - 图像变换分析
# 使用 steghide 对 JPEG/BMP/WAV/AU 进行提取尝试
# 使用空密码尝试
steghide extract -sf /cases/case-2024-001/media/suspect_image.jpg -p "" \
-xf /cases/case-2024-001/analysis/steghide_extract.bin 2>&1
# 使用常见密码尝试
for pwd in password secret hidden stego test 123456 admin; do
result=$(steghide extract -sf /cases/case-2024-001/media/suspect_image.jpg \
-p "$pwd" -xf "/cases/case-2024-001/analysis/steghide_$pwd.bin" 2>&1)
if echo "$result" | grep -q "extracted"; then
echo "使用密码成功提取:$pwd"
fi
done
```
### 步骤 3:执行 LSB(最低有效位)分析
```bash
# 使用 Python 进行自定义 LSB 分析
python3 << 'PYEOF'
from PIL import Image
import numpy as np
img = Image.open('/cases/case-2024-001/media/suspect_image.png')
pixels = np.array(img)
# 从每个颜色通道提取 LSB
for channel, name in enumerate(['红色', '绿色', '蓝色']):
if channel >= pixels.shape[2]:
break
lsb_data = pixels[:, :, channel] & 1
# 统计分布(自然图像应约为 50/50)
zeros = np.sum(lsb_data == 0)
ones = np.sum(lsb_data == 1)
total = zeros + ones
ratio = ones / total
print(f"{name}通道 LSB:0={zeros}({zeros/total*100:.1f}%),1={ones}({ones/total*100:.1f}%)")
if abs(ratio - 0.5) < 0.01:
print(f" 中性——接近随机(可能是隐写或自然图像)")
elif ratio > 0.55 or ratio < 0.45:
print(f" 异常——与预期分布存在显著偏差")
# 将 LSB 数据提取为字节
lsb_bits = (pixels[:, :, 0] & 1).flatten()
lsb_bytes = np.packbits(lsb_bits)
# 检查提取数据是否有结构
with open('/cases/case-2024-001/analysis/lsb_extracted.bin', 'wb') as f:
f.write(lsb_bytes.tobytes())
# 在提取数据中检查已知文件签名
import struct
header = bytes(lsb_bytes[:16])
print(f"\nLSB 提取头部(十六进制):{header.hex()}")
if header[:4] == b'PK\x03\x04':
print(" 检测到:LSB 数据中存在 ZIP 压缩包!")
elif header[:3] == b'GIF':
print(" 检测到:LSB 数据中存在 GIF 图像!")
elif header[:4] == b'\x89PNG':
print(" 检测到:LSB 数据中存在 PNG 图像!")
elif header[:2] == b'\xff\xd8':
print(" 检测到:LSB 数据中存在 JPEG 图像!")
# 生成 LSB 可视化
lsb_img = Image.fromarray((lsb_data * 255).astype(np.uint8))
lsb_img.save('/cases/case-2024-001/analysis/lsb_visualization.png')
print("\nLSB 可视化已保存至 lsb_visualization.png")
PYEOF
```
### 步骤 4:分析音频和视频隐写
```bash
# 对音频文件进行频谱分析
python3 << 'PYEOF'
import wave
import numpy as np
# 分析 WAV 文件中的音频隐写
with wave.open('/cases/case-2024-001/media/suspect_audio.wav', 'r') as wav:
frames = wav.readframes(wav.getnframes())
samples = np.frombuffer(frames, dtype=np.int16)
# 音频样本的 LSB 分析
lsb = samples & 1
zeros = np.sum(lsb == 0)
ones = np.sum(lsb == 1)
total = len(lsb)
print(f"音频 LSB 分析:")
print(f" 样本数:{total}")
print(f" LSB 0:{zeros}({zeros/total*100:.1f}%)")
print(f" LSB 1:{ones}({ones/total*100:.1f}%)")
# 提取 LSB 数据
lsb_bytes = np.packbits(lsb)
with open('/cases/case-2024-001/analysis/audio_lsb.bin', 'wb') as f:
f.write(lsb_bytes.tobytes())
# 卡方检验(Chi-square Test)检验随机性
from scipy import stats
chi2, p_value = stats.chisquare([zeros, ones])
print(f" 卡方:{chi2:.4f},p 值:{p_value:.4f}")
if p_value < 0.05:
print(f" 异常:LSB 分布不随机(可能存在隐写)")
PYEOF
# 对音频文件使用 steghide
steghide info /cases/case-2024-001/media/suspect_audio.wav
# 使用 sonic-visualiser 或 audacity 分析频谱异常
# (检查频谱图是否有在频域中编码的隐藏图像)
```
### 步骤 5:生成隐写分析报告
```bash
# 汇编发现
python3 << 'PYEOF'
import os, json
report = {
"case": "2024-001",
"files_analyzed": [],
"findings": []
}
analysis_dir = '/cases/case-2024-001/analysis/'
for f in os.listdir(analysis_dir):
if f.endswith('.txt'):
with open(os.path.join(analysis_dir, f)) as fh:
content = fh.read()
if 'DETECTED' in content or 'SUCCESS' in content or 'WARNING' in content:
report["findings"].append({
"source": f,
"content": content[:500]
})
with open('/cases/case-2024-001/analysis/steg_report.json', 'w') as f:
json.dump(report, f, indent=2)
print("隐写分析报告已生成")
print(f"发现总数:{len(report['findings'])}")
PYEOF
```
## 核心概念
| 概念 | 定义 |
|------|------|
| LSB(最低有效位,Least Significant Bit) | 将数据嵌入像素或样本值的最低位 |
| DCT 隐写 | 在 JPEG 离散余弦变换(DCT)系数中隐藏数据 |
| 扩频(Spread Spectrum) | 将隐藏数据分布在整个载体信号中 |
| 隐写分析(Steganalysis) | 检测隐藏信息存在性的科学 |
| 卡方攻击(Chi-square Attack) | 检测非随机 LSB 分布的统计测试 |
| 载体媒介(Cover Medium) | 用于携带隐藏数据的原始文件(图像、音频、视频) |
| 隐写媒介(Stego Medium) | 嵌入隐藏数据后生成的文件 |
| 容量(Capacity) | 可以在不产生可见失真的情况下隐藏的最大数据量 |
## 工具与系统
| 工具 | 用途 |
|------|------|
| steghide | 在 JPEG、BMP、WAV、AU 文件中嵌入/提取数据 |
| zsteg | 检测 PNG 和 BMP 文件中的 LSB 隐写 |
| binwalk | 检测二进制文件中的嵌入文件和数据 |
| stegoveritas | 综合隐写分析工具,支持多种检测方法 |
| StegSolve | 用于图像位平面和滤镜分析的 Java GUI 工具 |
| OpenStego | 开源隐写和水印工具 |
| ExifTool | 媒体文件的元数据提取和分析 |
| stegseek | 快速 steghide 密码破解工具,用于 JPEG 隐写提取 |
## 常见场景
**场景 1:隐蔽通信调查**
检查嫌疑人通过即时通讯平台交换的图像,对所有 PNG/BMP 文件运行 stegoveritas 和 zsteg,对 JPEG 文件尝试使用已知密码进行 steghide 提取,分析 LSB 分布的统计异常,提取并解码任何隐藏消息。
**场景 2:通过图像上传进行数据外泄**
监控上传到云服务的图像是否存在异常文件大小,比较图像元数据与预期的相机/设备配置文件,运行 binwalk 检测嵌入的压缩包,分析 JPEG 量化表中的 steghide 签名,提取并检查任何隐藏载荷。
**场景 3:恶意软件命令与控制**
分析恶意软件下载的图像是否包含嵌入命令,检查文件结束标记后附加的数据,检查 DNS 查询响应中 TXT 记录里的 Base64 编码数据,分析 PNG IDAT 块中异常的压缩数据大小。
**场景 4:通过音频文件窃取知识产权**
分析音频文件 LSB 中是否嵌入文档,检查频谱图是否有在频域中隐藏的视觉模式,将音频文件大小与比特率和时长的预期大小进行比较,提取并分析任何隐藏数据载荷。
## 输出格式
```
隐写分析摘要:
已分析文件:45 个(32 个图像,8 个音频,5 个视频)
检测结果:
suspect_image_03.png:
zsteg:在 R 通道 LSB 中检测到文本
内容:"Meet at location B, Tuesday 1400"
方法:红色通道 LSB 嵌入
suspect_photo_17.jpg:
steghide:使用密码"secret123"提取数据
隐藏文件:confidential_report.pdf(234 KB)
方法:DCT 系数修改
profile_pic.png:
binwalk:在偏移量 45678 处嵌入 ZIP 压缩包
内容:3 个含财务数据的电子表格文件
方法:在 PNG IEND 标记后附加数据
recording_05.wav:
LSB 分析:非随机分布(p < 0.001)
提取:12 KB 二进制载荷(需进一步分析)
方法:音频 LSB 嵌入
干净文件:41 个(无隐写指标)
可疑文件:4 个(已提取数据)
报告:/cases/case-2024-001/analysis/steg_report.json
```Related Skills
performing-yara-rule-development-for-detection
通过识别可执行文件中的唯一字节模式、字符串和行为指标,开发精准的 YARA 恶意软件检测规则,同时将误报率降至最低。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-wireless-network-penetration-test
执行无线网络渗透测试,通过捕获握手包、破解 WPA2/WPA3 密钥、检测流氓接入点以及使用 Aircrack-ng 和相关工具测试无线网络分段,评估 WiFi 安全性。
performing-windows-artifact-analysis-with-eric-zimmerman-tools
使用 Eric Zimmerman 的开源 EZ Tools 套件(包括 KAPE、MFTECmd、PECmd、LECmd、JLECmd 和 Timeline Explorer)执行全面的 Windows 取证制品分析,解析注册表 hive、预取文件、事件日志和文件系统元数据。
performing-wifi-password-cracking-with-aircrack
在授权无线安全评估中捕获 WPA/WPA2 握手包,并使用 aircrack-ng、hashcat 和字典攻击进行离线密码破解, 以评估密码短语强度和无线网络安全状况。
performing-web-cache-poisoning-attack
在授权安全测试期间,通过未纳入缓存键的头部和参数毒化缓存响应,利用 Web 缓存机制向其他用户投递恶意内容。
performing-web-cache-deception-attack
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
performing-web-application-vulnerability-triage
使用 OWASP 风险评级方法论对 DAST/SAST 扫描器的 Web 应用程序漏洞发现进行分类,区分真阳性和假阳性,并确定修复优先级。
performing-web-application-scanning-with-nikto
Nikto 是一款开源 Web 服务器和 Web 应用程序扫描器,可针对超过 7,000 个潜在危险文件/程序进行测试,检查超过 1,250 个服务器的过期版本,并识别超过 270 个服务器的版本特定问题。
performing-web-application-penetration-test
遵循 OWASP Web 安全测试指南(WSTG)方法论,对 Web 应用程序执行系统化安全测试,识别认证、授权、 输入验证、会话管理和业务逻辑中的漏洞。测试人员以 Burp Suite 作为主要拦截代理,结合手动测试技术 发现自动化扫描器遗漏的缺陷。适用于 Web 应用渗透测试、OWASP 测试、应用安全评估或 Web 漏洞测试等请求场景。
performing-web-application-firewall-bypass
使用编码技术、HTTP 方法操控、参数污染和载荷混淆绕过 Web 应用防火墙保护,将 SQL 注入、XSS 及其他攻击载荷穿透 WAF 检测规则。
performing-vulnerability-scanning-with-nessus
使用 Tenable Nessus 执行认证和未认证漏洞扫描,识别网络基础设施、服务器和应用程序中的已知漏洞、 错误配置、默认凭据和缺失补丁。扫描器将发现与 CVE 数据库和 CVSS 评分关联,生成优先级修复指导。 适用于漏洞扫描、Nessus 评估、补丁合规检查或自动化漏洞检测等请求场景。