Huntress Shows API-Hash Changes Can Evade Cobalt Strike and Metasploit Detection

· Original article ↗

Summary

Huntress researchers found that changing API-hashing logic in Cobalt Strike and Metasploit shellcode evaded many tested detections. They also developed a YARA rule targeting the hashing routine rather than fixed hashes.

Key points

  • The researchers found that default ROR13 API hashes in Cobalt Strike and Metasploit shellcode were used by vendors as detection indicators.
  • Changing the rotation value from 13 to 15 produced new hashes while preserving shellcode functionality in the researchers’ tests.
  • A Huntress script automates hash replacement using a randomized rotation value from 1 to 255; it requires raw shellcode without encoders.
  • In VirusTotal tests, modified samples received substantially fewer detections; additional changes to generic shellcode indicators resulted in zero detections in the tested sample set.
  • The researchers created a YARA rule that detects code associated with the hashing routine, rather than relying only on known API-hash values.
  • The rule detected all tested modified and unmodified samples, but the article cautions that more complex changes to the hashing routine could evade it.

Article Details

Attack Vectors
  • The research demonstrates modifying the ROR-based API hashing logic and corresponding hashes in Cobalt Strike and Metasploit shellcode to evade hash-based detections while preserving shellcode functionality.
  • The researchers also modified generic shellcode indicators by moving the initial CLD instruction and changing the case of a library name in a LoadLibraryA argument.
Defensive Notes
  • Huntress recommends detecting the ROR-based hashing code blocks rather than relying only on known API hash values; its YARA rule detected the tested modified and unmodified payloads.
  • The article recommends continuously testing and updating detection logic, threat hunting across multiple log sources, and checking network traffic even when antivirus raises no alert.

MITRE ATT&CK

People

Products

Tools

Related Articles