深度伪造语音检测
detecting-deepfake-audio-in-vishing-attacks
通过提取频谱特征(MFCC、频谱质心、频谱对比度、过零率)并使用机器学习模型对样本进行分类,检测语音钓鱼(vishing)中使用的 AI 生成深度伪造音频,支持批量音频分析、置信度评分和取证报告。适用于深度伪造语音检测、vishing 调查、AI 生成语音分析、语音克隆检测或音频真实性验证。
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-31
- Stars
- ★ 3.6w
- Forks
- 4.4k
01 前言 Front Matter
- name
- detecting-deepfake-audio-in-vishing-attacks
- tags
- [ "deepfake-detection", "vishing", "audio-forensics", "MFCC", "spectral-analysis", "voice-cloning" ]
- author
- mukul975
- domain
- cybersecurity
- license
- Apache-2.0
- version
- 1.0.0
- mitre_f3
- { "tactics": [ "reconnaissance", "initial-access", "stealth", "monetization" ], "version": "1.1", "techniques": [ { "id": "F1032", "name": "Impersonate Official", "source": "f3", "tactic": "initial-access" }, { "id": "F1031", "name": "Impersonate Account Holder", "source": "f3", "tactic": "initial-access" }, { "id": "F1040", "name": "Phone Number Spoofing", "source": "f3", "tactic": "stealth" }, { "id": "F1034", "name": "Interactive Voice Response Mapping", "source": "f3", "tactic": "reconnaissance" }, { "id": "F1025.003", "name": "Electronic Funds Transfer: Wire Transfer", "source": "f3", "tactic": "monetization" } ] }
- nist_csf
- [ "PR.AT-01", "DE.CM-09", "RS.CO-02" ]
- subdomain
- social-engineering-defense
- description
- Detect AI-generated deepfake audio used in voice phishing (vishing) by extracting spectral features (MFCC, spectral centroid, spectral contrast, zero-crossing rate) and classifying samples with machine learning models, supporting batch audio analysis, confidence scoring, and forensic reporting. Use for deepfake voice detection, vishing investigations, AI-generated speech analysis, voice cloning detection, or audio authenticity verification.
- nist_ai_rmf
- [ "MEASURE-2.7", "GOVERN-6.2", "MAP-5.2", "MEASURE-2.5", "MAP-5.1" ]
- mitre_attack
- [ "T1078", "T1190", "T1059", "T1566", "T1598" ]
- atlas_techniques
- [ "AML.T0088", "AML.T0043", "AML.T0018", "AML.T0052" ]
- d3fend_techniques
- [ "Sender Reputation Analysis", "Content Validation", "Message Analysis", "User Behavior Analysis", "Identifier Analysis" ]
02 资源文件 5
- 许可证LICENSE11.0 KB
- 参考文档references/api_reference.md17.0 KB
- 参考文档references/api-reference.md5.3 KB
- 脚本scripts/agent.py24.1 KB
- 脚本scripts/query_clinpgx.py14.0 KB
03 SKILL.md 正文
Detecting Deepfake Audio in Vishing Attacks
When to Use
- A suspected vishing call used an AI-cloned executive voice to authorize a wire transfer
- Security operations received a voicemail that sounds like the CEO but the tone seems off
- Incident response needs to determine whether a recorded phone call contains synthetic speech
- Fraud investigation requires forensic proof that audio was AI-generated
- Red team exercises use voice cloning and blue team needs detection capability
Do not use for text-based phishing (email/SMS); use email header analysis or URL detonation tools instead.
Prerequisites
- Python 3.9+ with librosa, numpy, scikit-learn, and scipy installed
- Audio samples in WAV, MP3, or FLAC format (mono or stereo, any sample rate)
- Reference corpus of known genuine voice samples for the targeted individual (optional but improves accuracy)
- FFmpeg installed for audio format conversion (librosa dependency)
- Minimum 3 seconds of audio for reliable feature extraction
Workflow
Step 1: Audio Preprocessing
Normalize and prepare audio samples for feature extraction:
import librosa
import numpy as np
# Load audio, resample to 16kHz mono
y, sr = librosa.load("suspect_call.wav", sr=16000, mono=True)
# Trim silence from beginning and end
y_trimmed, _ = librosa.effects.trim(y, top_db=25)
# Normalize amplitude to [-1, 1]
y_norm = y_trimmed / np.max(np.abs(y_trimmed))
Audio preprocessing ensures consistent feature extraction across different recording conditions, microphones, and codec artifacts.
Step 2: Extract Spectral Features
Extract the feature set that distinguishes real from synthetic speech:
Mel-Frequency Cepstral Coefficients (MFCCs):
# Extract 20 MFCCs + delta and delta-delta
mfccs = librosa.feature.mfcc(y=y_norm, sr=sr, n_mfcc=20)
mfcc_delta = librosa.feature.delta(mfccs)
mfcc_delta2 = librosa.feature.delta(mfccs, order=2)
MFCCs capture the spectral envelope of speech, representing how the vocal tract shapes sound. Deepfake audio often shows unnatural smoothness in higher-order MFCCs because neural vocoders approximate but do not perfectly replicate the acoustic resonance of a physical vocal tract.
Spectral Features:
spectral_centroid = librosa.feature.spectral_centroid(y=y_norm, sr=sr)
spectral_bandwidth = librosa.feature.spectral_bandwidth(y=y_norm, sr=sr)
spectral_contrast = librosa.feature.spectral_contrast(y=y_norm, sr=sr)
spectral_rolloff = librosa.feature.spectral_rolloff(y=y_norm, sr=sr)
zero_crossing_rate = librosa.feature.zero_crossing_rate(y_norm)
Key indicators of deepfake audio:
- Reduced spectral contrast in the 4-8 kHz range (vocoders compress high-frequency detail)
- Abnormally consistent spectral centroid over time (real speech has natural variation)
- Lower zero-crossing rate variance (synthetic speech lacks micro-perturbations)
- Missing or attenuated formant transitions during consonant-vowel boundaries
Step 3: Build Feature Vector and Classify
Aggregate frame-level features into a fixed-length vector and classify:
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.model_selection import cross_val_score
def build_feature_vector(y, sr):
features = []
mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=20)
for coeff in mfccs:
features.extend([np.mean(coeff), np.std(coeff), np.min(coeff), np.max(coeff)])
for feat_fn in [librosa.feature.spectral_centroid,
librosa.feature.spectral_bandwidth,
librosa.feature.spectral_rolloff,
librosa.feature.zero_crossing_rate]:
feat = feat_fn(y=y, sr=sr) if feat_fn != librosa.feature.zero_crossing_rate else feat_fn(y)
features.extend([np.mean(feat), np.std(feat), np.min(feat), np.max(feat)])
contrast = librosa.feature.spectral_contrast(y=y, sr=sr)
for band in contrast:
features.extend([np.mean(band), np.std(band)])
return np.array(features)
Classification uses an ensemble approach: Random Forest for robustness and Gradient Boosting for accuracy, with a voting mechanism to reduce false positives.
Step 4: Temporal Artifact Analysis
Examine time-domain artifacts that neural vocoders leave behind:
# Pitch stability analysis - deepfakes often have unnaturally stable F0
f0, voiced_flag, voiced_probs = librosa.pyin(y_norm, fmin=50, fmax=500, sr=sr)
f0_clean = f0[~np.isnan(f0)]
pitch_std = np.std(f0_clean) if len(f0_clean) > 0 else 0
pitch_jitter = np.mean(np.abs(np.diff(f0_clean))) if len(f0_clean) > 1 else 0
Real human speech exhibits natural pitch jitter (micro-variations in fundamental frequency) and shimmer (amplitude perturbations). Deepfake audio generated by Tacotron 2, VALL-E, or ElevenLabs typically shows reduced jitter and shimmer compared to genuine speech.
Step 5: Spectrogram Visual Inspection
Generate spectrograms for manual forensic review:
import librosa.display
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 2, figsize=(14, 10))
librosa.display.specshow(librosa.power_to_db(librosa.feature.melspectrogram(y=y_norm, sr=sr)),
sr=sr, ax=axes[0, 0], x_axis='time', y_axis='mel')
axes[0, 0].set_title('Mel Spectrogram')
librosa.display.specshow(mfccs, sr=sr, ax=axes[0, 1], x_axis='time')
axes[0, 1].set_title('MFCCs')
Visual inspection reveals banding artifacts in mel spectrograms, unnatural energy cutoffs above the vocoder's frequency ceiling, and periodic noise patterns in the high-frequency range that are characteristic of neural speech synthesis.
Step 6: Generate Forensic Report
Compile findings into an actionable report:
DEEPFAKE AUDIO ANALYSIS REPORT
================================
File: suspect_executive_call.wav
Duration: 47.3 seconds
Sample Rate: 16000 Hz
Analysis Date: 2026-03-19
CLASSIFICATION RESULT
Verdict: LIKELY DEEPFAKE (confidence: 94.2%)
Ensemble Score: RF=0.91, GBT=0.97, Avg=0.94
FEATURE ANOMALIES DETECTED
- MFCC variance in coefficients 13-20: 62% below genuine baseline
- Spectral contrast (4-8 kHz): 0.23 (genuine avg: 0.41)
- Pitch jitter: 0.8 Hz (genuine avg: 2.4 Hz)
- Zero-crossing rate std: 0.003 (genuine avg: 0.011)
SPECTROGRAM ARTIFACTS
- Energy cutoff above 7.8 kHz (consistent with neural vocoder ceiling)
- Banding pattern at 50ms intervals in mel spectrogram
- Missing formant transitions at 12.4s, 23.1s, 35.7s timestamps
RECOMMENDATION
High confidence of AI-generated audio. Recommend out-of-band
verification with the purported speaker. Preserve original audio
file with chain of custody documentation for potential legal action.
Key Concepts
| Term | Definition |
|---|---|
| MFCC | Mel-Frequency Cepstral Coefficients; representation of the short-term power spectrum on a mel (perceptual) frequency scale |
| Spectral Centroid | Weighted mean of frequencies present in the signal; indicates perceived brightness of a sound |
| Spectral Contrast | Difference in amplitude between peaks and valleys in the spectrum across frequency sub-bands |
| Vocoder | Signal processing component that synthesizes audio waveforms from acoustic features; used in TTS and voice cloning |
| Pitch Jitter | Cycle-to-cycle variation in fundamental frequency; natural in human speech, reduced in synthetic speech |
| Vishing | Voice phishing; social engineering attack conducted via phone calls, increasingly using AI-cloned voices |
| Formant | Resonant frequencies of the vocal tract that define vowel sounds; transitions between formants are difficult for AI to replicate perfectly |
Tools & Systems
- librosa: Python library for audio analysis providing MFCC, spectral feature extraction, and spectrogram generation
- scikit-learn: Machine learning library used for Random Forest and Gradient Boosting classification
- Resemblyzer: Speaker embedding library for comparing voice identity between known genuine and suspect samples
- Speechbrain: Deep learning toolkit for speech processing with pretrained deepfake detection models
- Praat: Phonetics software for detailed pitch, jitter, and shimmer analysis of speech samples
- FFmpeg: Audio format conversion and preprocessing utility required by librosa
Common Scenarios
Scenario: Executive Impersonation Wire Transfer Fraud
Context: CFO receives a phone call appearing to be from the CEO requesting an urgent wire transfer of $2.3M. The call came from an unknown number but the voice sounded identical to the CEO. IT security was able to obtain a recording of the call from the phone system.
Approach:
- Extract the audio from the phone system recording and convert to WAV at 16kHz
- Run MFCC and spectral feature extraction on the suspect audio
- Compare against known genuine CEO voice samples from recorded meetings
- Analyze pitch jitter and shimmer against human speech baselines
- Classify using the trained ensemble model and generate confidence score
- Produce forensic report with spectrogram evidence for legal/compliance
Pitfalls:
- Phone codec compression (G.711, AMR) degrades audio quality and can mask deepfake artifacts
- Short audio clips (under 3 seconds) produce unreliable feature statistics
- Background noise from the call environment can reduce classification accuracy
- Highly sophisticated voice cloning (e.g., fine-tuned VALL-E with 30+ minutes of training data) may evade basic feature analysis
- Genuine speech transmitted through VoIP may exhibit spectral artifacts similar to deepfakes
04 同仓库更多 Skills
SLSA 构建来源验证
verifying-build-provenance-with-slsa-sigstore
使用 Sigstore 的 cosign(verify、verify-attestation、verify-blob-attestation)和 slsa-verifier(verify-artifact)验证工件签名和 SLSA 来源(provenance),强制校验 keyless OIDC 构建者身份和源仓库是否符合 SLSA Build 级别。适用于 CI/CD 中部署工件前、消费第三方证明时、建立 SLSA Build L3 管道,或在事件响应或准入控制期间确认来源的场景。
TPM 测量启动验证
validating-tpm-measured-boot-attestation
使用 tpm2-tools 验证 TPM 2.0 测量启动(measured boot)的完整性和远程证明:读取 PCR(tpm2_pcrread)、重放启动事件日志、生成并检查签名报价(tpm2_quote/tpm2_checkquote),以及将机密封印(seal)到 PCR 策略。适用于确认系统已启动可信固件/内核以实现零信任(Zero Trust)设备状态、通过 PCR 漂移检测启动链篡改,或构建黄金值基线用于机群(fleet)证明。
备份完整性验证
validating-backup-integrity-for-recovery
通过加密哈希验证、自动化恢复测试、损坏检测和可恢复性检查来验证备份完整性,确认备份对于灾难恢复和勒索软件响应是可靠的。适用于在依赖备份进行恢复之前、构建备份后验证管道、审计备份基础设施以满足合规要求,或检查不可变/air-gapped(气隙)备份是否存在静默损坏或篡改的场景。
KAPE Windows 取证收集
triaging-windows-with-kape
运行 KAPE(Kroll Artifact Parser and Extractor),通过 Targets 收集目标取证工件(注册表配置单元、$MFT、事件日志、prefetch、浏览器数据),并使用封装 Eric Zimmerman 的 EZ Tools(PECmd、MFTECmd、RECmd)的 Modules 进行解析。适用于事件遏制/分诊早期阶段——此时完整磁盘镜像不切实际,但需要快速获得可采信、可解析的 Windows 工件集,包括大规模远程收集。
SSVC 漏洞优先级分诊
triaging-vulnerabilities-with-ssvc-framework
使用 CISA 的 Stakeholder-Specific Vulnerability Categorization(SSVC,利益相关方特定漏洞分类)决策树对漏洞进行分诊和优先级排序,权衡利用状态(通过 CISA KEV 目录和 FIRST EPSS API)、技术影响、自动化程度和任务普遍性,输出 Track/Track*/Attend/Act 决策。适用于对漏洞扫描结果(OpenVAS、Nessus、Qualys)进行优先级排序以制定修复计划,而不局限于原始 CVSS 分数的场景。
安全事件初步分诊
triaging-security-incident
使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初步分诊,分类事件类型、按业务影响分配优先级,并路由到相应的响应团队。适用于 SIEM/EDR 告警需要人工分类、并发告警必须确定优先级,或用户报告或威胁情报 IOC 匹配需要初步事件分类的场景。