Skip to content
This page was generated and translated with the assistance of AI. If you spot any inaccuracies, feel free to help improve it. Edit on GitHub

Heuristic Analysis ​

Heuristic analysis is the third layer in the PRX-SD detection pipeline. While hash matching and YARA rules rely on known signatures and patterns, heuristics analyze the structural and behavioral properties of a file to detect threats that have never been seen before -- including zero-day malware, custom implants, and heavily obfuscated samples.

How It Works ​

PRX-SD first identifies the file type using magic number detection, then applies a set of targeted heuristic checks specific to that file format. Each check that triggers adds points to a cumulative score. The final score determines the verdict.

Scoring Mechanism ​

Score RangeVerdictMeaning
0 - 29CleanNo significant suspicious indicators
30 - 59SuspiciousSome anomalies detected; manual review recommended
60 - 100MaliciousHigh confidence threat; multiple strong indicators

Scores are additive. A file with one minor anomaly (e.g., slightly high entropy) might score 15, while a file combining high entropy, suspicious API imports, and packer signatures would score 75+.

PE (Windows Executable) Analysis ​

PE heuristics target Windows executables (.exe, .dll, .scr, .sys):

CheckPointsDescription
High section entropy10-25Sections with entropy > 7.0 indicate packing or encryption
Suspicious API imports5-20APIs like VirtualAllocEx, WriteProcessMemory, CreateRemoteThread
Known packer signatures15-25UPX, Themida, VMProtect, ASPack, PECompact headers detected
Timestamp anomaly5-10Compilation timestamp in the future or before 2000
Section name anomaly5-10Non-standard section names (.rsrc replaced, random strings)
Resource anomaly5-15Embedded PE files in resources, encrypted resource sections
Import table anomaly10-15Very few imports (packed), or suspicious import combinations
Digital signature-10Valid Authenticode signature reduces score
TLS callbacks10Anti-debug TLS callback entries
Overlay data5-10Significant data appended after the PE structure

Example PE Findings ​

Heuristic Analysis: updater.exe
Score: 72/100 [MALICIOUS]

Findings:
  [+25] Section '.text' entropy: 7.91 (likely packed or encrypted)
  [+15] Packer detected: UPX 3.96
  [+12] Suspicious API imports: VirtualAllocEx, WriteProcessMemory,
        CreateRemoteThread, NtUnmapViewOfSection
  [+10] Section name anomaly: '.UPX0', '.UPX1' (non-standard)
  [+10] Compilation timestamp: 2089-01-01 (future date)

ELF (Linux Executable) Analysis ​

ELF heuristics target Linux binaries and shared objects:

CheckPointsDescription
High section entropy10-25Sections with entropy > 7.0
LD_PRELOAD references15-20Strings referencing LD_PRELOAD or /etc/ld.so.preload
Cron persistence10-15References to /etc/crontab, /var/spool/cron, cron directories
Systemd persistence10-15References to systemd unit paths, systemctl enable
SSH backdoor indicators15-20Modified authorized_keys paths, sshd config strings
Anti-debugging10-15ptrace(PTRACE_TRACEME), /proc/self/status checks
Network operations5-10Raw socket creation, suspicious port bindings
Self-deletion10unlink of own binary path after execution
Stripped + high entropy10Stripped binary with high entropy suggests packed malware
/dev/null redirect5Redirecting output to /dev/null (daemon behavior)

Example ELF Findings ​

Heuristic Analysis: .cache/systemd-helper
Score: 65/100 [MALICIOUS]

Findings:
  [+20] LD_PRELOAD reference: /etc/ld.so.preload manipulation
  [+15] Cron persistence: writes to /var/spool/cron/root
  [+15] SSH backdoor: modifies /root/.ssh/authorized_keys
  [+10] Self-deletion: unlinks /tmp/.cache/systemd-helper
  [+5]  Network: creates raw socket

Mach-O (macOS Executable) Analysis ​

Mach-O heuristics target macOS binaries, bundles, and universal binaries:

