Blog | G5 Cyber Security

Forging Self-Signed Certificates

TL;DR

Yes, self-signed TLS/DTLS certificates can be forged relatively easily. They lack the trust anchor provided by a Certificate Authority (CA), meaning anyone can create a certificate claiming to be you. However, forging a certificate doesn’t automatically mean someone can *use* it – browsers and applications need to accept it, which usually requires manual intervention or pre-configuration.

Understanding Self-Signed Certificates

Self-signed certificates are created and signed by the same entity (you) instead of a trusted third party (a CA). This makes them free and quick to generate but also inherently untrusted. They’re fine for testing or internal systems where you control all clients, but not suitable for public-facing services.

How a Self-Signed Certificate Can Be Forged

  1. Generating the Certificate: The most common way to ‘forge’ is simply creating your own. Tools like OpenSSL make this straightforward.
    openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365

    This command creates a new RSA key (key.pem) and a self-signed certificate (cert.pem) valid for 365 days.

  2. Manipulating Existing Certificates: While less common, someone with access to your private key could modify an existing self-signed certificate’s details (e.g., Common Name). This is still considered forging.

Why Forging Works

Steps to Forge (Create) a Self-Signed Certificate

  1. Install OpenSSL: If you don’t have it already:
    • Linux (Debian/Ubuntu):
      sudo apt update && sudo apt install openssl
    • macOS (using Homebrew):
      brew install openssl
    • Windows: Download from a reputable source (e.g., Shining Light Productions) and add the OpenSSL bin directory to your PATH.
  2. Generate Key and Certificate: Run the command shown earlier:
    openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365

    You’ll be prompted for information like Country Name, State, Locality, Organization Name, Common Name (this is crucial – it should match the domain or hostname you intend to use), and email address.

  3. Verify the Certificate: Check the certificate details:
    openssl x509 -in cert.pem -text -noout

    This will display the certificate information, including the Common Name and validity period.

Preventing Issues with Forged Certificates

cyber security Implications

Forged self-signed certificates are a common component of man-in-the-middle (MITM) attacks. An attacker can intercept communication between a client and server, present a forged certificate to the client, and decrypt/modify traffic. While the initial connection requires user acceptance or pre-configuration, it creates a vulnerability that can be exploited.

Exit mobile version