Digital Signature Hijack – Binaries, PowerShell Scripts And Information About Digital Signature Hijacking

Digital Signature Hijack 1

Hijacking legitimate digital signatures is a technique that can be used during red team assessments in order to sign PowerShell code and binaries. This could assist to bypass Device Guard restrictions and maintain stealthy in an engagement. DigitalSignatureHijack is a PowerShell script based on Matt Graeber research that can perform the following operations:

  • Digitally sign all portable executables on the host as Microsoft
  • Digitally sign all powershell scripts on the host as Microsoft
  • Validate the digital signature for all portable executables
  • Validate the digital signature for all powershell scripts

This is achieved by hijacking the registry and adding the necessary values and by utilizing the custom SIP dll file that Matt Graeber developed. Users need to modify the path of MySIP.dll to their local path.

  • MySIP.dll – https://github.com/mattifestation/PoCSubjectInterfacePackage

Demo

Signing Portable Executables

SignExe

Digital Signature Hijack 1

Signature Validation

ValidateSignaturePE

Digital Signature Hijack 2

Signing PowerShell Scripts

SignPS

Digital Signature Hijack 3

Signature Validation

ValidateSignaturePS

Digital Signature Hijack 4

Resources

  • Hijacking Digital Signatures
  • Application of authenticode signatures
  • Subverting Trust in Windows
  • Subverting and Restoring Trust in Windows
  • Borrowing Microsoft Code Signing Certificates

Disclaimer

  • The purpose of this repository is to store compiled DLL’s, binaries, scripts and to centralize existing information about digital signature hijacking. All the credits are going to the original authors of these tools.
  • The binaries and the DLL which are stored in this repository have not been modified from their original state and they are totally safe. However if for any reason you don’t trust this repository the original repositories which contain the source code of these tools are provided in order to compile them by yourself.

Credits

  • Matt Graeber
  • Chris Ross
  • netbiosX
  • Josh Pitts
Download Digital-Signature-Hijack

Patreon

Original Source