M1045 Code Signing
Code Signing is a security process that ensures the authenticity and integrity of software by digitally signing executables, scripts, and other code artifacts. It prevents untrusted or malicious code from executing by verifying the digital signatures against trusted sources. Code signing protects against tampering, impersonation, and distribution of unauthorized or malicious software, forming a critical defense against supply chain and software exploitation attacks. This mitigation can be implemented through the following measures:
Enforce Signed Code Execution:
- Implementation: Configure operating systems (e.g., Windows with AppLocker or Linux with Secure Boot) to allow only signed code to execute.
- Use Case: Prevent the execution of malicious PowerShell scripts by requiring all scripts to be signed with a trusted certificate.
Vendor-Signed Driver Enforcement:
- Implementation: Enable kernel-mode code signing to ensure that only drivers signed by trusted vendors can be loaded.
- Use Case: A malicious driver attempting to modify system memory fails to load because it lacks a valid signature.
Certificate Revocation Management:
- Implementation: Use Online Certificate Status Protocol (OCSP) or Certificate Revocation Lists (CRLs) to block certificates associated with compromised or deprecated code.
- Use Case: A compromised certificate used to sign a malicious update is revoked, preventing further execution of the software.
Third-Party Software Verification:
- Implementation: Require software from external vendors to be signed with valid certificates before deployment.
- Use Case: An organization only deploys signed and verified third-party software to prevent supply chain attacks.
Script Integrity in CI/CD Pipelines:
- Implementation: Integrate code signing into CI/CD pipelines to sign and verify code artifacts before production release.
- Use Case: A software company ensures that all production builds are signed, preventing tampered builds from reaching customers.
Key Components of Code Signing
- Digital Signature Verification: Verifies the authenticity of code by ensuring it was signed by a trusted entity.
- Certificate Management: Uses Public Key Infrastructure (PKI) to manage signing certificates and revocation lists.
- Enforced Policy for Unsigned Code: Prevents the execution of unsigned or untrusted binaries and scripts.
- Hash Integrity Check: Confirms that code has not been altered since signing by comparing cryptographic hashes.
| Item | Value |
|---|---|
| ID | M1045 |
| Version | 1.2 |
| Created | 11 June 2019 |
| Last Modified | 10 December 2024 |
| Navigation Layer | View In ATT&CK® Navigator |
Techniques Addressed by Mitigation
| Domain | ID | Name | Use |
|---|---|---|---|
| enterprise | T1059 | Command and Scripting Interpreter | Where possible, only permit execution of signed scripts. |
| enterprise | T1059.001 | PowerShell | Set PowerShell execution policy to execute only signed scripts. |
| enterprise | T1059.002 | AppleScript | Require that all AppleScript be signed by a trusted developer ID before being executed - this will prevent random AppleScript code from executing.3 This subjects AppleScript code to the same scrutiny as other .app files passing through Gatekeeper. |
| enterprise | T1554 | Compromise Host Software Binary | Ensure all application component binaries are signed by the correct application developers. |
| enterprise | T1543 | Create or Modify System Process | Enforce registration and execution of only legitimately signed service drivers where possible. |
| enterprise | T1543.003 | Windows Service | Enforce registration and execution of only legitimately signed service drivers where possible. |
| enterprise | T1546 | Event Triggered Execution | - |
| enterprise | T1546.006 | LC_LOAD_DYLIB Addition | Enforce that all binaries be signed by the correct Apple Developer IDs. |
| enterprise | T1546.013 | PowerShell Profile | Enforce execution of only signed PowerShell scripts. Sign profiles to avoid them from being modified. |
| enterprise | T1525 | Implant Internal Image | Several cloud service providers support content trust models that require container images be signed by trusted sources.21 |
| enterprise | T1036 | Masquerading | Require signed binaries. |
| enterprise | T1036.001 | Invalid Code Signature | Require signed binaries. |
| enterprise | T1036.005 | Match Legitimate Resource Name or Location | Require signed binaries and images. |
| enterprise | T1601 | Modify System Image | Many vendors provide digitally signed operating system images to validate the integrity of the software used on their platform. Make use of this feature where possible in order to prevent and/or detect attempts by adversaries to compromise the system image. 4 |
| enterprise | T1601.001 | Patch System Image | Many vendors provide digitally signed operating system images to validate the integrity of the software used on their platform. Make use of this feature where possible in order to prevent and/or detect attempts by adversaries to compromise the system image. 4 |
| enterprise | T1601.002 | Downgrade System Image | Many vendors provide digitally signed operating system images to validate the integrity of the software used on their platform. Make use of this feature where possible in order to prevent and/or detect attempts by adversaries to compromise the system image. 4 |
| enterprise | T1505 | Server Software Component | Ensure all application component binaries are signed by the correct application developers. |
| enterprise | T1505.001 | SQL Stored Procedures | Ensure all application component binaries are signed by the correct application developers. |
| enterprise | T1505.002 | Transport Agent | Ensure all application component binaries are signed by the correct application developers. |
| enterprise | T1505.004 | IIS Components | Ensure IIS DLLs and binaries are signed by the correct application developers. |
| enterprise | T1505.006 | vSphere Installation Bundles | Enabling the execInstalledOnly feature prevents unsigned binaries from being run on ESXi hosts.5 |
| enterprise | T1127 | Trusted Developer Utilities Proxy Execution | - |
| enterprise | T1127.002 | ClickOnce | Enforce binary and application integrity with digital signature verification to prevent untrusted code from executing.6 |
| enterprise | T1204 | User Execution | - |
| enterprise | T1204.003 | Malicious Image | Utilize a trust model such as Docker Content Trust with digital signatures to ensure runtime verification of the integrity and publisher of specific image tags.12 |
References
-
Docker. (2019, October 10). Content trust in Docker. Retrieved October 16, 2019. ↩↩
-
Microsoft. (2019, September 5). Content trust in Azure Container Registry. Retrieved October 16, 2019. ↩↩
-
Steven Sande. (2013, December 23). AppleScript and Automator gain new features in OS X Mavericks. Retrieved September 21, 2018. ↩
-
Cisco. (n.d.). Cisco IOS Software Integrity Assurance - Deploy Signed IOS. Retrieved October 21, 2020. ↩↩↩
-
Alex Marvi, Greg Blaum, and Ron Craft. (2023, June 28). Detection, Containment, and Hardening Opportunities for Privileged Guest Operations, Anomalous Behavior, and VMCI Backdoors on Compromised VMware Hosts. Retrieved March 26, 2025. ↩
-
Microsoft. (2023, March 9). ClickOnce and Authenticode. Retrieved September 9, 2024. ↩