---
title: "CAPEC-642: Replace Binaries"
url: https://radicalnotion.ai/capec/capec-642
type: capec
description: "Adversaries know that certain binaries will be regularly executed as part of normal processing. If these binaries are not protected with the appropriate file system permissions, it could be possible to replace them with malware. This malware might be executed at higher system permission levels. A variation of this pattern is to discover self-extracting installation packages that unpack binaries to directories with weak file permissions which it does not clean up appropriately. These binaries can be replaced by malware, which can then be executed."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-642: Replace Binaries

- **Abstraction:** Detailed
- **Status:** Draft
- **Typical severity:** High
- **CAPEC catalog version:** 3.9

## Description

Adversaries know that certain binaries will be regularly executed as part of normal processing. If these binaries are not protected with the appropriate file system permissions, it could be possible to replace them with malware. This malware might be executed at higher system permission levels. A variation of this pattern is to discover self-extracting installation packages that unpack binaries to directories with weak file permissions which it does not clean up appropriately. These binaries can be replaced by malware, which can then be executed.

## Prerequisites

- The attacker must be able to place the malicious binary on the target machine.

## Mitigations

- Insure that binaries commonly used by the system have the correct file permissions. Set operating system policies that restrict privilege elevation of non-Administrators. Use auditing tools to observe changes to system services.

## Example instances

The installer for a previous version of Firefox would use a DLL maliciously placed in the default download directory instead of the existing DLL located elsewhere, probably due to DLL hijacking. This DLL would be run with administrator privileges if the installer has those privileges.

By default, the Windows screensaver application SCRNSAVE.exe leverages the scrnsave.scr Portable Executable (PE) file in C:\\Windows\\system32\\. This value is set in the registry at HKEY\_CURRENT\_USER\\Control Panel\\Desktop, which can be modified by an adversary to instead point to a malicious program. This program would then run any time the SCRNSAVE.exe program is activated and with administrator privileges. An adversary may additionally modify other registry values within the same location to set the SCRNSAVE.exe program to run more frequently.

## Related weaknesses (CWE)

- [CWE-732](https://radicalnotion.ai/cwe/cwe-732): Incorrect Permission Assignment for Critical Resource

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-17](https://radicalnotion.ai/capec/capec-17) | Using Malicious Files |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| ATTACK | Server Software Component: Terminal Services DLL | 1505.005 |
| ATTACK | Compromise Client Software Binary | 1554 |
| ATTACK | Hijack Execution Flow:Executable Installer File Permissions Weakness | 1574.005 |
| OWASP Attacks | Binary planting | - |

## Frequently asked questions

### What is CAPEC-642?

Adversaries know that certain binaries will be regularly executed as part of normal processing. If these binaries are not protected with the appropriate file system permissions, it could be possible to replace them with malware. This malware might be executed at higher system permission levels. A variation of this pattern is to discover self-extracting installation packages that unpack binaries to directories with weak file permissions which it does not clean up appropriately. These binaries can be replaced by malware, which can then be executed.

### How do you prevent CAPEC-642?

Insure that binaries commonly used by the system have the correct file permissions. Set operating system policies that restrict privilege elevation of non-Administrators. Use auditing tools to observe changes to system services.

### What weaknesses does CAPEC-642 target?

CAPEC-642 exploits one CWE weakness: CWE-732 (Incorrect Permission Assignment for Critical Resource).

### How severe is CAPEC-642?

MITRE rates CAPEC-642 as High severity.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/642.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-642). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
