Code Signing – A Manager’s Guide

Let’s look at three interesting trends that have emerged in software development over the last decade.
One is that the number of companies that develop and release software has increased enormously. A key trigger for this has been the smartphone revolution and the associated need for companies to have their own mobile apps for their customers, as well as employees.
The second trend is that the primary means to distribute software, as well as the related patches and upgrades, has ubiquitously now become the internet. The advantages of using online software distribution, versus traditional methods such as CDs (Compact Discs) are significant: large scale, near instant software distribution at extremely low costs.
The third trend is the number of Independent Software Vendors (ISVs) who are primarily in the business of building software applications, has grown steadily over the years, with some research reports indicating a ten-fold growth over the last decade.
These trends explain how online software distribution has become the preferred method for companies developing and selling software. But does this method and its convenience-benefit also introduce business risk?
How does a user know whether the software being downloaded is from the original author (and not an impersonator)? How does the user know that the software has not been tampered with, and some malicious code inserted into the software? Code Signing provides the answer to these questions, by helping companies secure the software they release.
Apart from software developers and enterprise security specialists, it is critical for project managers, product managers, engineering managers and even senior management to be familiar with code signing. The reason is simple. Code Signing is an excellent safeguard against malware attacks. And malware is the most expensive type of attack on any enterprise: the average cost of a malware attack, as per a recent research report from IBM security, is $239 million which is 60 times more than the average cost of a data breach!
The “code” in code signing can mean executables, archives, drivers, firmware, libraries, packages and essentially any software that is intended for release and distribution to another party or user.
To understand how code signing works, it is important to have a basic understanding of Public Key Infrastructure (PKI). As defined in earlier articles on this blog, PKI is a set of roles, policies, hardware, software and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption. It is also important to understand the two primary objectives of code signing:
The process of code signing involves four main steps which are described below.
We suggest the following practices for a secure Code Signing process:
The Hardware Security Module (HSM) doesn’t allow the export of private cryptographic keys to software, as that will make these keys vulnerable to attacks. After the CAB Forum’s June 2023 requirement, we highly recommend using a FIPS 140-2 Level 2 (or higher) certified HSMs for Code Signing.
We highly suggest allowing only minimal connections to client systems with the private keys. Limiting key access to limited users will resolve a lot of inconspicuous user activity.
Time stamping is a good way to track when code has been signed and helps check the validity period of the signature. It also allows the code to be verified after the certificate used for signing has expired or been revoked.
Organizations sometimes use the same key to sign code across multiple product lines and businesses. This isn’t a good approach. If that key gets compromised, all the releases signed by that key will be at risk. A good practice would be to rotate your keys as frequently as possible.
Generally, organizations manage certificates and keys manually. But this isn’t a good approach as manual processes neither provide complete visibility nor centralized control over keys. Applying various policies on the keys and regulating those is difficult without a centralized management system.
At the receiver side, the browser being used to download the software first checks that the certificate in the code being downloaded is authentic and from a trustworthy CA. This is possible since the public keys of most of the well-known CAs are already pre-installed with most browsers and operating systems.
If the certificate is not authenticated, the browser will alert you and depending on browser security settings, may or may not allow the download. If the user ignores this warning, and attempts to install the software, the operating system will issue an alert indicating that the software publisher could not be verified and effectively discourages the user from installing the software. This addresses the first objective of code signing i.e. establishing code ownership.
If the certificate is authenticated, the public key is extracted from the certificate and used to decrypt the encrypted hash available in the package. Next the actual downloaded software (minus the certificate and hash) is hashed again using the same hash function. This hash value is compared with the decrypted hash value. If they match, the software has not been altered. If an attacker has changed the software (e.g. by adding some malware) then the hashes will not match, the operating system will throw an alert and refuse to install the software. This addresses the second objective i.e. ensuring code integrity.
When a private key is compromised, the certificate loses its trust, destroying the authenticity and integrity of the software signed by this code-signing certificate. Code-signing practices ensure secure product development, production, and deployment. The best practices for protecting the Software Supply Chain with secure code-signing are:
Organizations should use streamlined code signing processes, such as CI/CD pipelines and approval processes, to prevent malicious code from being signed. After signing, the code or artifact should be authenticated and verified before being released to the users. Organizations should also maintain logs of all the code-signing processes for auditing later.
To ensure code safety, revocation should be followed. Certificates that have been compromised should be revoked by the Certificate Authority; this way, the corrupted or compromised certificates cannot be used for code-signing activities.
Code Signing is very important in deployments in cloud-native applications or DevOps. Before distributing software to users, we can sign and verify software types such as container images, application binaries, etc. In cloud-native environments, code signing is integrated with CI/CD pipelines to maintain the trust and authenticity of the software. By including code signing in cloud-native environments, organizations can prevent the risk of tampering with code that makes it malicious for distribution.
Today code signing is an essential part of the software development lifecycle. Without code signing, enterprises risk losing users and face enormous financial and reputation risks in case of malware attacks. It is therefore critical for software line managers as well as senior management to understand code signing and its importance to their organizations.
January 23, 2025
January 22, 2025
January 21, 2025