From build server to user: protecting the update path
An automatic update is a program that installs code on every customer's computer. If an attacker controls it, they control all of them at once.
Các bài viết được đăng bằng tiếng Anh.
Software supply-chain attacks are attractive because of their reach. One compromised update reaches every customer who trusts your product, and it arrives through a channel their security tools already allow.
What needs protecting
Follow the path from a developer’s commit to an installed program. Each step is a place to tamper with the result: the source repository, third-party dependencies, the build server, the signing step, the download server and the updater on the customer’s machine.
Separate building from signing
The server that compiles code runs a great deal of third-party software and scripts. It should not be able to sign releases freely. Put signing in a separate step with its own access, and let it sign only builds that came from an approved pipeline.
Keep the private key in a hardware security module or a managed key service, where it can be used but not copied. Require a person to approve release signing, and log every use. If a key is merely a file on a server, assume it can be stolen.
Verify before installing
The updater must check the signature against a public key that is built into the application, before it runs anything. It must reject anything unsigned or incorrectly signed, with no way for a user or a network attacker to skip the check.
HTTPS is necessary and not sufficient. It protects the connection, but it does nothing if the download server itself is compromised. The signature protects the file.
Stop rollback and freeze attacks
A correctly signed old version is still a valid file. An attacker who can serve it can return users to a version with known vulnerabilities, so the updater should refuse to install anything older than what it has.
An attacker may also simply hide new updates, leaving users exposed without any visible error. Signed metadata with an expiry date defeats this, because the client notices when the information is stale.
The Update Framework (TUF) is an open specification that addresses these attacks, and it is worth reading even if you do not adopt it directly.
Timestamps and key rotation
Code-signing certificates expire. A signature with a trusted timestamp stays valid after the certificate has expired, so include one.
Plan for the day a key must be replaced. If the only way to trust a new key is an update signed by the old one, a stolen key becomes a very hard problem. Design a rotation procedure and rehearse it.
Know what is in the build
Record the exact dependencies of every release in a software bill of materials. When a vulnerability is announced in a library, you can answer within minutes whether you are affected.
Reproducible builds go further. When the same source always produces an identical binary, an independent machine can confirm that the build server added nothing of its own.
Do đội ngũ kỹ sư của Avtim viết. Đây là thông tin chung; hãy đối chiếu với hệ thống của bạn trước khi dựa vào.