Blog | G5 Cyber Security

Sign Code with Authenticode to Bypass AV

TL;DR

Signing your code with a valid Authenticode certificate helps avoid false positives from antivirus (A/V) software. This guide shows you how to get a certificate and use it to sign executables, installers, and other files.

1. Get an Authenticode Certificate

You’ll need a code signing certificate from a trusted Certificate Authority (CA). Here are some options:

The process generally involves:

  1. Choosing a certificate type (Standard or Extended Validation). Extended Validation provides more trust but requires stricter identity verification.
  2. Providing company information and details about the signers.
  3. Generating a Certificate Signing Request (CSR) – see step 2.
  4. Validating your identity (usually through email, phone calls, or documentation).
  5. Purchasing and downloading the certificate.

2. Generate a Certificate Signing Request (CSR)

You’ll need to create a CSR using OpenSSL or PowerShell. Here’s how with OpenSSL:

openssl req -newkey rsa:2048 -nodes -keyout yourcompany.key -out yourcompany.csr

Follow the prompts, providing accurate information. The Common Name (CN) should usually be your company name or domain.

3. Install the Certificate

Import the certificate into your Windows Certificate Store:

  1. Double-click the downloaded .cer file.
  2. Select “Install Certificate”.
  3. Choose “Local Machine” store.
  4. Select “Place all certificates in the following store”.
  5. Browse and select “Trusted Root Certification Authorities”.

4. Sign Your Code with Signtool

Signtool is a command-line tool included with the Windows SDK. Make sure you have it installed.

Sign an executable:

signtool sign /f yourcompany.pfx /p yourpassword /t http://timestamp.digicert.com yourfile.exe

Replace:

5. Verify the Signature

Use Signtool to verify the signature:

signtool verify /pa yourfile.exe

This will confirm that the code is signed and hasn’t been tampered with.

6. Troubleshooting Common Issues

Exit mobile version