CheckPointsDescription
High section entropy10-25Sections with entropy > 7.0
Dylib injection15-20DYLD_INSERT_LIBRARIES references, suspicious dylib loading
LaunchAgent/Daemon persistence10-15References to ~/Library/LaunchAgents, /Library/LaunchDaemons
Keychain access10-15Keychain API calls, security command usage
Gatekeeper bypass10-15xattr -d com.apple.quarantine strings
Privacy TCC bypass10-15References to TCC database, accessibility API abuse
Anti-analysis10sysctl checks for debuggers, VM detection strings
Code signing anomaly5-10Ad-hoc signed or unsigned binary

Example Mach-O Findings ​

Heuristic Analysis: com.apple.helper
Score: 55/100 [SUSPICIOUS]

Findings:
  [+20] Dylib injection: DYLD_INSERT_LIBRARIES manipulation
  [+15] LaunchAgent persistence: writes to ~/Library/LaunchAgents/
  [+10] Keychain access: SecKeychainFindGenericPassword calls
  [+10] Unsigned binary: no code signature present

Office Document Analysis ​

Office heuristics target Microsoft Office formats (.doc, .docx, .xls, .xlsx, .ppt):

CheckPointsDescription
VBA macros present10-15Auto-execute macros (AutoOpen, Document_Open, Workbook_Open)
Macro with shell execution20-30Shell(), WScript.Shell, PowerShell invocation in macros
DDE fields15-20Dynamic Data Exchange fields that execute commands
External template link10-15Remote template injection via attachedTemplate
Obfuscated VBA10-20Heavily obfuscated macro code (Chr(), string concatenation abuse)
Embedded OLE objects5-10Embedded executables or scripts as OLE objects
Suspicious metadata5Author fields with base64 strings or unusual patterns

Example Office Findings ​

Heuristic Analysis: Q3_Report.xlsm
Score: 60/100 [MALICIOUS]

Findings:
  [+15] VBA macro with AutoOpen trigger
  [+25] Macro executes: Shell("powershell -enc JABjAGwA...")
  [+10] Obfuscated VBA: 47 Chr() calls, string concatenation abuse
  [+10] External template: https://evil.example.com/template.dotm

PDF Analysis ​

PDF heuristics target PDF documents:

CheckPointsDescription
Embedded JavaScript15-25JavaScript in /JS or /JavaScript actions
Launch action20-25/Launch action that executes system commands
URI action5-10Suspicious URI actions pointing to known bad patterns
Obfuscated streams10-15Multiple encoding layers (FlateDecode + ASCII85 + hex)
Embedded files5-10Executable files embedded as attachments
Form submission5-10Forms that submit data to external URLs
AcroForm with JavaScript15Interactive forms with embedded JavaScript

Example PDF Findings ​

Heuristic Analysis: shipping_label.pdf
Score: 45/100 [SUSPICIOUS]

Findings:
  [+20] Embedded JavaScript: 3 /JS actions found
  [+15] Obfuscated stream: triple-encoded FlateDecode chain
  [+10] Embedded file: invoice.exe (PE executable)

Common Findings Reference ​

The following table lists the most frequently triggered heuristic findings across all file types:

FindingSeverityFile TypesFalse Positive Rate
High entropy sectionMediumPE, ELF, Mach-OLow-Medium (game assets, compressed data)
Packer detectionHighPEVery Low
Auto-execute macroHighOfficeLow (some legitimate macros)
LD_PRELOAD manipulationHighELFVery Low
Embedded JavaScriptMedium-HighPDFLow
Suspicious API importsMediumPEMedium (security tools trigger this)
Self-deletionHighELFVery Low

Reducing False Positives

If a legitimate file triggers heuristic alerts, you can add it to the allowlist by SHA-256 hash:

bash
sd allowlist add /path/to/legitimate/file

Allowlisted files skip heuristic analysis but are still checked against hash and YARA databases.

Next Steps ​

Released under the Apache-2.0 License.